Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Before posting, check here first for general advice

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> KokkeKat FAT-free SD card lib
View previous topic :: View next topic  
Author Message
KokkeKat

Bascom Member



Joined: 08 May 2011
Posts: 59
Location: Stockholm

sweden.gif
PostPosted: Fri Jul 01, 2011 10:14 am    Post subject: Before posting, check here first for general advice Reply with quote

This thread will only contain my posting of general advice, so please don't post any questions here.

* You can find the SD lib files on the page for the AN #186 download: http://www.mcselec.com/index.php?option=com_content&task=view&id=291&Itemid=57

* Make sure your PSU is stable and can supply 2.7-3.6 V with the required power to the circuit.

* Make sure you have all the required pull-ups.

* If you are sharing the SPI interface e.g. with the ISP programmer, make sure to disconnect the programmer after programming.

* When moving the SD card from a PC to the uC and back to the PC, make sure that you eject the card properly in Windows. Otherwise, Windows file system buffering will be blind to what your uC writes to the card. Rebooting the PC always works.

* If you can't communicate with the card, try starting up a new debug project in which you set Sdinitdetail = 0 for more ambitious/verbose SD initialization. Only do the SD init routine with additional PRINT statements for debugging.

* SDusefind and Sddirlist should never both be set to 1 at the same time.

* sdeof must be set to 0 and sdbytesread must be set to 0 at the beginning of each file reading.

* When using Sddirlist, you must also define the size of the array that stores the current directory's clusters. You can set it to as low as 1, but you will get much faster directory scrolling if you don't have to follow the cluster chain for each previous cluster when going backwards. Below is just "any" value:
Const Sddirlistarraysize = 12

* Place Gosub Sdinit and Gosub Sdinitfs at the AVR initialization (before the main program loop).

* Always use all 11 characters in 8.3 file names.

* The Nokia 3310 library isn't necessary for the SD library. It is included simply because I used it when developing and debugging.

* The reason why I am using gosubs instead of subs or functions is that each call to a sub or function requires first placing and then retrieving all registers on the stack, i.e. about 60 extra clock cycles. Using gosubs means that the library itself can only use global variables (but not doing the variable copying as declared in the sub or function header also in some cases improves performance). This of course doesn't prevent you from using subs or functions with local variables in your own (non-lib) code.

* Please understand that I can't provide beginner's help. I am providing this library and support free of charge, which means the users need to learn on their own. This support forum is primarily intended for getting help when a confirmed or suspected bug is found in my code.

One thing you need to learn is the basics of FAT16/32. Please google for tutorials on FAT32. Make sure you understand:
* the concept of cluster chains
* the relationship between cluster / sector in cluster / byte in sector
* the FAT, file allocation table
* the directory structure

One place to start is (the second half of) this page:
http://www.pjrc.com/tech/8051/ide/fat32.html


Kind regards

Niclas
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> KokkeKat FAT-free SD card lib All times are GMT + 1 Hour
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
You cannot attach files in this forum
You cannot download files in this forum