0

I am using a Raspberry Pi, with a USB serial connection - so a Raspberry Pi has a USB lead connected to some hardware lighting board.

When I send many serial-commands down this USB connection, there seems to be a lag where it can slowdown sometimes, and not let the next serial-command through, it seems to help partially when I put a delay in serial-commands sent, and if I do the same thing from Windows there is no lag issue.

I have set the parameters needed for the Serial-USB hardware to work:

stty -F /dev/ttyUSB0 38400

On windows, which does not have the lag - I use:

mode com3: BAUD=38400 PARITY=N data=8 stop=1 xon=off

Even if I set the other similar parameters on Linux, there are still delays. - So question is for the stty command, are there some parameters or settings that I can set on the USB port that will end the serial-command sent instantly, and let multiple instant serial-commands to be sent. So that if 3 are sent together, it either queues them or, allows all 3 in sequentially.

I have looked at "man stty", and tried some options but to no avail... so looking for some experienced help for a solution.

Or is there something alternative to stty that can be used that will work faster or better for lots of Serial-USB-commands sent at once.

BTW, I am using PHP to send the serial-command like:

file_put_contents("/dev/ttyUSB0", chr(6).chr(255).chr(0).chr(0).chr(0).chr(5));

Which I think is not the issue, Any help appreciated. Thanks.

aku foo
  • 53
  • 6

1 Answers1

0

I use the same setup: Raspberry Pi B+ and USB-2-serial device. I had the same issue: multiple commands in a single 'stty'command fail. Instead I use sequence of single 'stty' commands, separated by a sleep-period (hundreds of milliseconds). It is not nice but it's functional - the initialization only occurs once after startup.

pat29
  • 1