From: Sven on 9 Sep 2009 16:13 Hello again. I'm looking more (intensively) at application note AN232R-01 now. http://www.ftdichip.com/Documents/AppNotes/AN232R-01_FT232RBitBangModes.pdf I notice something at page 5 about Synchronous Bit Bang Mode. The timing diagram shows that the chip uses 6 time slots in this mode of operation, t1 to t6. And during t1, t3, t4, t5, t6 it reads the pins (5 time slots). And only at t2 (1 time slot) it writes to the pin. So when I send X bytes with FT_Write() I should have X*5 bytes to read with FT_Read()? Any thoughts about that? I don't know if it's right. I'm going to test this tomorrow. :-)
From: Paul Carpenter on 9 Sep 2009 17:49 [This followup was posted to comp.arch.embedded and a copy was sent to the cited author.] In article <4aa80c7e$0$285$14726298(a)news.sunsite.dk>, sven(a)sven.se says... > Hello again. > > I'm looking more (intensively) at application note AN232R-01 now. > > http://www.ftdichip.com/Documents/AppNotes/AN232R-01_FT232RBitBangModes.pdf Did you read my previous post? > I notice something at page 5 about Synchronous Bit Bang Mode. > > The timing diagram shows that the chip uses 6 time slots in this mode of > operation, t1 to t6. And during t1, t3, t4, t5, t6 it reads the pins (5 time > slots). And only at t2 (1 time slot) it writes to the pin. > > So when I send X bytes with FT_Write() I should have X*5 bytes to read with > FT_Read()? First RE-read the paragraph at the TOP of that page "Synchronous Bit Bang mode is the same as the FT2232 Synchronous Bit Bang mode. With Synchronous Bit Bang mode, data will only be sent out if there is space in the device for data to be read from the pins. This Synchronous Bit Bang mode will read the data bus pins first, before it sends out the byte that has just been transmitted. It is therefore 1 byte behind the output and so to read the inputs for the byte that you have just sent, another byte must be sent. " > Any thoughts about that? As explained in the paragraph and the timing digram it takes 6 clock cycles (BAUD rate set) to Read inputs pause (toggle read pin to clock next input pins from your devices) clock out data pins that are outputs pause Toggle write pin to clock outputs to your devices pause > I don't know if it's right. I'm going to test this tomorrow. :-) As described in the quoted paragraph above data is clocked in just before data is clocked out. So you CANNOT easily do your preferred scheme of write data change direction Read data The device does not work that way. You are aware that SPI data lines are NOT bidirectional? SPI has two data lines Master Slave MOSI output input MISO input output MOSI = Master OUT Slave IN MISO = Master IN Slave OUT By the way as described in the description above, make sure you flush the RX Fifo before writing data. -- Paul Carpenter | paul(a)pcserviceselectronics.co.uk <http://www.pcserviceselectronics.co.uk/> PC Services <http://www.pcserviceselectronics.co.uk/fonts/> Timing Diagram Font <http://www.gnuh8.org.uk/> GNU H8 - compiler & Renesas H8/H8S/H8 Tiny <http://www.badweb.org.uk/> For those web sites you hate
From: Sven on 10 Sep 2009 16:43 Hello again I have solved the problem. I used the FT_GetStatus() right after calling FT_Write(). That way FT_GetStatus() sayed I had 0 bytes to receive. Now I simply call FT_Read() after FT_Write() and let it wait for the same amount of data to read as i wrote. And I also got a lot of junk bytes to read because I didn't always empty the rx buffer. The FT232R is going to be connected to a PIC MCU to the MCLR (reset), PGC (clock) and a two way PGD (data). Thank's all :-)
From: Sven on 10 Sep 2009 17:34 And also thank you for the nice timing diagram font. :-) > Paul Carpenter | paul(a)pcserviceselectronics.co.uk > <http://www.pcserviceselectronics.co.uk/> PC Services > <http://www.pcserviceselectronics.co.uk/fonts/> Timing Diagram Font > <http://www.gnuh8.org.uk/> GNU H8 - compiler & Renesas H8/H8S/H8 Tiny > <http://www.badweb.org.uk/> For those web sites you hate
First
|
Prev
|
Pages: 1 2 Prev: 16-bit SPI trying to read from 22-clock cycle ADC Next: Counting number of cycles |