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

Interfacing a 3.3v SD card with a 5v PIC

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

Joined: 26 Sep 2014
Posts: 11

View user's profile Send private message

Interfacing a 3.3v SD card with a 5v PIC
PostPosted: Tue Dec 09, 2014 6:34 am     Reply with quote

Hello Friends!
I have done lot of Searching and exhausted my tries to interface the SD Card with PIC18F252. My PIC is running at 5V. and SD Card at 3.3volt. the output lines that are going from microcontroller to SD is level translated with Resistor network correctly. and output Pin of SD Card MISO is directly connected with PIC without any level conversation. I am using PIC CCS ex_mmc.c and fat.c library. I am using the 4GB Card.
I have done lot of mode and editing in hardware and at software level.
I have posted this query two time here related to this problem and follow each suggestions and guides. Anyone now can send me the complete update and running form library and suggest me the accurate schematics.
Your Help will be highly appreciated.


Joined: 11 Mar 2010
Posts: 17318

View user's profile Send private message

PostPosted: Tue Dec 09, 2014 7:21 am     Reply with quote

It won't work.

You need a level translator between the SD and the PIC.

Go to the Brush electronics site:

Page 3, shows a SD card connected to a 5v PIC. You need the pull up resistors, the division resistors on the output line, and the 3.3 to 5v translation the other way. All are shown.

With this you then have a chance.

The patches are in the code library here:

and here:

For the 4GB and above cards.

As written, the CCS drivers will work with a 2GB card (or below), provided it is formatted without an MBR (let the drivers format the card), with only a very few problems. These allow this to be extended.

Additional design notes:

Last edited by Ttelmah on Sun May 24, 2020 1:26 am; edited 1 time in total

Joined: 01 Jul 2010
Posts: 8147
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Sep 30, 2016 6:18 pm     Reply with quote

Other possible hardware options are

1) using the 'L' version of that PIC, it's rated for 3 volt operation..will have same pinout, features, etc..

2) another PIC, like the 18F46K22 which is rated for both 3 and 5 volt operation. More features like memory, peripherals, etc.

These days it's probably best to use a 3 volt PIC when using 3 volt peripherals (like SD cards) as it makes easy to interface them!


Joined: 30 Oct 2007
Posts: 442
Location: Ottawa, Ontario, Canada

View user's profile Send private message

PostPosted: Mon Oct 03, 2016 1:01 pm     Reply with quote

I see this is a bit old but since Temtronic responded last week, might as well add my grain of salt!

Just for trying when I started with SD development, I used an IL71x (716 or 717) level translator with a 5V PIC and SD cards and the MikroElectronika (DigiKey p/n 1471-1234-ND) SD interface and it worked.

Then I eliminated stuff I didn't need, went to a 3.3V pic and it works.

The critical part is the SD driver. Writing to SD cards is not as easy and simple as writing to an EEPROM. I have purchased the Brush Electronics SD driver because it just works. I've been using it for more than 2 years flawlessly and for the price, it's not worthwhile to write your own code (around 150$USD). Quite honestly, I didn't even bother with the CCS code because Brush's driver provide a full-fledged interface as if you were in a command prompt on your PC. When you write files to the card with the PIC, you can take the card and insert it in your PC and read the files directly. It's pretty awesome.

I am using this driver with the PIC24 series and I am writing on SDHC cards up to 32GB. Above 32GB, a license is needed by Microsoft I believe. And 2GB or less, I think you can write to the card like normal SPI data... but for a "true" SD card interface, the driver will do it.

You can also contact CCS support if you legally obtained their compiler. They are good at answering although I am talking from my own personal experience.

Good luck.

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