EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Software reset for compact flash

Started by Michael R. Kesti April 22, 2008
We (my fellow employees and I) have been working on an MPC860-based
target that is not unlike some we've developed in the past except that
we have added a PCMCIA slot in which we use compact flash (CF) cards.
The PCMCIA section design was based on Wind River's wrMdpPro8xx reference
board and, being a VxWorks shop, we used the pccardlib.c and sys8xxPcmcia.c
modules from wrMdpPro8xx BSP as our starting point to provide the target-
specific portion of the PCMCIA drivers.

One hardware difference from the wrMdpPro8xx is that we omitted the circuits
that control power to the PCMCIA slot.  We thought that this was acceptable
as it appeared that controlling power was all about hot swapping which we
do not support.

We have discovered, however, that if the board is reset while a file is
being read from the CF, the subsequent PCMCIA initialization sometimes
fails to recognize and mount the CF file system, complaining about bad
partition table data.  Closer examination of the sys8xxPcmcia.c module
reveals that power to the CF is turned off early in initialization and
then later restored.  We hacked in some FETs and added code to control
power in a fashion similar to the wrMdpPro8xx and, sure enough, the
problem goes away.

So we're going to spin the board to add the FETs but this will take time
and there are already units in the field so I'm looking for a software
solution to alleviate the problem in the mean time.  I've tried a couple
of different ways to command CF resets and one way of emptying CF buffers
during PCMCIA initialization but with no success.

We're PCMCIA/CF newbies, so I'm asking whether anybody has a favorite
way to ensure, without the luxury of power control, that a CF card in
a PCMCIA slot is fully reset and ready for action.

Thanks!

-- 
========================================================================
          Michael Kesti            |  "And like, one and one don't make
                                   |   two, one and one make one."
    mrkesti at hotmail dot com     |          - The Who, Bargain

Michael R. Kesti wrote:

> The PCMCIA section design was based on Wind River's wrMdpPro8xx reference > board and, being a VxWorks shop, we used the pccardlib.c and sys8xxPcmcia.c > modules from wrMdpPro8xx BSP as our starting point to provide the target- > specific portion of the PCMCIA drivers. > > One hardware difference from the wrMdpPro8xx is that we omitted the circuits > that control power to the PCMCIA slot. We thought that this was acceptable > as it appeared that controlling power was all about hot swapping which we > do not support. > > We have discovered, however, that if the board is reset while a file is > being read from the CF, the subsequent PCMCIA initialization sometimes > fails to recognize and mount the CF file system, complaining about bad > partition table data. Closer examination of the sys8xxPcmcia.c module > reveals that power to the CF is turned off early in initialization and > then later restored. We hacked in some FETs and added code to control > power in a fashion similar to the wrMdpPro8xx and, sure enough, the > problem goes away. > > So we're going to spin the board to add the FETs but this will take time > and there are already units in the field so I'm looking for a software > solution to alleviate the problem in the mean time.
We have developed the drivers for the CF card and the POSIX compliant FAT32 filesystem for the custom BlackFin BF537 board. There is no need to control the power on the CF slot. There is a CF RESET line, but it appears that there is no actual need to control it either (unless on the very rare occasions of the CF hang up). Just make sure your software initializes the CF and the filesystem correctly after the occasional power down. It takes some time (hundreds of milliseconds) for the CF to initialize after the power is up or hw reset is deasserted; make sure the software doesn't try to access the card before it is ready. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com

The 2024 Embedded Online Conference