Content originally posted in LPCWare by MAUROFIUNER on Sat Oct 26 13:17:13 MST 2013
Hi tnks for help me, (I Attach the mmc.c,,,)
First I set the ssp0 interface..
static void init_ssp(void)
{
SSP_CFG_Type SSP_ConfigStruct;
PINSEL_CFG_Type PinCfg;
/*
* Initialize SPI pin connect fn=2 ssp0
* P0.16 - SSEL- used as GPIO
* P0.15 - SCK;
* P0.17 - MISO
* P0.18 - MOSI
*/
PinCfg.Funcnum = 0; //General purpose digital input/output pin
PinCfg.OpenDrain = 0;//Pin is in the normal (not open drain) mode
PinCfg.Pinmode = 2; //pin has neither pull-up nor pull-down... beacause I've external 10k pull up resistors...
PinCfg.Portnum = 0;
PinCfg.Pinnum = 16;
PINSEL_ConfigPin(&PinCfg);
PinCfg.Funcnum = 2; //function 2 ssp0
PinCfg.OpenDrain = 0;//Pin is in the normal (not open drain) mode
PinCfg.Pinmode = 2; //pin has neither pull-up nor pull-down
PinCfg.Portnum = 0;
PinCfg.Pinnum = 15;
PINSEL_ConfigPin(&PinCfg);
PinCfg.Pinnum = 17;
PINSEL_ConfigPin(&PinCfg);
PinCfg.Pinnum = 18;
PINSEL_ConfigPin(&PinCfg);
SSP_ConfigStructInit(&SSP_ConfigStruct);
// Initialize SSP peripheral with parameter given in structure above
SSP_Init(LPC_SSP0, &SSP_ConfigStruct);
// Enable SSP peripheral
SSP_Cmd(LPC_SSP0, ENABLE);
}
with respect to the timing...........
void SysTick_Handler(void) {
disk_timerproc();
}
and
... SysTick_Config(SystemCoreClock / 100);
then I change the mmc.c references from SSP1 into SSP0..
1- #define CS_LOW() GPIO_ClearValue ( 0, 1<<16 ) //P0.16 CS
#define CS_HIGH() GPIO_SetValue (0, 1<<16) //P0.16 Cs
2- SSPSend//SSPReceive(...)
SSP_ReadWrite(LPC_SSP0, &xferConfig, SSP_TRANSFER_POLLING);
3- disk_initialize (...)
GPIO_SetDir(0, 1<<16, 1); /* CS... P0.16 output*/
// GPIO_SetDir(2, 1<<11, 0); /* Card Detect */................. What should I do with this? I have not that connection
4- disk_timerproc(...)
pv = ((GPIO_ReadValue(2) & (1<<11)) != 0); // ................... newly this
................
when start debugging the PC goin to any place... not even reach the breakpoint on the first instruction of the main()...
Thanks a lot!
Forgive my English