SD Card and PIC18LF26k22

Thread Starter

Peaches41

Joined Dec 15, 2016
70
Thank you all for reading my post.
I am working with a PIC18LF26K22 (3.3v), and implementing a sd card through the MSSP (using SPI). I will only be writing data TO the sd card and NOT reading from it. I have a few questions to ask since it is the first time I have worked w/ an sd card (microsd hc 4gb). I am programming this in assembly. SD card is formatted to FAT32.

1) Since I am only wanting to send data to the sd card do I need to still have the "DI" line connected or do I need it to be connected to send the
dummy data to the PIC (master)?

2) The PIC18LF26K22 (3.3v) has weak pull-ups on Port B which I am using for the sd card. If I am only writing data to the sd card am I correct to say that I will have weak pull ups (internal to the PIC) on the following pins: SS (slave select), and CD (card detect). The "DO", SCK, and "DI" do not need WPU since they are either not being used or are output (in state).

3) Since I am only sending data to the sd card from the PIC (master), am I correct to say that I do not need to have the SS line connected as the sd card is the only slave?

Thanks for your guidance.

Peaches
 

nsaspook

Joined Aug 27, 2009
16,321
Even if you are only writing application files to the SD card the low level routines will need read access to be sure the card is initialized and operational by reading card register status data.

https://members.sdcard.org/downloads/pls/simplified_specs/part1_410.pdf

I think the CS signal needs to be asserted during the reset command to enter SPI mode but I can't remember when or if the CS signal needs to be deasserted after any command or data transmission.
 
Last edited:

Thread Starter

Peaches41

Joined Dec 15, 2016
70
Even if you are only writing application files to the SD card the low level routines will need read access to be sure the card is initialized and operational by reading card register status data.
.
Thank you for your reply I will look over the file you suggested. I am just trying to get some good guidance with this topic as it is new to me. There is a lot of information to soak in. The flow chart for initialization in the link you provided will get me pointed in the right direction as I take small steps to tackle this.

TY,
Peaches
 

nsaspook

Joined Aug 27, 2009
16,321
Thank you for your reply I will look over the file you suggested. I am just trying to get some good guidance with this topic as it is new to me. There is a lot of information to soak in. The flow chart for initialization in the link you provided will get me pointed in the right direction as I take small steps to tackle this.

TY,
Peaches
If you're planning to write the routines from scratch then good luck.
Look a this for a possible FAT file system implementation.

http://elm-chan.org/fsw/ff/00index_e.html
 

spinnaker

Joined Oct 29, 2009
7,830
I am programming in assembly and not C for this as I do not know the C language. I have found A few samples online but not much. I will look at your 2nd provided link also.

TY

Peaches
I hope you have nothing else to do but work on your project for the next year. ;)
 
Top