View previous topic :: View next topic |
Author |
Message |
adnan jafar
Joined: 26 Sep 2014 Posts: 11
|
Interfacing 3.3v to 5v (originally in particular an SD card) |
Posted: Tue Dec 09, 2014 6:34 am |
|
|
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.
Regards,
Adnan |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19510
|
|
Posted: Tue Dec 09, 2014 7:21 am |
|
|
It won't work.
You need a level translator between the SD and the PIC.
Go to the Brush electronics site:
<https://www.brushelectronics.com/wp-content/uploads/2018/09/BE_Reference_Design_PIC18F4620_ENC28J60.pdf>
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:
http://www.ccsinfo.com/forum/viewtopic.php?t=43417
and here:
http://www.ccsinfo.com/forum/viewtopic.php?t=52490
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:
http://www.ccsinfo.com/forum/viewtopic.php?t=56979&start=30
Last edited by Ttelmah on Sun May 24, 2020 1:26 am; edited 1 time in total |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9226 Location: Greensville,Ontario
|
|
Posted: Fri Sep 30, 2016 6:18 pm |
|
|
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!
Jay |
|
|
benoitstjean
Joined: 30 Oct 2007 Posts: 566 Location: Ottawa, Ontario, Canada
|
|
Posted: Mon Oct 03, 2016 1:01 pm |
|
|
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.
Ben |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19510
|
|
Posted: Wed Feb 23, 2022 12:49 am |
|
|
Be aware that these comments apply to all situations where you are
mixing levels. So 3.3v device to 5v PIC, 3.3v PIC to 5v device etc. etc..
In all cases to be reliable you need to use a level translator chip when
going from a 3.3v 'source' to 5v 'destination', but can generally use
a resistive divider going the other way. |
|
|
|