Content originally posted in LPCWare by awadhesh on Thu Sep 04 04:06:41 MST 2014
Hi,
I want to interface micro SD card to ssp1 on pin 113, 112, 111, 109. But I had checked that problem in MISO pin i.e. 111(P0.8) not receiving anything from SD card. I checked it and there are data on that pin on oscilloscope.
Now I am going to check that this pin can work in input mode or not. But it is always low whatever voltage applied on pin. After that I check the details of this pin, I got that these are W-type pin P0.7, P0.8, P0.9. I do same on all these pin, but these never read applied logic voltage.
After I configured these as output and making these to high and low with some delays to blink four leds. All leds are blinking as per expectation. But when I read PIN register, only changing is in P0.6, which is D-type, all W-type cannot read these are always low, even connected leds are blinking. I configured these pins in every setting like-pull up, pull down, filter enable/disable, hys enable/disable etc, but never get result. code is here.
========================================================================
LPC_IOCON->P0_6 = 0x00;//SSEL->SPI
LPC_IOCON->P0_7 = 0x330;//CLK->SPI
LPC_IOCON->P0_8 = 0x330;//MISO->SPI
LPC_IOCON->P0_9 = 0x330;//MOSI->GPIO
//LPC_GPIO0->DIR &= ~(0x1<<8);
//LPC_GPIO0->DIR &= ~(0x1<<7);
//LPC_GPIO0->DIR &= ~(0x1<<9);
LPC_GPIO0->DIR |= (0x1<<6);
LPC_GPIO0->DIR |= (0x1<<8);
LPC_GPIO0->DIR |= (0x1<<7);
LPC_GPIO0->DIR |= (0x1<<9);
while (1) // repeat forever
{
sprintf((char*)g_buf, "LPC_GPIO0 = %x\n\r", LPC_GPIO0->PIN);
DebugPuts(g_buf);
//if(LPC_GPIO0->PIN & (1<<8))DebugPuts((uint8_t*)"High ...\n\r");
//elseDebugPuts((uint8_t*)"Low ...\n\r");
LPC_GPIO0->SET = 0x3C0;
DelayMS(10000);
sprintf((char*)g_buf, "LPC_GPIO0 = %x\n\r", LPC_GPIO0->PIN);
DebugPuts(g_buf);
LPC_GPIO0->CLR = 0x3C0;
DelayMS(10000);
}
=====================================================================
I am getting like below.
LPC_GPIO0 = 7bfc07f
LPC_GPIO0 = 7bfc03f
LPC_GPIO0 = 7bfc07f
LPC_GPIO0 = 7bfc03f
LPC_GPIO0 = 7bfc07f
LPC_GPIO0 = 7bfc03f
LPC_GPIO0 = 7bfc07f
LPC_GPIO0 = 7bfc03f
LPC_GPIO0 = 7bfc07f
LPC_GPIO0 = 7bfc03f
LPC_GPIO0 = 7bfc07f
LPC_GPIO0 = 7bfc03f
Please let me the solution if anyone have.