Page 2 of 4
Re: STM32L4R5ZI-NUCLEO144 and SDC Driver: hal_sdc.h:136:10: fatal error: hal_sdc_lld.h: No such file or directory
Posted: Thu Aug 08, 2019 10:31 am
by sntnjrg
Hi Giovanni,
I have made the following changes:
The
rccEnableSDMMC1 and
rccDisableSDMMC1 macros use the
RCC_APB2ENR_SDMMC1EN macro. The
SDMMC1EN bit is in
RCC_AHB2ENR register. I changed
RCC_APB2ENR_SDMMC1EN macro
by RCC_AHB2ENR_SDMMC1EN.
The
SDMMC_DCTRL_DMAEN macro was changed by
SDMMC_IDMACTRLR_IDMAEN macro
When executing the program, the
sdcConnect() function is locked in this loop:
Code: Select all
void sdc_lld_send_cmd_none(SDCDriver *sdcp, uint8_t cmd, uint32_t arg) {
sdcp->sdmmc->ARG = arg;
sdcp->sdmmc->CMD = (uint32_t)cmd | SDMMC_CMD_CPSMEN;
while ((sdcp->sdmmc->STA & SDMMC_STA_CMDSENT) == 0)
;
sdcp->sdmmc->ICR = SDMMC_ICR_CMDSENTC;
}
I don't know how to solve the problem. Does the ChibiOS development team plan to update this driver shortly?
Cheers.
Re: STM32L4R5ZI-NUCLEO144 and SDC Driver: hal_sdc.h:136:10: fatal error: hal_sdc_lld.h: No such file or directory
Posted: Thu Aug 08, 2019 10:37 am
by Giovanni
Have you programmed GPIOs correctly for SDMMC use in your board files?
Code: Select all
Does the ChibiOS development team plan to update this driver shortly?
Not shortly.
Giovanni
Re: STM32L4R5ZI-NUCLEO144 and SDC Driver: hal_sdc.h:136:10: fatal error: hal_sdc_lld.h: No such file or directory
Posted: Thu Feb 06, 2020 7:54 pm
by sntnjrg
Hi,
According to the manual, I have configured the ports as follows:
Code: Select all
palSetPadMode(GPIOC, 8, PAL_MODE_ALTERNATE(12)|PAL_STM32_OSPEED_HIGH);
palSetPadMode(GPIOC, 9, PAL_MODE_ALTERNATE(12)|PAL_STM32_OSPEED_HIGH);
palSetPadMode(GPIOC, 10, PAL_MODE_ALTERNATE(12)|PAL_STM32_OSPEED_HIGH);
palSetPadMode(GPIOC, 11, PAL_MODE_ALTERNATE(12)|PAL_STM32_OSPEED_HIGH);
palSetPadMode(GPIOC, 12, PAL_MODE_ALTERNATE(12)|PAL_STM32_OSPEED_HIGH);
palSetPadMode(GPIOD, 2, PAL_MODE_ALTERNATE(12)|PAL_STM32_OSPEED_HIGH);
When you try to connect you are blocked indefinitely in the
sdc_lld_send_cmd_none() function.
I have noticed that in the master branch (in the GitHub repository) there is a new version of the driver. Is it compatible with the
STM32L4R5ZI-NUCLEO144 card? Could it be used?
Cheers.
Re: STM32L4R5ZI-NUCLEO144 and SDC Driver: hal_sdc.h:136:10: fatal error: hal_sdc_lld.h: No such file or directory
Posted: Thu Feb 06, 2020 8:57 pm
by Giovanni
Hi,
There is an updated driver on trunk, I tested it on a STM32L4R9AI-Discovery, the demo is STM32-SDMMC-FATFS.
Giovanni
Re: STM32L4R5ZI-NUCLEO144 and SDC Driver: hal_sdc.h:136:10: fatal error: hal_sdc_lld.h: No such file or directory
Posted: Tue Feb 11, 2020 2:40 pm
by sntnjrg
Hi Giovanni,
I cloned the master branch from GitHub.
From the RT-STM32L4R5ZI-NUCLEO144 project, I've created a new project. Then, I copied the code of
STM32-SDMMC-FATFS in the new project. When I run, I obtain the following panic message:
SV#10The stak is:
Code: Select all
Thread #1 (Suspended : Signal : SIGINT:Interrupt)
chSysHalt() at chsys.c:205 0x800a346
chDbgCheckClassI() at chdebug.c:236 0x800a346
chSchReadyI() at chschd.c:221 0x800a5d6
chThdResumeI() at chthreads.c:798 0x800a988
osalThreadResumeI() at hal_sdc_lld.c:864 0x800e0a4
sdc_lld_serve_interrupt() at hal_sdc_lld.c:870 0x800e0a4
Vector104() at stm32_sdmmc1.inc:98 0x800e0a4
<signal handler called>() at 0xfffffffd
0x55555554
The code is:
Code: Select all
/**
* @brief Shared service routine.
*
* @param[in] sdcp pointer to the @p SDCDriver object
*/
void sdc_lld_serve_interrupt(SDCDriver *sdcp) {
/* Disables the source but the status flags are not reset because the
read/write functions needs to check them.*/
sdcp->sdmmc->MASK = 0;
osalThreadResumeI(&sdcp->thread, MSG_OK);
}
Code: Select all
/*===========================================================================*/
/* Driver interrupt handlers. */
/*===========================================================================*/
#if STM32_SDMMC1_IS_USED|| defined(__DOXYGEN__)
/**
* @brief SDMMC1 interrupt handler.
*
* @isr
*/
OSAL_IRQ_HANDLER(STM32_SDMMC1_HANDLER) {
OSAL_IRQ_PROLOGUE();
#if HAL_USE_SDC
#if STM32_SDC_USE_SDMMC1
sdc_lld_serve_interrupt(&SDCD1);
#endif
#endif
OSAL_IRQ_EPILOGUE();
}
#endif
Cheers.
Re: STM32L4R5ZI-NUCLEO144 and SDC Driver: hal_sdc.h:136:10: fatal error: hal_sdc_lld.h: No such file or directory
Posted: Tue Feb 11, 2020 2:56 pm
by sntnjrg
I have made the following modification and it works for me:
Code: Select all
/**
* @brief Shared service routine.
*
* @param[in] sdcp pointer to the @p SDCDriver object
*/
void sdc_lld_serve_interrupt(SDCDriver *sdcp) {
/* Disables the source but the status flags are not reset because the
read/write functions needs to check them.*/
sdcp->sdmmc->MASK = 0;
osalSysLockFromISR();
osalThreadResumeI(&sdcp->thread, MSG_OK);
osalSysUnlockFromISR();
}
Can the
SDMMCv2 driver be isolated and used in the stable version of chibios?
Re: STM32L4R5ZI-NUCLEO144 and SDC Driver: hal_sdc.h:136:10: fatal error: hal_sdc_lld.h: No such file or directory
Posted: Tue Feb 11, 2020 3:25 pm
by Giovanni
Hi,
Moving in bug reports.
Yes, you can back-port the driver if you need it, HAL is 100% open and free source.
Giovanni
Re: STM32L4R5ZI-NUCLEO144 and SDC Driver: hal_sdc.h:136:10: fatal error: hal_sdc_lld.h: No such file or directory
Posted: Mon Feb 17, 2020 12:08 pm
by sntnjrg
Hi Giovanni,
I have added the
sdiotest part of an example to my project. I have checked that the reading operations are working. However, the same does not apply to write operations.
In the code, when it is executed the following, the thread falls asleep waiting for the writing operation (
f_write() function) to be completed.
Code: Select all
chprintf(chp, "Write some data in it (wait ~1min)... ");
chThdSleepMilliseconds(100);
//timemeasurement
uint32_t cnt = chVTGetSystemTime();
for (uint32_t i = 0; i < 10000; i++) {
err = f_write(&FileObject, teststring, sizeof(teststring),
(void*)&bytes_written);
if (err != FR_OK) {
kernel_panic(chp, fresult_to_str(err));
}
}
In the
sdc_lld_wait_transaction_end() function, the
sdcp->sdmmc->MASK field is not equal to 0 and the thread is sent to sleep.
Code: Select all
**
* @brief Wait end of data transaction and performs finalizations.
*
* @param[in] sdcp pointer to the @p SDCDriver object
* @param[in] n number of blocks in transaction
* @param[in] resp pointer to the response buffer
*
* @return The operation status.
* @retval HAL_SUCCESS operation succeeded.
* @retval HAL_FAILED operation failed.
*/
static bool sdc_lld_wait_transaction_end(SDCDriver *sdcp, uint32_t n,
uint32_t *resp) {
/* Note the mask is checked before going to sleep because the interrupt
may have occurred before reaching the critical zone.*/
osalSysLock();
if (sdcp->sdmmc->MASK != 0)
osalThreadSuspendS(&sdcp->thread);
/* Stopping operations.*/
sdcp->sdmmc->IDMACTRL = 0;
sdcp->sdmmc->MASK = 0;
sdcp->sdmmc->DCTRL = 0;
if ((sdcp->sdmmc->STA & SDMMC_STA_DATAEND) == 0) {
osalSysUnlock();
return HAL_FAILED;
}
/* Clearing status.*/
sdcp->sdmmc->ICR = SDMMC_ICR_ALL_FLAGS;
osalSysUnlock();
/* Finalize transaction.*/
if (n > 1)
return sdc_lld_send_cmd_short_crc(sdcp, MMCSD_CMD_STOP_TRANSMISSION, 0, resp);
return HAL_SUCCESS;
}
The trace:
Code: Select all
TEST-SDMMC-FATFS-RT-STM32L4R5ZI-NUCLEO144 (OpenOCD, Flash and Run) [GDB Hardware Debugging]
ch.elf
Thread #1 (Suspended : Step)
sdc_lld_wait_transaction_end() at hal_sdc_lld.c:234 0x8002e1a
sdc_lld_write_aligned() at hal_sdc_lld.c:761 0x80034c6
sdc_lld_write() at hal_sdc_lld.c:838 0x80035f0
sdcWrite() at hal_sdc.c:857 0x8001fa4
disk_write() at fatfs_diskio.c:188 0x800a790
sync_window() at ff.c:1.050 0x800aad8
move_window() at ff.c:1.074 0x800ab4e
get_fat() at ff.c:1.181 0x800add4
create_chain() at ff.c:1.581 0x800b1c4
f_write() at ff.c:3.867 0x800c8d4
<...more frames...>
arm-none-eabi-gdb (8.3.0.20190703)
The thread doesn't work again. I couldn't find the problem. I'm attaching the test project.
Cheers.
Re: STM32L4R5ZI-NUCLEO144 and SDC Driver: hal_sdc.h:136:10: fatal error: hal_sdc_lld.h: No such file or directory
Posted: Wed Apr 29, 2020 9:47 am
by Giovanni
Bump.
Is this problem still there in latest trunk version?
Giovanni
Re: STM32L4R5ZI-NUCLEO144 and SDC Driver: hal_sdc.h:136:10: fatal error: hal_sdc_lld.h: No such file or directory
Posted: Mon May 04, 2020 12:37 pm
by sntnjrg
Hi,
I clone the repository from:
https://github.com/ChibiOS/ChibiOS.git and I'm on
master branch but the file system isn't mounted. The error is:
A hard error occurred in the low level disk I/O layer
The
sdcConnect() function is run but not
f_mount().
I used the
ffconf_template.h template to create the configuration file. Can the error be related to this configuration file?
Cheers.