I have the NXP LPCXpresso55S69 EVK (Rev A1), and SDK 2.6.3. I import the example "lpcxpresso55s69_lpadc_interrupt."
I read in the board schematic that the Arduino A0 is tied to pin 14, PIO0_16. So I change the .MEX and this generates a mapping as such:
const uint32_t port0_pin16_config = (
IOCON_PIO_FUNC0 | /* Pin is configured as ADC0_8 */
IOCON_PIO_MODE_INACT | /* No addition pin function */
IOCON_PIO_SLEW_STANDARD | /* Standard mode, output slew rate control is enabled */
IOCON_PIO_INV_DI | /* Input function is not inverted */
IOCON_PIO_ANALOG_EN | /* Enables analog function */
IOCON_PIO_OPENDRAIN_DI | /* Open drain is disabled */
IOCON_PIO_ASW_DIS_EN); /* Analog switch is enabled */
/* PORT0 PIN16 (coords: 14) is configured as ADC0_8 */
IOCON_PinMuxSet(IOCON, 0U, 16U, port0_pin16_config);
I change the following line of the source file lpcadc_interrupt.c:
#define DEMO_LPADC_USER_CHANNEL 8U
I can build and run this. However, the ADC always reads the value 1, whether I jump A0 to 3v3 or to ground.
Help? Thanks.
I've now heard that the PIO-to-channel mapping listed in the User Manual is wrong; subtract 8 from all of the channel numbers for all of the B-side ADC channels.
In fact, when I map the pin as Side B Channel 0, I get readings I expect (4095 for 3v3, 0 for Gnd).
Hello Richard,
That table in the UM is incorrect. It should be like this:
Function | Connection | Description |
---|---|---|
ADC0_4 | PIO1_8 | A-side mux, analog input channel 4. |
ADC0_3 | PIO0_31 | A-side mux, analog input channel 3. |
ADC0_2 | PIO0_15 | A-side mux, analog input channel 2. |
ADC0_1 | PIO0_10 | A-side mux, analog input channel 1. |
ADC0_0 | PIO0_23 | A-side mux, analog input channel 0. |
ADC0_12 | PIO1_9 | B-side mux, analog input channel 4. |
ADC0_11 | PIO1_0 | B-side mux, analog input channel 3. |
ADC0_10 | PIO0_12 | B-side mux, analog input channel 2. |
ADC0_9 | PIO0_11 | B-side mux, analog input channel 1. |
ADC0_8 | PIO0_16 | B-side mux, analog input channel 0. |
Best regards,
Felipe
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------