cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to read sectors from sd card on STM32U575ZI

kk9
Associate II

Hello I'm trying read sector numer 0 from SD card. I use 4-bit mode for sd card reading. My MCU is on Nucleo development board. Card is correctly initialized but when I'm trying read sector I get zeros in buffer and maybe 10 random not-zero bytes. What do I incorrect?
After restart I get the same values when I use the same sd-card. But when I use other card - I get other incorrect data.

kk9_0-1769895357448.pngkk9_1-1769895396173.png

kk9_2-1769895422404.png

kk9_3-1769895546345.png

 

 

2 REPLIES 2
TDK
Super User

0 is a valid value to be in memory. Do you think it should be something else? Why?

A better test would be to erase the block, write to it, then read it out and verify content.

initialize the buffer to something to ensure new data is actually populated.

If you feel a post has answered your question, please click "Accept as Solution".
kk9
Associate II

Because this card is formatted in FAT32 and I'm trying read sector number 0 (boot sector) :)
Here is content of sector 0, what I read on my computer
SD.JPG

I know, that last bytes on sd card are not like in original fat32 boot sector because I'm editing this bytes for test but values in buffer was not changed.