In this scenario, your PIC is a USB Mass Storage Host and wants to read/write data on a USB Mass Storage Device like a thumb drive. So all you have to do is plug the MAL USB MS-Device routines to your diskio.c/h routines (see usbdevFatFs.c/h in the example code). The USB Host will take care of implementing the file system and/or formatting the device. Something that might not be apparent on first glance is that for the case of a USB MS-device, you DO NOT need to implement a FAT system on the Device. Integrating FatFs with the MAL USB Library There are a few sections in Chan’s code marked as “Platform Dependent” that you need to modify. Then you have to modify the diskio.c routines to match your particular SPI port. But you have to add a call to the timer function and implement a function to return the timestamp for the files. You should not have to change anything to the ff.c/h files. In this scenario, your PIC is interfaced to an SD/MMC card via SPI and you have to set up a FAT system to access data on the SD card. Integrating FatFs (with an SD card access) You should also download the latest FatFs library and the sample Functionġ. In this example I will only consider SD cards (over SPI) and USB Mass storage devices. So you can build the system on different types of memory, furthermore in the case of FatFs your application can manipulate multiple memory types simultaneously. Note that both FatFs and FSIO have separated the FAT layer from the lower disk access layer. Most of the information contained here is just an aggregation of the things I found trawling the posts on Microchip forums.īefore going into the details, the files involved and their function should be evident. Sample code is also available for download. This post will explain how to integrate FatFs to a Pic24 project. In spite of doing all this stuff that I would gladly sell off my left testicle for, he actually refers to himself as a “ mediocre” embedded systems engineer!! Anyhow, it’s also released with a free, open source, do-whatever-crap-you-can-with-it license. It seems to the handiwork of a one samurai army, who has done a lot of other cool projects too. It takes up quite a lot of code + data space, is slower than Evolution (when there’s no external duress) and not extensible – for instance to support multiple volumes or long file names.įatFs can solve all these problems. Hovever, their FAT library is not the best out there. The USB stacks, along with their well written application notes are very good and quite easy to integrate, even if you know nothing about USB. So far I have had the opportunity to use some of the USB (MSD,HID,MS-Host) stacks along with their FAT library (FSIO). The Microchip Applications Library has a lot of great code that is easy to integrate and can bump up the feature set of your product in hours.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |