How do I force a Compact Flash interface to run in PIO-only mode (no DMA)?

Discussion in 'General Electronics Chat' started by kevinb456, May 16, 2013.

  1. kevinb456

    Thread Starter New Member

    May 16, 2013
    4
    0
    First of all I've used the search facility and can't find anything related to this, and I've also trawled through specs and google for weeks and been going round in circles for weeks so really would appreciate anyone knowledgeable with Compact Flash transfer modes (DMA / PIO), and especially the low-level signals and the Compact Flash specification giving me a helping hand!

    I am working on a PCB design which interfaces a Compact Flash card to a USB card-reader IC (Genesys Logic GL3233). The GL3233 accesses the compact flash card and then presents the card as a mass-storage device via USB.

    The USB aspect works correctly, but there is something wrong with the CF-to-GL3233 interface and the data transfers do not happen correctly when operating in DMA mode. For example, when using a card which supports max PIO mode 6 everything works fine. But when using a card which supports max DMA mode 4, there are frequent file errors and corruption of the file system on the card.

    I want to force the interface to operate in PIO-only mode even though both the CF card and the host "support" faster; how can I do this?

    Performance is not an issue, just that the transfer work without corruption. I do not have control of the CF card or host design/firmware, only the connection of the signals and the PCB design. My first idea was to leave DMARQ and DMACK disconnected so that the host (GL3233) would 'fall back' to PIO-only mode. It does, eventually, do this - however it takes ~200seconds which is not something we can live with! There are lots of other signals and I feel sure connecting / pulling up / pulling down these in a certain way should be able to interrupt the DMA initiation in such a way that it is not used. I just dont know where to start!

    Some other info; The interface is setup to run in True-IDE mode only. DMARQ and DMACK signals are connected from the CF card to the host (GL3233). There is a buffer IC (TI CF4320H) between the host and the CF card which introduces an approximate ~20ns delay. but other than that doesn't really interfere with the signals.

    Any help REALLY appreciated! Thanks
    Kevin
     
  2. kevinb456

    Thread Starter New Member

    May 16, 2013
    4
    0
    Anyone have ideas or experience with DMA / CF card interfaces? :confused:
     
  3. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    You are working in a pretty niche environment, so a lot of people won't know much about it (myself included). Perhaps you bottled post links to things you've found regarding the compact flash interface.

    My guess is that you will have to communicate with it to set it into PIO mode, so you may not be able to get away from the DMA interface completely. Or, it could be add easy as a pin connected elsewhere to signify PIO, but, like I said, I'm not familiar with it and this is just some guesses...
     
  4. kevinb456

    Thread Starter New Member

    May 16, 2013
    4
    0
    Myself included too!! Thats why its such an arse :) Im learning as I go though.

    My initial thought was the table in section 4.2 of the CF spec v4.1;
    http://www.csie.ntu.edu.tw/~b94108/2008dsd/cfspc4_1.pdf

    In true IDE mode, signal DMACK (pin 44) has note 6: "If DMA operations are not used, the signal should be held high or tied to VCC by the host." - So my initial thought was holding this high to force DMA not to be used. However now Im realising that this spec is written as instructions to the developer of the host - but if the host controller is already trying to do DMA, and the card is capable of it, then me stepping in the middle and pulling this high won't have the desired effect!

    Its plausible I could pull it out of True IDE mode and into memory-mode or IO mode, where there might be some combo of electrical signal connections that could force it into PIO mode, but this is an equal minefield and there's so many signals and nuances.

    Of course as you mention spot-on the other option is to communicate with it to set PIO mode, but we've chosen a specific controller and have no control over the design of the chip, and with there being a large $$ fee for "custom firmware" (even if it is only 1-line of code hardcoding a config value). So Im trying to find a way around this!

    If anyone has any ideas or knowledge on any of these modes I would be very grateful!!
     
  5. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    Does your unit have a IDE interface/Parallel ATA? I remember in the old days that fixed a of hard drives. That only worked in PIO mode. Take a look at the picture. And a look at a IDE cable. Sometimes people tried to force the PATA conector in the wrong way. The result was almost the same. A pin got broken and the unit only worked in PIO mode. From your post I am not sure you use IDE interface. But if you do. This may help you

    [​IMG]
     
  6. bertus

    Administrator

    Apr 5, 2008
    15,649
    2,348
  7. kevinb456

    Thread Starter New Member

    May 16, 2013
    4
    0
    Thanks for the ideas, however I don't think this applies to my situation as Im not working with a hard drive.

    Thanks bertus, I've taken a look but couldn't find anything stand-out that would help. There's probably something there but just so long and specialised its hard to pick out the important info!
     
  8. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    But as may may not know The compact flash interface can be routed to a IDE interface using just a cable that swap pins (in theory). A compact flash to IDE converter contains almost no hardware. http://www.allpinouts.org/index.php/IDE_to_CompactFlash_%28CF%29_adapter_schematic
    The pin 43 in the compact flash has the same function as the pin 21 on the IDE interface. If you are able try to cut the wire or disrupt the signal on PIN43 on the compact flash. That should give the same effect as breaking the pin 21 on a IDE drive
     
Loading...