Recent

Author Topic: serread doesn't return any bytes from /dev/ttyUSB0  (Read 6011 times)

snafu

  • Newbie
  • Posts: 4
serread doesn't return any bytes from /dev/ttyUSB0
« on: April 04, 2010, 05:23:09 am »
Hello everyone,

I'm experimenting with Lazarus at the moment and trying to communicate with a serial device via /dev/ttyUSB0.

I can send commands to the device without issue, and the device does send data back BUT serread never returns any data. Always returns a result of 0 (bytes read)

If I watch /dev/ttyUSB0 with GtkTerm I can see the devices responses to the Lazarus generated commands.

The port is initialised with:
    MySerialHandle := SerOpen('/dev/ttyUSB0');
    SerSetParams(MySerialHandle, 4800,8,NoneParity,1,[]);

The OS is Ubuntu 9.10 AMD64.

Can anyone shed any light on this?

Thanks.

snafu

  • Newbie
  • Posts: 4
Re: serread doesn't return any bytes from /dev/ttyUSB0
« Reply #1 on: April 04, 2010, 05:22:52 pm »
Solved.

It seems there's some hysteresis to deal with.
A small delay between finishing the write and submitting the read resolves my issue.

 

TinyPortal © 2005-2018