Stm32f4xx_hal sdio: I am not getting the data I expect

I use this example programme:

I am reading the data from a 2 GB SdCard formatted with FAT 16. As a result I see the following:


Waiting for card...
Card detected: nbr of blocks: 1955840

Block 0
fa b8 00 10 8e d0 bc 00 b0 b8 00 00 8e d8 8e c0 ................
fb be 00 7c bf 00 06 b9 00 02 f3 a4 ea 21 06 00 ...|.........!..
00 be be 07 38 04 75 0b 83 c6 10 81 fe fe 07 75 ....8.u........u
f3 eb 16 b4 02 b0 01 bb 00 7c b2 80 8a 74 01 8b .........|...t...
4c 02 cd 13 ea 00 7c 00 00 eb fe 00 00 00 00 00 L.....|.........
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

Neither the number of blocks nor the content of block 0 is plausible. When I read the same card under Linux with dd I get the following content and the correct number of bytes, which corresponds to 3901440 512 byte blocks.

Any idea on this. Have I misunderstood something, or is there actually an error here. I am grateful for any information.

I reproduced the same behaviour on a STM32F407 and a STM32F412 (STM discovery) board.

See also SDIO: I am not getting the data I expect · Issue #689 · stm32-rs/stm32f4xx-hal · GitHub

I did not read the FAT file system, but the partition table. The driver works correctly. Sorry for the noise

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.