2016-01-21 05:43 AM
CubeMx 4.12.0 Mcu: STM32L476RETx Fimware Package: L4V1.2.0
-Cube is generating code for port H, but there's no port H on the L476RET /*Configure GPIO pins : PH0 PH1 */GPIO_InitStruct.Pin = GPIO_PIN_0 | GPIO_PIN_1;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOH, &GPIO_InitStruct); -In sd_diskio.cconst Diskio_drvTypeDef SD_Driver = Should be without the const
2016-01-21 06:40 AM
Hi Edje,
1-Cube is generating code for port H, but there's no port H on the L476RETPlease refer to the product datasheet, in fact the port H exist (PH0-OSC_IN (PH0) – PH1/OSC_OUT)2-Const Diskio_drvTypeDef SD_Driver = Should be without the constCould you please let us know what kind of problem did you faced with this declaration that leads to this conclusion?-Syrine-2016-01-21 07:46 AM
Hi Syrine,
Thanks for your quick reply. 1. That's really stupid of me, missed those 2 pins. Need some fresh coffee. 2. fmount() will return a FR_INVALIDE_DRIVE, because the path argument is not valid. And that's is because Disknum in FATFS_LinkDriverEx is 0xbd instead of 0x00. In your example c:\Users\e\STM32Cube\Repository\STM32Cube_FW_L4_V1.2.0\Projects\STM32L476G_EVAL\Demonstrations\MB1144\Core\Src\k_sd_diskio.c it was without the const and that made it work for me.2016-01-24 11:56 PM
Hi Edje,
You said that the demonstration project works fine for you, try to add const to the structure declaration and the demo will still work properly (I tested it). So, I don’t think that this declaration is the root cause of your problem.Can you please share your project with us? Forum users may bring you some help.-Syrine-2016-01-27 07:09 AM
Hi Syrine,
Thanks for your reply. I didn't say that the example project was working, I ''said'' that there are differences comparing the code generate by CubeMx and the example project. The difference found made my project work. Attached my test project including the ioc file. ________________ Attachments : SdCardTest.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Htjl&d=%2Fa%2F0X0000000aWL%2F0WK.xKSfmJ_.l5eela3nyPfaN0I6Qur2fMRM04xyHpg&asPdf=false2016-04-05 07:19 AM
In regard to the ''const'' problem mentioned above and using Cube 4.13.0:
Error[Pe1061]: declaration of variable ''SD_Driver'' is incompatible with a declaration in another translation unit C:\Software\In House Projects\Lab Card Reader\Middlewares\Third_Party\FatFs\src\drivers\sd_diskio.h 36
''struct <unnamed> SD_Driver'' (declared at line 36 of ''C:\Software\In House Projects\Lab Card Reader\EWARM/../Middlewares/Third_Party/FatFs/src/drivers\sd_diskio.h'') (from translation unit ''C:\Software\In House Projects\Lab
Card Reader\Src\fatfs.c'')
''struct <unnamed> const SD_Driver'' (declared at line 52 of ''C:\Software\In House Projects\Lab Card Reader\Middlewares\Third_Party\FatFs\src\drivers\sd_diskio.c'') (from translation unit ''C:\Software\In House Projects\Lab Card
Reader\Middlewares\Third_Party\FatFs\src\drivers\sd_diskio.c'')