libftdi Archives

Subject: Understanding "ftdi_usb_purge_rx_buffer"

From: Günther Grantig <powertomato@xxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Wed, 12 Nov 2014 02:02:10 +0100
Hi,

I'm using a FT232RL in bitbang mode to communicate to a device with a
proprietary protocoll. It has a lot of burst writes, but occasionally
replies with short messages. For those I need reads correlating to
specific clock edges.

The way I intended to do this was:

1. change to BITMODE_BITBANG
2. burst write the data
3. change to BITMODE_SYNCBB
4. ftdi_usb_purge_rx_buffer
5. toggle the clock line a couple of times
6. read the data
7. change back to BITMODE_BITBANG and continue writing


The problem with this solution was, that even after a successful
"ftdi_usb_purge_rx_buffer" call, the buffer seemed to contain data
(>200bytes!). Why is this? For now I clear the buffer manually by
reading it's content.

If you need code I'll gladly try to reproduce this in a simpler
example. The current code is too nested to post here.

Best regards

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread