stm32duino / STM32SD

Enables reading and writing on SD card using SD card slot of the STM32 Board.
157 stars 23 forks source link

STM32F767ZI Compiling Error #63

Closed RGarrett93 closed 1 year ago

RGarrett93 commented 1 year ago

Hi, I'm currently attempting to get this library to work with STM32F767ZI and SDIO.

The library doesn't compile due to undefined BSP_SD_CardInfo of FatFs sd_diskio.c, if I relabel BSP_SD_CardInfo to SD_CardInfo as if the build definition is STM32L1xx then it compiles.

Using the example 'CardInfo', the SD Card is recognised and shows volume size but the code hangs when it gets to opening the root of the SD card File root = SD.openRoot();.

Initializing SD card...A card is present.

Card type: SD1
start sdFatFs

Volume type is FAT32

Volume size (bytes): 31897157632
Volume size (Kbytes): 31149568
Volume size (Mbytes): 30419

Files found on the card (name, date and size in bytes):

Can you please advice on how to get this library to work with F767ZI without modifying BSP_SD_CardInfo in FatFs (is it missing a definition in bsp_sd.h) and additionally why when it comes to the SD Card Wrapper (STM32SD.h) it is hanging?

Below is the compiling error:

Click me ### Compiling Error ```Processing nucleo_f767zi (platform: ststm32; board: nucleo_f767zi; framework: arduino) ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Verbose mode can be enabled via `-v, --verbose` option CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/nucleo_f767zi.html PLATFORM: ST STM32 (15.4.1) > ST Nucleo F767ZI HARDWARE: STM32F767ZIT6 216MHz, 512KB RAM, 2MB Flash DEBUG: Current (stlink) On-board (stlink) External (blackmagic, cmsis-dap, jlink) PACKAGES: - framework-arduinoststm32 @ 4.20200.220530 (2.2.0) - framework-cmsis @ 2.50700.210515 (5.7.0) - toolchain-gccarmnoneeabi @ 1.90201.191206 (9.2.1) LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf LDF Modes: Finder ~ chain, Compatibility ~ soft Found 13 compatible libraries Scanning dependencies... Dependency Graph |-- STM32duino STM32SD @ 1.3.1 Building in release mode Compiling .pio\build\nucleo_f767zi\src\main.cpp.o Compiling .pio\build\nucleo_f767zi\lib21f\FatFs\drivers\sd_diskio.c.o Compiling .pio\build\nucleo_f767zi\lib21f\FatFs\ff_gen_drv.c.o Compiling .pio\build\nucleo_f767zi\lib5c3\STM32duino STM32SD\SD.cpp.o .pio\libdeps\nucleo_f767zi\FatFs\src\drivers\sd_diskio.c: In function 'SD_ioctl': .pio\libdeps\nucleo_f767zi\FatFs\src\drivers\sd_diskio.c:241:3: error: unknown type name 'BSP_SD_CardInfo'; did you mean 'SD_CardInfo'? 241 | BSP_SD_CardInfo CardInfo; | ^~~~~~~~~~~~~~~ | SD_CardInfo .pio\libdeps\nucleo_f767zi\FatFs\src\drivers\sd_diskio.c:256:24: warning: passing argument 1 of 'BSP_SD_GetCardInfo' from incompatible pointer type [-Wincompatible-pointer-types] 256 | BSP_SD_GetCardInfo(&CardInfo); | ^~~~~~~~~ | | | int * In file included from .pio\libdeps\nucleo_f767zi\STM32duino STM32SD\src/ffconf.h:9, from .pio\libdeps\nucleo_f767zi\FatFs\src/ff.h:29, from .pio\libdeps\nucleo_f767zi\FatFs\src/ff_gen_drv.h:58, from .pio\libdeps\nucleo_f767zi\FatFs\src\drivers\sd_diskio.c:49: .pio\libdeps\nucleo_f767zi\STM32duino STM32SD\src/bsp_sd.h:178:52: note: expected 'HAL_SD_CardInfoTypeDef *' {aka 'struct *'} but argument is of type 'int *' 178 | void BSP_SD_GetCardInfo(HAL_SD_CardInfoTypeDef *CardInfo); | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~ .pio\libdeps\nucleo_f767zi\FatFs\src\drivers\sd_diskio.c:258:29: error: request for member 'LogBlockNbr' in something not a structure or union 258 | *(DWORD*)buff = CardInfo.LogBlockNbr; | ^ .pio\libdeps\nucleo_f767zi\FatFs\src\drivers\sd_diskio.c:269:24: warning: passing argument 1 of 'BSP_SD_GetCardInfo' from incompatible pointer type [-Wincompatible-pointer-types] 269 | BSP_SD_GetCardInfo(&CardInfo); | ^~~~~~~~~ | | | int * In file included from .pio\libdeps\nucleo_f767zi\STM32duino STM32SD\src/ffconf.h:9, from .pio\libdeps\nucleo_f767zi\FatFs\src/ff.h:29, from .pio\libdeps\nucleo_f767zi\FatFs\src/ff_gen_drv.h:58, from .pio\libdeps\nucleo_f767zi\FatFs\src\drivers\sd_diskio.c:49: .pio\libdeps\nucleo_f767zi\STM32duino STM32SD\src/bsp_sd.h:178:52: note: expected 'HAL_SD_CardInfoTypeDef *' {aka 'struct *'} but argument is of type 'int *' 178 | void BSP_SD_GetCardInfo(HAL_SD_CardInfoTypeDef *CardInfo); | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~ .pio\libdeps\nucleo_f767zi\FatFs\src\drivers\sd_diskio.c:270:28: error: request for member 'LogBlockSize' in something not a structure or union 270 | *(WORD*)buff = CardInfo.LogBlockSize; | ^ .pio\libdeps\nucleo_f767zi\FatFs\src\drivers\sd_diskio.c:280:24: warning: passing argument 1 of 'BSP_SD_GetCardInfo' from incompatible pointer type [-Wincompatible-pointer-types] 280 | BSP_SD_GetCardInfo(&CardInfo); | ^~~~~~~~~ | | | int * In file included from .pio\libdeps\nucleo_f767zi\STM32duino STM32SD\src/ffconf.h:9, from .pio\libdeps\nucleo_f767zi\FatFs\src/ff.h:29, from .pio\libdeps\nucleo_f767zi\FatFs\src/ff_gen_drv.h:58, from .pio\libdeps\nucleo_f767zi\FatFs\src\drivers\sd_diskio.c:49: .pio\libdeps\nucleo_f767zi\STM32duino STM32SD\src/bsp_sd.h:178:52: note: expected 'HAL_SD_CardInfoTypeDef *' {aka 'struct *'} but argument is of type 'int *' 178 | void BSP_SD_GetCardInfo(HAL_SD_CardInfoTypeDef *CardInfo); | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~ .pio\libdeps\nucleo_f767zi\FatFs\src\drivers\sd_diskio.c:281:29: error: request for member 'LogBlockSize' in something not a structure or union 281 | *(DWORD*)buff = CardInfo.LogBlockSize / SD_DEFAULT_BLOCK_SIZE; | ^ *** [.pio\build\nucleo_f767zi\lib21f\FatFs\drivers\sd_diskio.c.o] Error 1 ========================================================================================== [FAILED] Took 4.26 seconds ========================================================================================== ```

Thank You Ryan

fpistm commented 1 year ago

Hi @RGarrett93

I've tested the SD within Nucleo F767ZI and it build fine.

Using library STM32duino STM32SD at version 1.3.1 in folder: C:\IDE\data\Arduino\libraries\STM32duino_STM32SD 
Using library FatFs at version 2.0.4 in folder: C:\IDE\data\Arduino\libraries\FatFs 
Using library SrcWrapper at version 1.0.1 in folder: C:\Users\<>\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.6.0\libraries\SrcWrapper 
"C:\\Users\\<>\\AppData\\Local\\Arduino15\\packages\\STMicroelectronics\\tools\\xpack-arm-none-eabi-gcc\\12.2.1-1.2/bin/arm-none-eabi-size" -A "C:\\Users\\<>\\AppData\\Local\\Temp\\arduino\\sketches\\021EC03FDC63CCEED2C42C7019B9ACE0/CardInfo.ino.elf"
Sketch uses 34824 bytes (1%) of program storage space. Maximum is 2097152 bytes.
Global variables use 2652 bytes (0%) of dynamic memory, leaving 521636 bytes for local variables. Maximum is 524288 bytes.

Unfortunately, I could not help as you used PIO and we do not support it as it is not up to date and change some way of build and configuration.