Port pin configured as ADC input at POR?
I have the LPC824.
I use PIO0_20 as a simple port pin set to output that I manually change its status in code - Chip_GPIO_SetPinState(.....) - at certain specific times.
The port pin was not doing any action at all.
After some delving in debug mode, I found that in the SVM register ADC_6 was set to 0 , thusly enabling ADC_6.
I don't set ADC_6 to be enabled in my code. ADC_6 at POR should be disabled by default (set to 1).
Has anybody else seen this?
Hello Mike,
Recently was released the SDK for the LPC824. I modified the example mrt_example provided in the SDK to toggle the pin P0_20 on each MRT interrupt, and everything worked perfect.
Here are the changes that I made to the example. Before entering the infinite loop I configured the pin P0_20 as follows:
/* Define the init structure for the output pin*/
gpio_pin_config_t pin_config = {
kGPIO_DigitalOutput, 0,
};
GPIO_PortInit(GPIO, 0);//Initialize the port
GPIO_PinInit(GPIO, 0, 20, &pin_config);//Initialize the port as an output
In the infinite loop inside the if statement I added the line to toggle the pin:
while (true)
{
/* Check whether occur interupt and toggle LED */
if (true == mrtIsrFlag)
{
PRINTF("\r\n Channel No.0 interrupt is occured !");
APP_LED_TOGGLE;
GPIO_PortToggle(GPIO, 0, 1u << 20);//Toggle the led
mrtIsrFlag = false;
}
}
It's important that you add the following include into the example:
#include "fsl_gpio.h"
Hope it helps!
Victor.
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------