SD card on K21

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SD card on K21

Jump to solution
959 Views
evgenik
Contributor IV

Hello.

Currently, I am working on TWR-K21 with the Kinetis K21 microcontroller and using sample NXP project sdcard_fatfs through SDIO. When running project I see the following situation:
After turning 'ON' the SD clock in the SDHC_SetClock () function, the pin CLK starts working without stopping.
The first SetIdle () command passes and the next SendInterfaceCondition () command returns an error.
I see that the data goes through the CMD pin, but it does not give anything.

Before that, I did a similar project on TWR-K60 (with different drivers) and everything worked. Therefore, I compared 2 protocols on the scope and saw that the K60 clock works only during data transfer and on K21 clock works all the time.
Maybe this will solve the problem of working with the SD card. 

How to find the reason that CLK is constantly working?

Project is attached.

Thanks.

Evgeni

0 Kudos
1 Solution
716 Views
mjbcswitzerland
Specialist V

Evgeni

Check the SDHC_SYSCTL setting (PEREN bit) which controls whether the clock is automatically gated off or not [it sounds as though the setting is different in the two projects].

Regards

Mark

[uTasker project developer for Kinetis and i.MX RT]

View solution in original post

0 Kudos
2 Replies
717 Views
mjbcswitzerland
Specialist V

Evgeni

Check the SDHC_SYSCTL setting (PEREN bit) which controls whether the clock is automatically gated off or not [it sounds as though the setting is different in the two projects].

Regards

Mark

[uTasker project developer for Kinetis and i.MX RT]

0 Kudos
716 Views
evgenik
Contributor IV

Hi Mark.

I have found this configuration and correct it. Now I can see that CLK works correct but the SD card again doesn't respond. The same situation I have found at spi - SD card initialization problem - CMD8 wrong response but in this example is used SPI protocol and I use SDIO. How after send command can I do spare 8 clocks and do '0' start bit for start SD card response? Or SD card start '0' response by itself? May be anything wrong configuration for allowing reply in K21 registers? In my K60 project, I don't do anything for this.

Thanks.

Evgeni

0 Kudos