Ftdi ft245r
DynamoBen
Posts: 366
I'm using an FT245R on a project. I couldn't find anything in the object exchange so I created an object written entirely in spin. I've done some testing and discovered that while I'm able to read and write to the chip I'm not seeing the thru put that I need for my application.·According to the datasheet the·VCP driver·for this chip has a·maximum transfer rate is·300 kilobyte/second. I'm not getting anywhere near that.
·
Anyone use one of these before? Any tips or thoughts?
·
Anyone use one of these before? Any tips or thoughts?
Comments
Post Edited (deSilva) : 2/17/2008 8:28:51 PM GMT
Actually a set of tutorials like the spin tutorials might be nice. Also I'm a little surprised that an object doesn't already exist since Parallax sells the FT245R.
Post Edited (DynamoBen) : 2/6/2008 4:19:03 PM GMT
So I was wondering if someone wouldn't mind starting me off in the right direction. Here is·one subroutine from the code I'm trying to rewrite in PASM. How would someone convert this into PASM?
PUB rx : rxbyte | idx
· if started and bussOkay
··· DIRA[noparse][[/noparse]bussD0..bussD7]~······························ ' Set bussD0 to input
··· waitpne(|< RXF, |< RXF, 0)························· ' wait RXF pin to go low (data available)
··· outa[noparse][[/noparse]RD]~················································ ' pull RD pin low
··· rxbyte := ina[noparse][[/noparse]bussD0..bussD7]
··· outa[noparse][[/noparse]RD]~~·············································· ' set RD pin high··
···
·
Getting back to my previous post, I've been working through the code and hit a·conceptual barrier. As you can see I'm reading the state of 8 pins into a variable. To do this in PASM do I read each pin·(a bit) one·a time or can I read all the pins into a byte size variable like I did in spin? I have a feeling its a bit at a time but wanted to be sure that I wasn't missing a shortcut.
To be fair I have read through as many examples and tutorials as I can get my hands on. I've also been working through FullDuplexSerial one line at a time, and I no longer have a blank page. [noparse];)[/noparse]
Post Edited (DynamoBen) : 2/23/2008 4:44:41 AM GMT
UPDATE: I've done some testing tonight and am noticing that at low speed data integrity is good. However at "high speed" I'm seeing lost data and corrupt data. Could the root cause be that data is being written to the buffer faster than I'm reading it?
receive···············test··· rxfmask,ina··· wc···· 'check RXF pin is low (data available)
······· if_c··········· jmp···· #receive···············
······················· andn··· outa,rdmask·········· 'RDpin pulled low
······················· mov···· rxdata,ina··········· 'store state of the I/O pins into·rxdata
······················· and···· rxdata,bussmask······ 'AND rxdata (I/O) with bussmask
······················· shr···· rxdata,busspin······· 'Shift data to lowest part rxdata variable
·······················
······················· or····· outa,rdmask·········· 'RDpin pulled high
······················· rdlong· t2,par··············· 'save received byte and inc head
······················· add···· t2,rxbuff
······················· wrbyte· rxdata,t2
······················· sub···· t2,rxbuff
······················· add···· t2,#1
······················· and···· t2,#$0F
······················· wrlong· t2,par
······················· jmp···· #receive············· 'byte done, receive next byte
Post Edited (DynamoBen) : 3/31/2008 4:48:47 PM GMT