Build a low level driver for SD card, then the glue logic for FatFs and USB MSD is pretty much the same as Flash memory case posed before. In case of SD card, sector size is 512 in most of the cases. Thus the memory requirement is much relaxed. You can even allocate a file buffer that is bigger than the sector size.
FatFs site has a dedicated page for MMC/SDC, on which you can find fairly detailed explanation about how to interface MMC/SDC via SPI bus. Implementation should be straightforward until you encounter with cheap SD cards that do not behave very well.
In such cases, you either have to protect your code with redundancy or just stick with quality devices. If you choose SanDisk or Kingston brand, you will be safe. ADATA on the other hand, frequently generates timeout error at first try.
Most of the SD card sockets have a pin to detect the presence of the card. This pin is usually connected to GND pin or some other pin. You can use this to generate interrupt whenever a card is inserted or removed.
When inserted, run card initialization sequence followed by FATFS_LinkDriver() and f_mount. When removed, you need to call FATFS_UnLinkDriver() to clear the disk state.
This hot-plugging does not work however for USB MSD interface. You have to insert the card before you plug the device to the USB port of the host system. And do not remove the card during USB operation.
>> source code <<
FatFs site has a dedicated page for MMC/SDC, on which you can find fairly detailed explanation about how to interface MMC/SDC via SPI bus. Implementation should be straightforward until you encounter with cheap SD cards that do not behave very well.
In such cases, you either have to protect your code with redundancy or just stick with quality devices. If you choose SanDisk or Kingston brand, you will be safe. ADATA on the other hand, frequently generates timeout error at first try.
Most of the SD card sockets have a pin to detect the presence of the card. This pin is usually connected to GND pin or some other pin. You can use this to generate interrupt whenever a card is inserted or removed.
When inserted, run card initialization sequence followed by FATFS_LinkDriver() and f_mount. When removed, you need to call FATFS_UnLinkDriver() to clear the disk state.
This hot-plugging does not work however for USB MSD interface. You have to insert the card before you plug the device to the USB port of the host system. And do not remove the card during USB operation.
>> source code <<
Tips to Improve Your Smoky Habanero - TITNIA
ReplyDeleteYou ford titanium ecosport can't titanium banger get titanium body armor enough of a titanium or ceramic flat iron spicy habanero that's a scorching hot pepper. Just titanium wheels let it burn like it's a ghost pepper!