Question
Please fix one-year old bug!!!
Posted on April 19, 2016 at 20:03
Dear ST, please fix already one-year old bug!
It is described here yet: https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Java/Flat.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2FSTM32Java%2FSDIO%20BUG%20Large%20SDHC%20file%20system%20corruption%20%28sd_diskio.c%29&FolderCTID=0x01200200770978C69A1141439FE559EB459D758000F9A0E3A95BA69146A17C2E80209ADC21¤tviews=2, but I'll repeat again, because it leads to very strange behaviour during writing on SD card. Result: you cannot write more then 4 gb during one session using FatFS. linesSD_state = BSP_SD_ReadBlocks_DMA((uint32_t*)scratch, (uint64_t) ((sector + count) * BLOCK_SIZE), BLOCK_SIZE, 1);
SD_state = BSP_SD_ReadBlocks_DMA((uint32_t*)buff, (uint64_t) (sector * BLOCK_SIZE), BLOCK_SIZE, count);
SD_state = BSP_SD_WriteBlocks_DMA((uint32_t*)scratch, (uint64_t)((sector + count) * BLOCK_SIZE), BLOCK_SIZE, 1);
SD_state = BSP_SD_WriteBlocks_DMA((uint32_t*)buff, (uint64_t)(sector * BLOCK_SIZE), BLOCK_SIZE, count);
sd_diskio.c
should be:
SD_state = BSP_SD_ReadBlocks_DMA((uint32_t*)scratch, ((uint64_t)sector + count) * BLOCK_SIZE, BLOCK_SIZE, 1);
SD_state = BSP_SD_ReadBlocks_DMA((uint32_t*)buff, (uint64_t)sector * BLOCK_SIZE, BLOCK_SIZE, count);
SD_state = BSP_SD_WriteBlocks_DMA((uint32_t*)scratch, ((uint64_t)sector + count) * BLOCK_SIZE, BLOCK_SIZE, 1);
SD_state = BSP_SD_WriteBlocks_DMA((uint32_t*)buff, (uint64_t)sector * BLOCK_SIZE, BLOCK_SIZE, count);
#sdio #!bug #cubemx #fatfs