I'm learning how to use the SDC driver. I have a STM32L4R5ZI-NUCLEO144 board and I created a project from the RT-STM32L4R5ZI-NUCLEO144 project. Then, I took the following steps:
- 1. Put TRUE the HAL_USE_SDC macro (halconf.h).
- 2. Study the code from the main.c file of the STM32F4xx/SDC test (supplied by ChibiOS).
Based on this, I wrote the following code in the main() function:
Code: Select all
static uint8_t sd_scratchpad[512]; /* Working area for driver */
static sdcbusmode_t bus_width = SDC_MODE_4BIT; /* Bus width */
static const SDCConfig sdccfg = { /* SDIO configuration. */
sd_scratchpad,
bus_width
};
sdcObjectInit(&SDCD1);
sdcStart(&SDCD1, &sdccfg); /* Initializes the SDIO drivers. */
But, when compiling, the following error occurs:
Code: Select all
In file included from ../../chibios191/os/hal/include/hal.h:147:0,
from ../../chibios191/os/hal/src/hal_st.c:25:
../../chibios191/os/hal/include/hal_sdc.h:136:10: fatal error: hal_sdc_lld.h: No such file or directory
#include "hal_sdc_lld.h"
^~~~~~~~~~~~~~~
compilation terminated.
In file included from ../../chibios191/os/hal/include/hal.h:147:0,
from ../../chibios191/os/hal/src/hal.c:25:
../../chibios191/os/hal/include/hal_sdc.h:136:10: fatal error: hal_sdc_lld.h: No such file or directory
#include "hal_sdc_lld.h"
^~~~~~~~~~~~~~~
compilation terminated.
make: *** [../../chibios191/os/common/startup/ARMCMx/compilers/GCC/mk/rules.mk:178: build/obj/hal.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [../../chibios191/os/common/startup/ARMCMx/compilers/GCC/mk/rules.mk:178: build/obj/hal_st.o] Error 1
In file included from ../../chibios191/os/hal/include/hal.h:147:0,
from ../../chibios191/os/hal/src/hal_buffers.c:41:
../../chibios191/os/hal/include/hal_sdc.h:136:10: fatal error: hal_sdc_lld.h: No such file or directory
#include "hal_sdc_lld.h"
^~~~~~~~~~~~~~~
compilation terminated.
make: *** [../../chibios191/os/common/startup/ARMCMx/compilers/GCC/mk/rules.mk:178: build/obj/hal_buffers.o] Error 1
In file included from ../../chibios191/os/hal/include/hal.h:147:0,
from ../../chibios191/os/hal/src/hal_queues.c:40:
../../chibios191/os/hal/include/hal_sdc.h:136:10: fatal error: hal_sdc_lld.h: No such file or directory
#include "hal_sdc_lld.h"
^~~~~~~~~~~~~~~
compilation terminated.
I have observed that in the STM32F4xx/SDC test, in the file "mcuconf.h ", there is a section for the SDC driver that does not exist in the RT-STM32L4R5ZI-NUCLEO144 project. This is the section that appears in the STM32F4xx/SDC test:
Code: Select all
/*
* SDC driver system settings.
*/
#define STM32_SDC_SDIO_DMA_PRIORITY 3
#define STM32_SDC_SDIO_IRQ_PRIORITY 9
#define STM32_SDC_WRITE_TIMEOUT_MS 1000
#define STM32_SDC_READ_TIMEOUT_MS 1000
#define STM32_SDC_CLOCK_ACTIVATION_DELAY 10
#define STM32_SDC_SDIO_UNALIGNED_SUPPORT TRUE
#define STM32_SDC_SDIO_DMA_STREAM STM32_DMA_STREAM_ID(2, 3)
When I read the STM32L4R5ZI-NUCLEO144 card documentation, I have noticed that it has a SD/SDIO/MMC interface and I can use the MMC over SPI driver without problems.
What am I doing wrong? How can I solve this problem?
Thank you.