Skip to main content
matas
Associate III
August 5, 2015
Question

STM32F401RB SDIO

  • August 5, 2015
  • 13 replies
  • 1686 views
Posted on August 05, 2015 at 20:37

Hi all, there is something wrong with my project's microSD card part. I have done it on the  STM32F407 discovery board and it worked perfectly the data was succesfuly written to the microSD card. But for the end product I made board (whom all traces are correct, checked it many times) with STM32F401RBT6 and now the microSD card always not responds, I get error:''SD_CMD_RSP_TIMEOUT'' and later turn into FR_INVALID_OBJECT. I have changed the from startup_STM32F4xx.s to startup_STM32F40xx.s. And I am using STM324xg_eval.c and stm324xg_eval_sdio_sd.c as drivers. Also changed the clockfrom 168MHz to 84Mhz. The divider valus are:

*pll_n 336

*pll_m 8 (onboard external 8Mhz quartz)

*pll_q 7

*pll_p 4

APB1 Prescaler 2

APB2 Prescaler 1

 If you have any suggestions, ideas or questions you are very welcome to post. 

#stm32f401
This topic has been closed for replies.

13 replies

matas
matasAuthor
Associate III
August 12, 2015
Posted on August 12, 2015 at 11:18

I've just traced my mistake to the system clock, which by my surprise was running not on HSE, but HSI and PLLON was not set to 1, thus PLL wasn't even on :) Don't know why is it not taking the HSE value? :) Because the code first checks the HSE and only then takes HSI if HSE is not possible :)

Foo Bar
matas
matasAuthor
Associate III
August 12, 2015
Posted on August 12, 2015 at 17:16

Well. I got stuck :D when I was searching why the STM is not taking the HSE value, I though maybe the caps were wrong, so I switch the 22pF -> 10pF, before that I tried to switch up the startup files. And now I can flash the program into the STM, but when the debbuger starts it puts the cursor into a random place inside memory for exmpl (0xffff8000) and will not move further, if by accident it ends up on a memory where the program is loaded, then it moves a few steps and jumps again :) Any ideas why is it happening? :) I tried to move the caps back, but that did not help :)

Foo Bar
matas
matasAuthor
Associate III
August 13, 2015
Posted on August 13, 2015 at 08:12

I am not sure why, but it seems that the system_stm32f401xx.c was the problem, I switch it with the original from STM32F4 Disco and it started to work again. After this, the clock problem fixed it self and the SDIO started to work, although, I still can't set it to be 84MHz, the main thing got fixed :)

Foo Bar