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

SD kart programming using elm chan PetitFat library
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
asmallri



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

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

PostPosted: Sat Feb 24, 2018 11:37 am     Reply with quote

salih260 wrote:
thank you very much Ttelmah and temtronic..
Does the SD card draw much current? If so, it means 100% hardware problem. Because SD card + Pic + etc. It is fed from 3v3 regulator.
(Regulator max. output current is 1A.)


I have read through the thread and have some comments

1. My drivers (Brush Electronics) come in two versions, one for the PCH compiler (PIC18 - 8 bit) and one for PCD (PIC24/dsPIC33 - 16 bit). The reason I have two different drivers is because when using 16 bit processors the data structures are WORD aligned as opposed to BYTE aligned. In theory, you could use the 16 bit driver with an 8 bit processor (I don't recommend it) however it would be wasteful of resources and performance on the 8 bit processor.

2. SD cards contain an embedded processor. A glitch on the card's power line can reset the card's processor. Power supply filtering and decoupling as close as practical to the SD card will prevent the high current transients required during write operations to the card being the cause of card related transients resetting the card. You need to use low ESR capacitors, I use 10uF and 0.1uF ceramic capacitors for new designs. Previously I used 22uF tantalum and 0.1uF ceramic capacitors for this role.

3. If you accidentally power the SD card from 5 volts or apply +5V to any of its pins, even momentarily, throw the card away. You are wasting you time working further with the card even when it appears to be still working ok.

4. Watch out for fake or low quality copy cards out of Asia. They may or may not work depending on the day of the week, whether there are clouds in the sky, if they are facing north etc.

5. During the development process ALWAYS format the card initially with a reliable SD formatter application. Do NOT rely on the windows format utility. Go to www.sdcard.org and download their free format utility.

6. The pull-up resistor on DO from the card (aka MISO) is very important. Lots of people make the mistake of "optimizing" the design by leaving it off and then you end up with the situation it works with some cards out of a batch and not others or it works on humid days but not dry days.

7. The cards should work well for SPI speeds of 10MHz and below without issue. For higher speeds, care must be taken with the layout of the tracks on the PCB as excessive capacitance can cause signal degradation.
_________________
Regards, Andrew

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


Last edited by asmallri on Sat Feb 24, 2018 12:18 pm; edited 1 time in total
Ttelmah



Joined: 11 Mar 2010
Posts: 19225

View user's profile Send private message

PostPosted: Sat Feb 24, 2018 12:16 pm     Reply with quote

I'd add two more things.
With the code as posted in the PetitFat example, he must have:
Code:

#device CONST=READ_ONLY
#device PASS_STRINGS=IN_RAM


This is because is the assumptions PetitFat makes, so doesn't apply to your drivers....

Then the user has to supply the read/write and initialise functions. He might want to post what he is actually doing for these, and particularly the clock switching.
salih260



Joined: 19 Feb 2018
Posts: 23

View user's profile Send private message

PostPosted: Mon Feb 26, 2018 3:01 am     Reply with quote

Thanks asmallri.
I will make your gestures step by step.
salih260



Joined: 19 Feb 2018
Posts: 23

View user's profile Send private message

PostPosted: Mon Feb 26, 2018 3:02 am     Reply with quote

Thanks Ttelmah.

I will add these. Let's see what happens this time.

good works.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2, 3
Page 3 of 3

 
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