2016-06-22 12:28 AM
Hi,
I got to know that new FW package has been released recently for STM32L4 MCUs. So I am migrating our current Firmware based on FW v1.3.0 to the same.
For that, I copied files from ''<FW Install Dir>\CMSIS'', ''<FW Install Dir>\STM32L4xx_HAL_Driver'' and ''<FW Install Dir>\Middlewares\Third_Party'' to respective directories in our custom firmware. After this change, I got few compilation errors related to UART, Watchdog etc. I resolved those errors and able to compile the the firmware successfully. But with this SD card is not working.
SD card write fails continuously. The function call f_open()/f_write() fails with error code 0x01(FR_DISK_ERR). When I debug it further I found, the SD card fails with ''SD_DATA_CRC_FAIL'' error.The same code is working fine with FW v1.3.0.Please help me to resolve this.Thanks,Dhaval #hal #microsd #fatfs #stm32l42016-06-22 01:35 AM
Hi dhavalv,
I think it's related toCMSIS bug found in many STM32L4 header files which define wrong values of SDMMC registers:#define SDMMC_DCTRL_DBLOCKSIZE_2 (0x3U << SDMMC_DCTRL_DBLOCKSIZE_Pos) /*!< 0x00000040 */
#define SDMMC_DCTRL_DBLOCKSIZE_3 (0x4U << SDMMC_DCTRL_DBLOCKSIZE_Pos) /*!< 0x00000080 */ These lines should be defined as follow: #define SDMMC_DCTRL_DBLOCKSIZE_2 (0x4U << SDMMC_DCTRL_DBLOCKSIZE_Pos) /*!< 0x00000040 */ #define SDMMC_DCTRL_DBLOCKSIZE_3 (0x8U << SDMMC_DCTRL_DBLOCKSIZE_Pos) /*!< 0x00000080 */ You can refer to these threads with same issue: [DEAD LINK /public/STe2ecommunities/mcu/Lists/STM32Java/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32Java/%5bBUG%20Report%20STM32Cube_FW_L4_V1.5.0%5d%20Wrong%20Values%20of%20SDMMC%20registers&FolderCTID=0x01200200770978C69A1141439FE559EB459D758000F9A0E3A95BA69146A17C2E80209ADC21¤tviews=2]thread1, Regards2016-06-22 02:36 AM
Hi,
Thanks for your quick reply. It works, issue is resolved.Regards,Dhaval