LPC4088 dual AIN

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC4088 dual AIN

863 Views
Eggord
Contributor I

Hi All,

 

i have a LPC4088 and the Developer’s Kit board. I would like to get two AIN running. One works but if i just double the command it doesn't work:

pinmode_s ADC_IO = { .port = 0, .pin = 24, .mode = 1};

#define ADC LPC_ADC
#define ADC_CH 1
#define ADC_INTCH ADC_ADINTEN1
#define ADC_NVIC_IRQ ADC_IRQn

PINSEL_SetPinMode(ADC_IO.port, ADC_IO.pin, ADC_IO.mode);
PINSEL_SetAnalogPinMode(ADC_IO.port, ADC_IO.pin, true);

ADC_Init(ADC, 200000);
ADC_ChannelCmd(ADC, ADC_CH, ENABLE);
ADC_IntConfig(ADC, ADC_INTCH, ENABLE);

ADC_StartCmd(ADC, 1);

uint16_t val = ADC_ChannelGetData(ADC, ADC_CH);

 

So this is the relevant code for 1 channel. What i did is literally double the code and change the channel and naming a bit like:

#define ADC2 LPC_ADC
#define ADC_CH2 2
#define ADC_INTCH2 ADC_ADINTEN2
#define ADC_NVIC_IRQ2 ADC_IRQn

or

ADC_Init(ADC2, 200000);
ADC_ChannelCmd(ADC2, ADC_CH2, ENABLE);
ADC_IntConfig(ADC2, ADC_INTCH2, ENABLE);

 or

ADC_StartCmd(ADC2, 1);

With breakpoints i know it stops right after i try to get the value of the first channel.

Does somebody has any idea what i do wrong?

Thanks!!

 

All the best,

Jan

0 Kudos
Reply
2 Replies

835 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @Eggord 

Recommend you use the ADC driver under LPCopen.

And if still not work well, please describe it more detail. Is there no ADC data? Or the ADC result is not correct?  How about the secondary channel work alone?

 

BR

Alice

0 Kudos
Reply

798 Views
Eggord
Contributor I

I got it working in December.

The solution was to use "ADC_BurstCmd(LPC_ADC,ENABLE);"

instead

ADC_StartCmd(ADC, 1);
ADC_StartCmd(ADC2, 1);

but now i have a different problem ;( but i will open a new topic for this

 

Thanks for your suggestions!!

0 Kudos
Reply