How would I read raw data from SD Card not formatted as FAT?
I'm trying to read raw data from an SD card that is not formatted with the file system used in the example (flexprop).
I've tried many things. I formatted the sd card as FAT, wrote a file, and listed the directory with the shell.c example provided with flexprop. This worked fine. Trying using SPI with a reformatted SD card, however, isn't working. Using the spin2 library jm_ez_spi and flexc, I'm trying to initialize the SD Card with the CMD0 (0x40, 0x00, 0x00, 0x00, 0x00, 0x95). But when using shiftin, I always get #FF as the first 8 bits (supposed to be 00) both when the sd card is inserted and is not.
This is the first step to sending commands (and ultimately reading data) to the SD card and I'm stuck. I'm new to working with SPI without using an external library to assist.
I'm using the P2 Eval Board REV B.
Any tips or help is appreciated!
Comments
There's a P1 PropBasic code library for raw level SD read/write logging without all the FAT overhead.
Maybe that will give some ideas.
https://forums.parallax.com/discussion/122615/propbasic-sd-card/p1
There is a Cluso's SD driver which has procedures for initialize the card, read and write sector, but then, we have a good and fast SD code in FlexProp so there is no need to write your own or use external libraries. You have only to find and use low level initialize/read/write
This is the starting point:
flexprop5.9.10\flexprop\include\filesys\fatfs\sdmm.cc
Thank you guys for your help.
I've downloaded the P1 PropBasic code in case I need to use it.
I tried to find the low level functions for initialize/read/write in FlexProp yesterday without any luck. Thank you for that; a huge help!
The current flexprop code now uses smartpin code and is hard to understand.
Here is my original code that just uses bit bashing to read and write the data from the SD card. Way easier to understand.
Mike
Mike,
Eric still has your code in the master branch. Just comment out the
#define _smartpins_mode_eh
@evanh ,
Eric never used my code. That's all his original code.
Mike
Ah, okay.