Author Topic: SD card reading ?  (Read 1250 times)

0 Members and 1 Guest are viewing this topic.

Offline Jan AudioTopic starter

  • Frequent Contributor
  • **
  • Posts: 820
  • Country: nl
SD card reading ?
« on: August 27, 2019, 02:35:18 pm »
Hi, i have this ILI9341 display, it also has SD card.
Does it have a controller ?, so i can download the manual,
Or has the SD card a standard protocol without some controller ?

How does it work ?
thanks
 

Offline MarkF

  • Super Contributor
  • ***
  • Posts: 2553
  • Country: us
Re: SD card reading ?
« Reply #1 on: August 27, 2019, 06:46:31 pm »
If you have the Adafruit breakout board, the SD card has a SPI interface with it's own Chip Select pin. 
The SPI data and clock lines go to both the ILI9341 controller and the SD Card. 
Separate Chip Select pins determine which device you are talking to.

I have one of their OLED Displays that works the same way.  However, I have not tried reading from the SD Card.

I believe they have sample code to read from the SD Card for one of their breakout boards but couldn't be bothered to search for it. ;)

 

Offline Fire Doger

  • Regular Contributor
  • *
  • Posts: 208
  • Country: 00
  • Stefanos
Re: SD card reading ?
« Reply #2 on: August 27, 2019, 07:56:35 pm »
Every SD Card has it's own controller embedded. They are not the same but they have to follow  standard in comunication.
You can interface it in 2 ways, 1 is SPI and the other is native SD. Arduino boards most of the time breakout only SPI pins.
ILI9341 is an LCD controller, it has nothing to do with SD. They usually put an SD in same board because most of the time you need to store some graphics (images) to display in TFT.

To be able to read content from SD in PC from file explorer you have to use a filesystem library in your MCU.
It's practical impossible to write your own library since you don't know anything about how SD or filesystems works. Search for a good library for your platform and use it.

https://openlabpro.com/guide/interfacing-microcontrollers-with-sd-card/
 

Offline amyk

  • Super Contributor
  • ***
  • Posts: 8288
Re: SD card reading ?
« Reply #3 on: August 28, 2019, 12:15:17 am »
SD is a serial protocol (although there is a mode where you can use it as a 4-bit parallel bus for faster transfers). Anything that can do I/O with the right voltage levels can interface with one.

Most of the spec has been "declassified", so you can easily find and read it. I recommend doing that.
« Last Edit: August 28, 2019, 12:16:48 am by amyk »
 

Offline GromBeestje

  • Frequent Contributor
  • **
  • Posts: 280
  • Country: nl
Re: SD card reading ?
« Reply #4 on: August 28, 2019, 10:50:35 am »
As far as I know, talking to an SD card using the SPI protocol is free, the native protocol requires a license.
 

Offline Jan AudioTopic starter

  • Frequent Contributor
  • **
  • Posts: 820
  • Country: nl
Re: SD card reading ?
« Reply #5 on: August 28, 2019, 11:00:01 am »
Thanks all, i,m busy with it.

Every SD Card has it's own controller embedded. They are not the same but they have to follow  standard in comunication.

Does china also ?

To be able to read content from SD in PC from file explorer you have to use a filesystem library in your MCU.
It's practical impossible to write your own library since you don't know anything about how SD or filesystems works. Search for a good library for your platform and use it.

https://openlabpro.com/guide/interfacing-microcontrollers-with-sd-card/

I like doing so eventually, it works for DOS and windows.
I get info out of those librarys when i,m stuck.

Thanks for the link, i have some problems :

I downloaded that site yesterday, i followed the instructions, it all works to the point i have to send command 1 ( initiate initialize ).
I send command one with 4 zero bytes following, and a CRC of 0xFF, only i get no response of zero, even after waiting 1000ms before getting the response.
maybe i filled the wrong arguments ?, this site says : arguments 2, what is arguments 2 ?
What to fill instead of those zeros as agruments ?

One more thing : i have a HC card, while i still get the 1 response, not the 5 response from command 8.
« Last Edit: August 28, 2019, 11:04:15 am by Jan Audio »
 

Offline amyk

  • Super Contributor
  • ***
  • Posts: 8288
Re: SD card reading ?
« Reply #6 on: August 28, 2019, 11:37:12 am »
As far as I know, talking to an SD card using the SPI protocol is free, the native protocol requires a license.
Technically speaking, yes. But if you're not making a commercial product (and even then, if you're in China...), no one cares.
 

Offline Jan AudioTopic starter

  • Frequent Contributor
  • **
  • Posts: 820
  • Country: nl
Re: SD card reading ?
« Reply #7 on: August 28, 2019, 11:44:32 am »
I,m only intrested in the SPI protocol.
 

Offline Jan AudioTopic starter

  • Frequent Contributor
  • **
  • Posts: 820
  • Country: nl
Re: SD card reading ?
« Reply #8 on: August 28, 2019, 02:37:04 pm »
I also have another problem : if i connect the scope to the CLK, it all works.
Once the scope is not connected to CLK, it wont work, weird.
 

Offline Jan AudioTopic starter

  • Frequent Contributor
  • **
  • Posts: 820
  • Country: nl
Re: SD card reading ?
« Reply #9 on: August 29, 2019, 01:21:33 pm »
I got it all working.
The sample at end fixes for without scope connected.

The problematic commands you have to repeat until right response.

Time to take a look at the FAT32.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf