CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

FAT16/32 format to write MMC with PIC18F4520 Problem

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
malimutlu



Joined: 04 Aug 2011
Posts: 1

View user's profile Send private message

FAT16/32 format to write MMC with PIC18F4520 Problem
PostPosted: Thu Aug 04, 2011 7:12 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Aug 04, 2011 9:36 am     Reply with quote

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: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

Re: FAT16/32 format to write MMC with PIC18F4520 Problem
PostPosted: Thu Aug 04, 2011 3:38 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Aug 05, 2011 5:25 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group