Hi,
I am having basic trouble in locating/using the SGPIO pin in LPC-link2 board. To make things simple, I am trying to setup the SGPIO pin as a GPIO pin. Please take a look at the code lines below. The code is getting into the runpincheck2() and seems to loop through fine because the board led is toggling as expected. However I do not see the SGPIO13 set as a GPIO pin toggling.
In the LPC-link2 board SGPIO13 pin is buffered from P2_4 and is connected to jumper connector J4_pin18. When I monitor J4_pin18 the pin is not toggling (pin seems to be floating as it is varying randomly near ground; does not seem to be strongly connected to ground).
#if defined (__USE_LPCOPEN)
// Read clock settings and update SystemCoreClock variable
SystemCoreClockUpdate();
#if !defined(NO_BOARD_LIB)
#if defined (__MULTICORE_MASTER) || defined (__MULTICORE_NONE)
// Set up and initialize all required blocks and
// functions related to the board hardware
Board_Init();
#endif
// Set the LED to the state of "On"
Board_LED_Set(0, true);
#endif
#endif
runpincheck2();
void runpincheck2(void){
Chip_SCU_PinMuxSet((uint8_t)0x2, (uint8_t)4, (uint16_t)(SCU_MODE_INACT | SCU_MODE_FUNC0) );
LPC_SGPIO->OUT_MUX_CFG[13] = (0L << 4) | (4L << 0);
LPC_SGPIO->GPIO_OENREG |= (1L <<13);
while(1){
volatile int i, junki;
LPC_SGPIO->GPIO_OUTREG |= (1L << 13);
Board_LED_Toggle(0 );
for(i=0; i<1000000; i++) {
junki++;
}
LPC_SGPIO->GPIO_OUTREG &= ~(1L << 13);
Board_LED_Toggle(0 );
for(i=0; i<4000000; i++){
junki++;
}
}
return;
}
Thanks,
robotxyz