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 driver initialization problem - PNY SD cards

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

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

SD driver initialization problem - PNY SD cards
PostPosted: Sat Nov 01, 2008 11:21 am     Reply with quote

Hi,

A lot of CCS users make use of the Brush Electronics' SD card file system library or SD card utilities library. The base software for these drivers is common and has been extensively tested and is widely deployed. I recently had a CCS customer report a problem with using PNY cards. After examining one of the problem cards I determined that it failed in the initialization section where the SPI bus speed is changed from low speed to high speed.

The work around is straight forward: prior to changing the SPI bus speed, deselect the SD card, change the SPI bus speed, and finally reselect the SD card and continue card initialization. Other drivers may exhibit a similar problem with this card.

If you are using the Brush Electronics' drivers, locate the function disk_initialize which is either in diskio.h or media_io.h file. Then locate the second call to setup_spi located towards the end of the function and modify the code as per below.

Before:
Code:

   // SPI Mode 0
   setup_spi(SPI_MASTER | SPI_L_TO_H | SPI_CLK_DIV_4 | SPI_XMIT_L_TO_H);


after:
Code:

   DeselectSD;
   // SPI Mode 0
   setup_spi(SPI_MASTER | SPI_L_TO_H | SPI_CLK_DIV_4 | SPI_XMIT_L_TO_H);
   SelectSD;

_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
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