cancel
Showing results for 
Search instead for 
Did you mean: 

[Solved] STM32F446 SDIO FindSCR Fifo is zero

STM_DevHF
Associate

I have a strange issue. I used the SDIO Interface on a F2 and a F429 without issues. But on the first usage with the F446 i run into a strange problem.

With the Logic Analyzer i am observing the communication.

Card Init:

Requesting Card Type, CSD and CID works well over the CLK and CMD Line.

While Switching to the 4Bit Mode i'm getting wrong feedback via the Data line. In detail there is a problem with the FindSCR function still in 1Bit Mode. SDMMC_CmdSendSCR is send out correctly. The DPSM is reacting correct to the Data0 lines response. Flags a set correct for 2 32Bit words but SDIO_ReadFIFO() will only give zero as feedback.

Log Sending SCR:

0693W00000UoZrZQAV.png 

Response:

0693W00000UoZrUQAV.png 

static uint32_t SD_FindSCR(SD_HandleTypeDef *hsd, uint32_t *pSCR)

{

....

   if(__HAL_SD_GET_FLAG(hsd, SDIO_FLAG_RXDAVL))

   {

       uint32_t data = SDIO_ReadFIFO(hsd->Instance);

       printf("copy tmp[%u] = %u\n\r", index,data);

       tempscr[index] =data;

       index++;

   }

   else if(!__HAL_SD_GET_FLAG(hsd, SDIO_FLAG_RXACT))

   {

       printf("SD_FindSCR SDIO_FLAG_RXACT %u", HAL_GetTick());

     break;

   }

.....

}

Used is the CubeMx Lib F4 V1.27.0

All Data[0:3] and CMD line have 10k Pullups and a serial resistance of 33Ohm. On the logic analyzer signals a OK to the pins of the MCU. In my opinion is look like some "internal" stuff.

Also what should be the EGDE for SDIO CLockin for Dephasing? RISING or FALLING. I did't get the point what is the advantage inside the MCU. Because transitions according the Physical Layer of the SDIO is not affected.

As anybody some hints? After some days of debugging i'm missing some ideas and what still can be wrong?

1 ACCEPTED SOLUTION

Accepted Solutions
STM_DevHF
Associate

Thank you for your response. I finally got it to work and it was a really stupid error.

I used port C for debugging leds and the SDIO interface.

  1. The LEDs the GPIOs were initialized with __HAL_RCC_GPIOC_CLK_ENABLE(); So port C seems obviously working. The LEDs do an alive blink.
  2. In the init Sequence of the SDIO triggered by a button i made accidentially a __HAL_RCC_GPIOC_CLK_DISABLE();
  3. The Leds went also off. I also ended in a endless loop because of the SDIO init error, which happend in the task with the highed priority and LED task was blocked. But i didn't recognized, that i dad switchted off the port C :(

Finally no issue at all with the lib.

View solution in original post

2 REPLIES 2
AScha.3
Chief III

i had similar problems ... now running fine. just some to try:

i set sdmmc clk to 100MHz. + div 1 :

0693W00000Uoa23QAB.pngand meduim or high speed on gpio: (to reduce reflections)

0693W00000Uoa2DQAR.png 

If you feel a post has answered your question, please click "Accept as Solution".
STM_DevHF
Associate

Thank you for your response. I finally got it to work and it was a really stupid error.

I used port C for debugging leds and the SDIO interface.

  1. The LEDs the GPIOs were initialized with __HAL_RCC_GPIOC_CLK_ENABLE(); So port C seems obviously working. The LEDs do an alive blink.
  2. In the init Sequence of the SDIO triggered by a button i made accidentially a __HAL_RCC_GPIOC_CLK_DISABLE();
  3. The Leds went also off. I also ended in a endless loop because of the SDIO init error, which happend in the task with the highed priority and LED task was blocked. But i didn't recognized, that i dad switchted off the port C :(

Finally no issue at all with the lib.