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

time delay associated with file system

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







time delay associated with file system
PostPosted: Wed Dec 07, 2005 4:02 pm     Reply with quote

Hello all,

I recently purchase Progressive Resources FAT file system. The code writes to a buffer and then writes out to an SD card when the buffer is full. This all works great but when writing out to the card I get a delay of around 250ms. It seems as though this is supposed to happen because of the delays in searching out a sufficient sector and what not. Oh, I run my spi bus at 5Mhz. My problem is I don't want my processor (18f6720) waiting on that transfer it has to maintain its timing loops at 2 ms and 10 ms. Now I have tried messing with the interrupts but if I run the SD card in the background and it gets interrupted during the big buffer write, it doesn't successfully store the data. I have tried disabling the rtcc interrupt (my timing loops) but that doesn't seem to work. Finally I've tried to prioritize the spi interrupt to see if that would accomplish anything but it didn't. Does any out there have any ideas.

Thanks in advance.
asmallri



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

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

PostPosted: Wed Dec 07, 2005 5:02 pm     Reply with quote

Qualifier first: I have not used the software you are talking about. I have written my own SD/MMC drivers and FAT system ported from various bits of code on the web and in the forum library.

The times you are talking about are WAY too long. The only real "long" time required when talking to these cards is the initial power on time where the card can take 500ms (actually takes much less) to transition to the ready state. According to the data sheet a read/write access should "typically" be 1ms and 2ms worst case. My testing shows it to be significantly less than 1ms. If your circuit powers down the SD/MMC card (physically removes power) then you would end up going through this power up sequence each time you accessed the card.

SD/MMC cards go to "sleep" after 5ms of inactivity and it can "take some" to wake up. I have no idea what "some time" is meant to be (I assume it is the 1 to 2ms mentioned previously). All the cards I have tested (about 10 different manufactures) have all responded immediately.

Creating a file can take a 10s of milliseconds (but much less than 250ms) as the PIC has very limited memory so the fat and directory has to be read for each operation and updated after each operation. The PIC does not have sufficient memory to "cache" this as would typically happen on a PC operating system. I am working on a design that requires new data to be logged at a sample rate of 50Hz writing 12 bytes per sample. In order to achieve this I am adding a FRAM to enable me to cache the FAT and the entire current cluster of the target file plus act as a ring buffer to cache incoming data while accessing the SD/MMC card.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
Guest
Guest







PostPosted: Thu Dec 08, 2005 11:30 am     Reply with quote

I have looked at the power being supplied to the card and even hooked up an external power supply. Still hasn't fixed the problem. It is Progressive's fputc_() function that takes so long. I will do some more digging but I am in the middle of another project now. Has anyone else had a similar problem?
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