2020-10-08 03:35 AM
Hi All,
I am using STM32H7 to write the SD card. The SD card is 16GB. But when I call HAL_SD_WriteBlocks, I found it only accept under 4GB(uint32_t) address.
Here is header declaration.
HAL_StatusTypeDef HAL_SD_ReadBlocks (SD_HandleTypeDef *hsd, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks, uint32_t Timeout);
Does anyone have ideal for that?
Solved! Go to Solution.
2020-10-08 04:04 AM
It is a block address spanning 2TB, not a byte offset. The SDHC cards use logical block addressing.
2020-10-08 04:04 AM
It is a block address spanning 2TB, not a byte offset. The SDHC cards use logical block addressing.
2020-10-08 04:24 AM
Hi clive,
Does mean I need to leverage by block?
for example:
//assume 1 block = 512 byte
HAL_SD_WriteBlocks(&hsd2, aTxBuffer, 0, 1,2000);
// = write aTxBuffer into number block 0 (address 0x00000000) by 1 block
HAL_SD_WriteBlocks(&hsd2, aTxBuffer, 1, 1,2000);
// = write aTxBuffer into number block 1 (address 0x00000200) by 1 block
HAL_SD_WriteBlocks(&hsd2, aTxBuffer, 2, 2,2000);
// = write aTxBuffer into number block 2 (address 0x00000400) by 2 block, fill data to address 0x0000400~0x000007FF(2 blocks)
Am I correct for that explanation?
2020-10-08 04:28 AM
Yes