I'm trying to find an issue with my SD-card slot.
Actually I trigger a manual disconnect from the sd-card. After some disconnects the driver will hang in a while loop:
hal_sdc.c
Code: Select all
bool sdcDisconnect(SDCDriver *sdcp) {
//...snip...//
/* Waits for eventual pending operations completion.*/
if (_sdc_wait_for_transfer_state(sdcp)) { // <- wait here
sdc_lld_stop_clk(sdcp);
sdcp->state = BLK_ACTIVE;
return HAL_FAILED;
}
hal_sdc.c
Code: Select all
bool _sdc_wait_for_transfer_state(SDCDriver *sdcp) {
uint32_t resp[1];
while (true) {
if (sdc_lld_send_cmd_short_crc(sdcp, MMCSD_CMD_SEND_STATUS, // <- wait here
sdcp->rca, resp) ||
MMCSD_R1_ERROR(resp[0])) {
return HAL_FAILED;
}
os/hal/ports/STM32/LLD/SDIOv1/hal_sdc_lld.c
Code: Select all
bool sdc_lld_send_cmd_short_crc(SDCDriver *sdcp, uint8_t cmd, uint32_t arg,
uint32_t *resp) {
uint32_t sta;
sdcp->sdio->ARG = arg;
sdcp->sdio->CMD = (uint32_t)cmd | SDIO_CMD_WAITRESP_0 | SDIO_CMD_CPSMEN;
while (((sta = sdcp->sdio->STA) & (SDIO_STA_CMDREND | SDIO_STA_CTIMEOUT |
SDIO_STA_CCRCFAIL)) == 0) // <- the STA stay at 0
;
Any idea what happend, or how I could prevent this?