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...

LilData777
  • 304
  • 1
  • 14
Petr Osipov
  • 101
  • 2

1 Answers1

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

Milliways
  • 59,890
  • 31
  • 101
  • 209
  • 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? – Petr Osipov Feb 24 '23 at 10:59
  • Do not ask new questions in Comments. – Milliways Feb 24 '23 at 11:28