As mentioned here:
I'm working on converting a hard-drive-based datalogger to work with compact flash.
I'm using the flash cards as if they were IDE drives receiving PIO transfers. The general flow of the logger's operation is:
Fill buffer to 3/4 (to leave room to log while flushing) Turn on and initialize CF card Perform a series of WRITE SECTOR transfers Shut down CF card Update buffer status Repeat
My issue has been the number of sectors I can transfer with each WRITE SECTOR command. The original hard drive configuration of the logger could transfer 128 sectors at a time with out any trouble.
My attempts to match this (to minimize command processing overhead) have failed in the same manner with three different vendors and two speed grades of CF. Lexar 300x, and Transcend and Kingston 133x cards are all capable of transfers up to 32 sectors-per-operation and will fail on me if I try 64 sectors-per-operation. Furthermore, to get any size to work, the operation's starting sector must be a multiple of this value.
(i.e. a 16 sector-per-operation setup will work fine if the system starts writing at sector # 15 or 31 or 47, counting from 0. It will fail if writing starts at sector #s 16-30.)
The symptom of the failure that I see in the attempted recordings is skipped data points. It seems that the CF card is missing a few of the IDE Data Register writes in these failure cases. The card expects more data while the logger thinks that it has finished transmitting and the system hangs until it times out.
I suspect that this might have to do with the extra processing that the flash does to erase sectors before writes and to wear-level the card, but I'm not sure if this is a hard limit on the card's performance. Attempts to play with the CFA ERASE SECTORS and CFA WRITE SECTORS WITHOUT ERASE commands did not yield fruit.
Does anyone have any insight into why these CF cards do not behave like a hard drive when they receive large WRITE SECTOR commands?
--------------------------------------- This message was sent using the comp.arch.embedded web interface on