SPI Problem,
2005-10-24 by yodathgreat
Hi All,
Who can send me some exemples for make the Init on SPI of the
LPC2214.
SPI Master Mode.. (for SD Card).
Best regards
Yodathegreat
I use a example of http://www.ulrichradig.de/index.html
And I don't have Clock or Data on MOSI...
IO0DIR &=~(1<<SPI_DI);//Setzen von Pin MMC_DI auf Input
IO0DIR |= (1<<SPI_Clock);//Setzen von Pin MMC_Clock auf Output
IO0DIR |= (1<<SPI_DO);//Setzen von Pin MMC_DO auf Output
IO0DIR |= (1<<MMC_Chip_Select);//Setzen von Pin MMC_Chip_Select auf Output
IO0DIR |= (1<<SPI_SS); //Setzt den Pin MMC_Chip_Select auf High Pegel
// setup SCK pin P04
PINSEL0 &= ~(3<<8);
PINSEL0 |= (1<<8);
// setup MISO pin P05
PINSEL0 &= ~(3<<10);
PINSEL0 |= (1<<10);
// setup MOSI pin P06
PINSEL0 &= ~(3<<12);
PINSEL0 |= (1<<12);
// setup SSEL pin P07 // WICHTIG: auch wenn es nicht benutzt wird...
PINSEL0 &= ~(3<<14); // ansonsten läuft die ganze SPI nicht
PINSEL0 |= 1<<14;
//Aktiviren des SPI - Bus, Master, Clock = Active LOW
S0SPCCR = 8; // low speed
S0SPCR = (1<<MSTR)|(1<<CPOL); //Enable SPI, SPI in Master Mode
while (TRUE)
{
S0SPDR = 0xff;
while(!(S0SPSR & (1<<SPIF)));
Temp = S0SPDR;
}