cancel
Showing results for 
Search instead for 
Did you mean: 

HAL SDIO Sector computation error

raaa
Associate
Posted on April 25, 2016 at 12:43

Hallo,

I noticed a BUG in

sd_diskio.c

in version 1.3.0 included in STM32CubeF4 v. 1.11.0 resulting in reading/writing from wrong sectors on big capacity SD cards.

In functions

SD_read

and

SD_write

sector computation is casted to

uint64_t

too late resulting in clipping of most significant bits:

Is:

if(BSP_SD_ReadBlocks((uint32_t*)buff,

                     (uint64_t)(sector * BLOCK_SIZE),

                     BLOCK_SIZE, count) != MSD_OK)

Fix:

if(BSP_SD_ReadBlocks((uint32_t*)buff,

                     (uint64_t) (sector) * BLOCK_SIZE,

                     BLOCK_SIZE, count) != MSD_OK)

Regards,

Ra
1 REPLY 1
Nesrine M_O
Lead II
Posted on April 25, 2016 at 12:58

Hi Ra,

Thanks for highlighting this issue.It is a known issue,but the fix has not yet been released on the web. 

-Syrine-