-
-
Notifications
You must be signed in to change notification settings - Fork 213
Open
@ahmedalkabir
Description
hey.
I faced an issue when using BufferedSerial class specially when writing buffer or data, it just write 2 data and stop ??, actually it is blocking and stuck.
here's the code
#include <Arduino.h> #include "mbed.h" rtos::Thread thread_1; static mbed::BufferedSerial serial_port(p4, p5); void uart_thread() { serial_port.set_baud(115200); serial_port.write("buffer", 7); // never write all of serial_port.write("9", 1); char buf[32] = {0}; while (1) { if (uint32_t num = serial_port.read(buf, sizeof(buf))) { serial_port.write(buf, num); } } } void setup() { thread_1.start(uart_thread); }
I read Serial source code and I noticed it depends on UnbufferedSerial, I tested UnbufferedSerial and it worked as I expected but BufferedSerial's write functionally doesn't work well !
I used PlatformIO and Raspberry Pi Pico which is based on RP2040, so I hope the issue resolve as soon as possible and thanks 😁