My task is to port a NXP SPI driver delivered with Keil RL-ARM to my Kinetis K60 system. Finlay I want to talk to SD cards in SPI mode. I do this step by step. My next task is the UnInit routine.
This is the original NXP UnInit:
/* Return SSP interface to default state. */
static BOOL UnInit (void) {
IODIR0 &= ~(1<<20);
PINSEL1 &= ~0x000003FC;
SSPCR1 = 0x0000;
SSPCR0 = 0x0000;
SSPCPSR = 0x00;
return (__TRUE);
}
This my first trial for the Kinetis UnInit:
/*--------------------------- UnInit ----------------------------------------*/
static BOOL UnInit (void) {
/* Return SSP interface to default state. */
PORTD->PCR[11] = PORT_PCR_MUX(1); /* Alt 1 for GPIO*/
PORTD->PCR[12] = PORT_PCR_MUX(1); /* Alt 1 for GPIO*/
PORTD->PCR[13] = PORT_PCR_MUX(1); /* Alt 1 for GPIO*/
PORTD->PCR[14] = PORT_PCR_MUX(1); /* Alt 1 for GPIO*/
SIM->SCGC3 &= ~SIM_SCGC3_SPI2_MASK; /* Disable SPI2 gate clocking */
SIM->SCGC5 &= ~SIM_SCGC5_PORTD_MASK; /* Disable PORTD gate clocking */
return (__TRUE);
}
Do you think this is applicable for SD card access via SPI?
I will discuss the other routines in other threads because of a better overview. I will post the final driver, because Keil provides only samples for SDHC mode for memory cards for the Kinetis system.
Thank you