Hi,
I think the line LPC_PINCON->FIODIR |= (1<<15); is incorrect.
The line LPC_GPIO0->FIODIR |= (1<<15); is correct, in other words, the FIODIR register is only belongs to GPIO module rather than IOCON.
For IOCON module, pls use the PINSEL[reg] to select the pin function.
void Chip_IOCON_PinMuxSet(LPC_IOCON_T *pIOCON, uint8_t port, uint8_t pin, uint32_t modefunc)
{
Chip_IOCON_PinMux(pIOCON, port, pin,
/* mode is in bits 3:2 */
modefunc >> 2,
/* func is in bits 1:0 */
modefunc & 3 );
}
/* Setup pin modes and function */
void Chip_IOCON_PinMux(LPC_IOCON_T *pIOCON, uint8_t port, uint8_t pin, uint32_t mode, uint8_t func)
{
uint8_t reg, bitPos;
uint32_t temp;
bitPos = IOCON_BIT_INDEX(pin);
reg = IOCON_REG_INDEX(port,pin);
temp = pIOCON->PINSEL[reg] & ~(0x03UL << bitPos);
pIOCON->PINSEL[reg] = temp | (func << bitPos);
temp = pIOCON->PINMODE[reg] & ~(0x03UL << bitPos);
pIOCON->PINMODE[reg] = temp | (mode << bitPos);
}
Pin mux block:
Hope it can help you
BR
Xiangjun Rong