0

I got a Raspberry Pi 4 processing Lidar data (RPLIDAR S2) with python (PySerial library). The lidar sends data in chunks of about 50-60 bytes at 1000000 bps over serial. When I use a USB Serial FTDI dongle that comes with a lidar, I can easily read data, buffer easily holds them until read. However, my robot should be compact, so I want to eliminate the dongle and the extra USB cable, so I tried to connect the lidar directly to the GPIO and connect using the UART /dev/ttyS0. I can set up the connection, read lidar info, and order it to start - these data are only a few bytes long. The problem is, when I start sending data using 50-byte chunks, I get errors - the buffer is smaller than the chunks which I am trying to read at once...

Which would be the solution? Is it possible to increase the buffer size on the OS level or PySerial? Stuck here...

1 Answer 1

0

Your question is incomplete and lacking detail of HOW you are attempting to use serial.

/dev/ttyS0 is a low performance UART designed for console use.

The Pi4 has 5 fully featured UART and at least 4 are usable. Try another UART.

Raspberry Pi4 UART

2
  • Thanks! I was looking for that! With UART4 activated, I can read the lidar's serial, etc. However, I still cant get the scan running - when I send the scan command, lidar does not spin up and looses connection, probably due to its 2500mA run-up current being too much for 5V pins. (and also for X728 UPS board's 5V out as it looks like) Most likely, the USB FTDI has some ways to handle this... Any idea how to handle this run-up current? Commented Feb 24, 2023 at 10:59
  • Do not ask new questions in Comments.
    – Milliways
    Commented Feb 24, 2023 at 11:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.