Shop OBEX P1 Docs P2 Docs Learn Events
Ftdi ft245r — Parallax Forums

Ftdi ft245r

DynamoBenDynamoBen Posts: 366
edited 2008-03-30 03:21 in Propeller 1
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?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-02-06 05:33
    Spin can do 19.2KBps half duplex asynchronous serial I/O. In your case, you're doing 8-bit parallel I/O. You're still likely to be able to do at best 1/2 of the chip's maximum throughput by the time you do the necessary handshaking in Spin. If you post your Spin code, we can make suggestions for fine-tuning it for speed, but you're likely to need assembly language for anything near the maximum transfer rate. The Propeller is certainly capable of exceeding that using assembly. The FullDuplexSerial asynchronous serial I/O driver is capable of doing at least 230KBps simultaneously in both directions.
  • deSilvadeSilva Posts: 2,967
    edited 2008-02-06 08:24
    FullDuplexSerial is much faster, but Mike's conservative figures are very often quoted, as you have to consider its usage from SPIN and the required overhead for character handling in that part of the program.

    Post Edited (deSilva) : 2/17/2008 8:28:51 PM GMT
  • DynamoBenDynamoBen Posts: 366
    edited 2008-02-06 15:51
    Well it looks like I'm 0 for 2. This is the second project I've taken on that I can't do in spin.·cry.gif··I guess I will start seaching for a good document, book, tutorial, or webpage that will help me learn assembly. I'm a high level guy so I'm struggling with even the basics.

    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
  • DynamoBenDynamoBen Posts: 366
    edited 2008-02-17 20:14
    Okay so I have writers block. I've been staring at a blank page for the last hour and don't know where to start. I've been reading up on PASM and am starting to come around.

    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··
    ···
  • deSilvadeSilva Posts: 2,967
    edited 2008-02-17 20:26
    Have you already worked through my Tutorial "Programming the Parallax Propeller using Machine Language"? However it needs a little pre-knowledge with assembly languages, but if you are a VERY GOOD HLL programmer you might do it even without smile.gif
  • DynamoBenDynamoBen Posts: 366
    edited 2008-02-20 05:37
    deSilva said...
    Have you already worked through my Tutorial "Programming the Parallax Propeller using Machine Language"? However it needs a little pre-knowledge with assembly languages, but if you are a VERY GOOD HLL programmer you might do it even without smile.gif
    I have, some of it is still over my head but I will continue to use it as a reference. I will get it eventually. [noparse];)[/noparse]
    ·
    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.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-02-20 06:06
    PASM doesn't have the "bitstring subset" notation of Spin. You get all 32 I/O pins in a single value (INA) and you have to use AND and shift instructions to isolate the bits you want and move them to the part of the value that you want, then use WRBYTE to store them in a hub memory location as a byte value.
  • deSilvadeSilva Posts: 2,967
    edited 2008-02-20 08:34
    DynamoBen said...
    ...but I will continue to use it as a reference.
    This will not help any... It is NOT a reference, it is a TUTORIAL. You have to UNDERSTAND it!
  • DynamoBenDynamoBen Posts: 366
    edited 2008-02-20 15:25
    Mike Green said...
    PASM doesn't have the "bitstring subset" notation of Spin. You get all 32 I/O pins in a single value (INA) and you have to use AND and shift instructions to isolate the bits you want and move them to the part of the value that you want, then use WRBYTE to store them in a hub memory location as a byte value.
    OK thanks this gets me headed in the right direction.
  • DynamoBenDynamoBen Posts: 366
    edited 2008-02-20 15:34
    deSilva said...
    DynamoBen said...
    ...but I will continue to use it as a reference.
    This will not help any... It is NOT a reference, it is a TUTORIAL. You have to UNDERSTAND it!
    I'm sure this document is a very easy read for someone who has a lot of experience with micros I however am a hobbyist and this is my first attempt at learning assembly. While I would like to say that reading your document made all the difference, that just isn't the case.

    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
  • DynamoBenDynamoBen Posts: 366
    edited 2008-03-30 03:21
    Using fullduplexserial as a template I created this code (see the spin version above). The intention was to be able to strip data faster from the FT245r. However using this code seems to be slower and for the life of me I'm not sure where the bottle neck is. Thoughts?

    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
Sign In or Register to comment.