View previous topic :: View next topic |
Author |
Message |
malimutlu
Joined: 04 Aug 2011 Posts: 1
|
FAT16/32 format to write MMC with PIC18F4520 Problem |
Posted: Thu Aug 04, 2011 7:12 am |
|
|
Hello,
I am trying to write 4 channel analog data to MMC with PIC18F4520. Everything is fine for collecting data from A/D channels and write all 512bytes to buffer, however when buffer is reach 512 byte then spi is trying to write MMC with FAT format but it takes too much time (is about 60ms) for my 10ms interrupt routine. (because i could not collect 6 set of datas, they are all lost).
Could anybody suggest me how can i reduce MMC writing time problem with my microcontroller?
Possible Suggestions:
1. Another file format? (i try both fat16 and fat32)
2. Another type of microcontroller, which is faster then PIC18F4520
etc.
thanks for your attention. |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Thu Aug 04, 2011 9:36 am |
|
|
You get a considerable overhead by updating FAT and directory data. Because a PIC18 hasn't sufficient memory to buffer these structures, read-modify-write has to be performed each time. Using a faster processsor with more RAM can speed up these operations. Alternatively, you can write the data to a predefined file area without accessing FAT data at all. |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1636 Location: Perth, Australia
|
Re: FAT16/32 format to write MMC with PIC18F4520 Problem |
Posted: Thu Aug 04, 2011 3:38 pm |
|
|
malimutlu wrote: | Hello,
I am trying to write 4 channel analog data to MMC with PIC18F4520. Everything is fine for collecting data from A/D channels and write all 512bytes to buffer, however when buffer is reach 512 byte then spi is trying to write MMC with FAT format but it takes too much time (is about 60ms) for my 10ms interrupt routine. (because i could not collect 6 set of datas, they are all lost).
Could anybody suggest me how can i reduce MMC writing time problem with my microcontroller?
Possible Suggestions:
1. Another file format? (i try both fat16 and fat32)
2. Another type of microcontroller, which is faster then PIC18F4520
etc.
thanks for your attention. |
I do a lot of data logging work with PICs and SD/MMC cards. The trick to this type of data logging is to decouple data capture from low level SD card read/write operations. I sell my own FAT file system drivers which includes a fully functional sample data logger application that decoupling capture from sd card operation. It all comes down to how much RAM you have available. This is relatively tight, but achievable with PIC18F processors and relatively comfortable with PIC24 processors.
The basic idea is that data capture is interrupt driven driving a large ring buffer (again easier with a PIC24 that is capable of capturing multiple channels as a result of a single conversion request). Outside the interrupt handler the main execution unit extracts data from the capture ring buffer and writes to the file system buffer (RAM to RAM operation). Once the file system buffer is full the file system driver flushed the sector to the SD card, performs any file system related activities and fetches the next sector into the file buffer. Decoupling the operation means there is no latency variation with the sampling.
If you want to go down this track I suggest buying my driver because, in this scenario, the sample application alone will save you a lot of development time. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Fri Aug 05, 2011 5:25 am |
|
|
I was under the assumption, that you have difficulties to achieve the required overall sustained write speed, but re-reading your post, I completely agree with Andrew that suitable buffering should do the trick. For your data rate, a PIC18 should work.
I also can confirm the good quality of the brushelectronics drivers. |
|
|
|