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 card problem

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



Joined: 18 Mar 2009
Posts: 38

View user's profile Send private message

SD card problem
PostPosted: Mon Mar 29, 2010 3:55 pm     Reply with quote

Hello all,
I have a project where I must use a SD card under fat32.
For starting, I am trying to do simple things with mmcsd.c from the CCS library. I use a SD daughter card from Microchip (AC164122). This card is brand new.

I use this simple code just to test writing a value and read it back just after, it comes from the examples library : ex_mmcsd.c


I had no success getting the card initialized. To make sure the hardware is ok, I am watching the SPI signal with a scope and there? SDI (signal form the card to the pic) stay always at 0V.

What is wrong ? If anyone have some advice, I would be very interested to know it.

Thanks in advance for the answer.

Dynamitron.
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Mon Mar 29, 2010 4:59 pm     Reply with quote

In order to help you we need more info:
- What is your compiler version number?
- Which processor are you using?
- Describe your hardware connections, or even better post a schematic.
- The pull-up resistors are present on the data lines?
- What voltage is the PIC running?
- And what voltage the SD card?
- Do you get any output printed? What output?

Post a small example program demonstrating your problem. Even when you are using ex_mmcsd.c you would have had to make some modifications for your hardware setup.
asmallri



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

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

Re: sd card problem
PostPosted: Mon Mar 29, 2010 11:09 pm     Reply with quote

dynamitron wrote:
I use a sd daughter card from microchip (AC164122). This card is brand new.


There was an issue that I found with the Rev 3 boards that I reported to Microchip a few years back. The problem manifests itself when using a 5 volt system such as the Microchip HPC board (PIC18F8722). Basically the level translation logic does not work as intended. You can test if this is the problem by reducing the power supply to the PIC to say 4 volts. I solved it by replace the level converter from the PIC to the SD card with resistor dividers.
_________________
Regards, Andrew

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



Joined: 18 Mar 2009
Posts: 38

View user's profile Send private message

PostPosted: Tue Mar 30, 2010 1:09 pm     Reply with quote

Thanks for the first answers.

Some more info :

Compiler version 8.40
Processor Pic 18F8722
Pic voltage 5V
Voltage of the SD card 5V (pic side), 3.3V (card side).

There is 10k pull-up resistor to 3.3V on the daughter card on the SD side.
SD and Pic are interfaced by level converters and everything is as provided by microchip

The code is from ccs exemple ex_fat.c and mmcsd.c
asmallri



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

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

PostPosted: Tue Mar 30, 2010 8:07 pm     Reply with quote

dynamitron wrote:
Thanks for the first answers.

Some more info :

Compiler version 8.40
Processor Pic 18F8722
Pic voltage 5V
Voltage of the SD card 5V (pic side), 3.3V (card side).

There is 10k pull-up resistor to 3.3V on the daughter card on the SD side.
SD and Pic are interfaced by level converters and everything is as provided by microchip

The code is from ccs exemple ex_fat.c and mmcsd.c



Is the SD PICTail a rev 3?
_________________
Regards, Andrew

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



Joined: 18 Mar 2009
Posts: 38

View user's profile Send private message

PostPosted: Tue Mar 30, 2010 11:58 pm     Reply with quote

Where do I find this inofrmation ? On the card itself ?
asmallri



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

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

PostPosted: Wed Mar 31, 2010 2:07 am     Reply with quote

dynamitron wrote:
Where do I find this inofrmation ? On the card itself ?


Yes - or the box it shipped in or the documentation that came with it.
_________________
Regards, Andrew

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



Joined: 18 Mar 2009
Posts: 38

View user's profile Send private message

PostPosted: Wed Mar 31, 2010 11:43 pm     Reply with quote

I have a rev1 card, it is mentionned on the delivery sheet which comes with the card.

I have tried to use a C code from microchip compiled with their student compiler. A this moment, I see indeed that with the scope, the SDI is alive but still the card is not going to initialized state.
The soft is very hard to understand, I do not believe that I will be able to do anything with it. I probably must pursue with ccs.

Any hint before I start modifying the card with my soldering iron ?
asmallri



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

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

PostPosted: Thu Apr 01, 2010 3:29 am     Reply with quote

dynamitron wrote:
I have a rev1 card, it is mentionned on the delivery sheet which comes with the card.

I have tried to use a C code from microchip compiled with their student compiler. A this moment, I see indeed that with the scope, the SDI is alive but still the card is not going to initialized state.
The soft is very hard to understand, I do not believe that I will be able to do anything with it. I probably must pursue with ccs.

Any hint before I start modifying the card with my soldering iron ?


Did you see my suggestion for delivering a lower voltage to the PIC? If the card is the problem then it will start working correctly.
_________________
Regards, Andrew

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



Joined: 18 Mar 2009
Posts: 38

View user's profile Send private message

PostPosted: Thu Apr 01, 2010 6:19 am     Reply with quote

yes I saw it and it is my next move...
Thanks for this suggestion, I will let you know.
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