arduino / arduino/ArduinoCore-mbed
Issue with BufferedSerial on RP2040 platfrom
- Dominant language
- C
- Stars
- 411
- Forks
- 225
- PR merge metrics
- No merged PRs in 30d
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
```c++
#include
#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 😁
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the BufferedSerial write path mentioned in the issue and compare it with UnbufferedSerial, using the provided RP2040 and PlatformIO example as the reproduction. Verify whether writing "buffer" blocks after two bytes and whether the following write completes; done means BufferedSerial transmits the full data and does not remain stuck.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- arduino, cpp
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 42/100