Skip to content

Issue with BufferedSerial on RP2040 platfrom #272

Open
@ahmedalkabir

Description

@ahmedalkabir

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 😁

Metadata

Metadata

Assignees

No one assigned

    Labels

    RP2040bugSomething isn't workingenhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions