Hello,
I'm working with kinetis k60 and I'm develomping an application that uses an sd card by spi. I check the sd card presence, but I'd like evalute if sd card is working correctly or Not. I want to do this because sometimes when I turn on the device, the sd card is locked and it is impossibile to comunicate with it unti I cut its power supply. Does someone help me?
Many thanks in advance for your support.
Best regards,
Stefano
Hi,
K60 product provides ESDHC interface could using to connect with SDCARD, while customer also could using SPI to connect SDCARD.
We have SPI SDCARD example demo based on MQX RTOS, which could be downloaded from here (the latest version is V4.2).
Customer could find TWR-K21D50M board sdcard demo is using SPI mode, the related software could be found at below folder:
C:\Freescale\Freescale_MQX_4_2\mfs\examples\sdcard\build\iar\mfs_sdcard_twrk21d50m
In the <twrk21d50m.h> file of BSP project, which using SPI1 as SDCARD interface:
/*-----------------------------------------------------------------------------
** SDCARD
*/
#define BSP_SDCARD_SPI_CHANNEL "spi1:"
#define BSP_SDCARD_GPIO_DETECT (GPIO_PORT_C | GPIO_PIN5)
#define BSP_SDCARD_GPIO_PROTECT (GPIO_PORT_A | GPIO_PIN17)
#define BSP_SDCARD_DETECT_MUX_GPIO (LWGPIO_MUX_C5_GPIO)
#define BSP_SDCARD_PROTECT_MUX_GPIO (LWGPIO_MUX_A17_GPIO)
#define BSP_SDCARD_SPI_CS (1)
Customer can refer this demo software.
The TWR-K21D50M board related resource could be found at here.
Have a great day,
Ma Hui
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------