Hi.I've have an issue that a port pin 0.19 on the LPC824 is set to output, it will not respond to instruction to set HIGH or LOW.
It seems that on POR, that the PINABLE0 register is clearing (which ENABLES) ADC_0, ADC_6, ADC_7 and ADC_9. Other ADC bits are set to 1, which DISABLES the ADC link to the port pin. Data sheet states that the reset state should be 1 for all ADC port pins.
I have tried this on an LPCXpresso824-MAX eval board.
I'm using IAR EWARM, which if you start from the debug enviroment it works OK, but if you start the debug code without IAR, it goes wrong.
I've started the the expresso board without IAR, it goes wrong, used the IAR connect to running target, inspected the PINENABLE0 register, which show the above register bits cleared.
I've tried a simple code example which does the same. A fix is to put a few lines of code to set those bits to 1, but they shouldn't be 0 in the first place? So that extra code shouldn't be required.
Is there something obvious I'm not doing as this would be seen by other folk, but not seen this mentioned on the forum.
Thanks
My test code
u8 test_byte;
void main(void)
{
SystemCoreClockUpdate();
//GPIO_INIT();
Chip_GPIO_Init(LPC_GPIO_PORT);
Chip_GPIO_SetPinDIR(LPC_GPIO_PORT, PORT0, 20, GPIO_OUTPUT);
Chip_GPIO_SetPinState(LPC_GPIO_PORT, PORT0, 20, HIGH);
Chip_GPIO_SetPinDIR(LPC_GPIO_PORT, PORT0, 18, GPIO_OUTPUT);
Chip_GPIO_SetPinState(LPC_GPIO_PORT, PORT0, 18, HIGH);
Chip_GPIO_SetPinDIR(LPC_GPIO_PORT, PORT0, 19, GPIO_OUTPUT);
Chip_GPIO_SetPinState(LPC_GPIO_PORT, PORT0, 19, HIGH);
// This fixes the issue !
/*
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SWM); // Enable the clock to the Switch Matrix
Chip_SWM_DisableFixedPin(SWM_FIXED_ADC0); //turn off ADC is on port
Chip_SWM_DisableFixedPin(SWM_FIXED_ADC6); //turn off ADC
Chip_SWM_DisableFixedPin(SWM_FIXED_ADC7); //turn off ADC
Chip_SWM_DisableFixedPin(SWM_FIXED_ADC9); //turn off ADC
Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_SWM); // Disable the clock to the Switch Matrix to save power
*/
while (1)
{
if (test_byte == 0)
{
test_byte = 1;
Chip_GPIO_SetPinState(LPC_GPIO_PORT, PORT0, 19, HIGH); // debug pulse
Chip_GPIO_SetPinState(LPC_GPIO_PORT, PORT0, 18 , HIGH);
Chip_GPIO_SetPinState(LPC_GPIO_PORT, PORT0, 20 , HIGH);
}
else
{
test_byte = 0;
Chip_GPIO_SetPinState(LPC_GPIO_PORT, PORT0, 19, LOW); // debug pulse
Chip_GPIO_SetPinState(LPC_GPIO_PORT, PORT0, 18 , LOW);
Chip_GPIO_SetPinState(LPC_GPIO_PORT, PORT0, 20 , LOW);
}
}
}
// Set up and initialize hardware prior to call to main ------------------------
void SystemInit(void)
{
SCB->VTOR = VECTORS;
}
