Hello Uwe,
> So this is clearly an overrun (OE). Either handle that overrun in
your code and firmware,
Yes it is but it happens very frequently with a low latency and almost
never (I have now ran into the problem a couple of times with the
latency set to a high value too, but it is very infrequent) happens.
> or use an asynchronous transfer, where libusb cares for you to poll
the FTDI in time,
Using async transfer did not help. Maybe the code is wrong:
tc = ftdi_read_data_submit(serialConnection->ftdi, &buffer[*bytesRead],
bytesToRead - *bytesRead);
printf("IN DONE\n");
res = ftdi_transfer_data_done (tc);
printf("AFTER DONE\n");
When the packet comes in ok, I get to 'AFTER DONE'. But when the
incomplete packet arrives it hangs in ftdi_transfer_data_done (tc)
because the number of requested bytes never come (they are lost). Does
that make sense?
> or use the kernel driver, where the kernel is in charge to poll for
you. Hope this helps
I will look into the kernel driver or maybe I will change my software on
the microcontroller never to send packets larger than the FTDI buffer at
once. Still I am puzzled about the 'why' and 'when'. Why is this almost
never happening with a high latency and very frequently with a low
latency. Some interaction between the latency timer and libusb/libftdi
must be present because the buffer of the FTDI is never large enough to
carry the full packet.
Regards,
Hendrik
--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
|