LPC802M001JDH20J adc not working with SDK adc driver example

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

LPC802M001JDH20J adc not working with SDK adc driver example

Jump to solution
605 Views
mgmate123
Contributor I

Hi,

I am trying to test the adc signals of my project with the SDK example before testing with my configuration code. I´ve tried with the interrupt and basic examples, and with both of them, the output shown in the console is as follows: 

ADC interrupt example.
Configuration Done.
gAdcResultInfoStruct.result = 0
gAdcResultInfoStruct.channelNumber = 0
gAdcResultInfoStruct.overrunFlag = 0

I'm using the ADC0_0, ADC0_5 and ADC0_8 pins in my project and I´ve change the "DEMO_ADC_SAMPLE_CHANNEL_NUMBER" for each pin, and the output is always the same, only changing the number of the channel.

I've also checked the hardware, for each pin the value of the analog signal is correct and it should work.

I don't know if there is something missing in the SDK example that I need to include so it can match with my chip (LPC802M001JDH20J). I've no clue rigth know of what could be happening.

Hope you can help me.

Thanks.

I'm going to attach the interrupt SDK example just in case.

0 Kudos
1 Solution
584 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Mateo,

Regarding your question, I think you do not set up the ADC pins assignment, which leads to the sample result error.

First of all, if you want to use ADC0_0 channel, you have to disable the temperature with the code.

/* Use the temperature sensor input to channel 0. */
ADC_EnableTemperatureSensor(DEMO_ADC_BASE, false); in the void ADC_Configuration(void).

Secondly, you have to set up the ADC0 pins assignment with the code like:

(/* Enables clock for switch matrix.: enable */
CLOCK_EnableClock(kCLOCK_Swm);

you have to write the PINENABLE 0 register so that you can set up the register.

SWM->PINENABLE0&=~(0x0FFF<<10); //enable all ADC channels

You can use a function to write the PINENABLE 0 register in SDK, pls do it yourself.

Hope it can help you

Regard

XiangJun Rong

xiangjun_rong_0-1610073702488.png

 

 

 

 

View solution in original post

0 Kudos
2 Replies
574 Views
mgmate123
Contributor I

Hello XiangJun,

As you told me, on the initialization of the pins the PIENABLE0 was missing for the pins I was testing earlier. That solved my problem.

Thanks for your help.

0 Kudos
585 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Mateo,

Regarding your question, I think you do not set up the ADC pins assignment, which leads to the sample result error.

First of all, if you want to use ADC0_0 channel, you have to disable the temperature with the code.

/* Use the temperature sensor input to channel 0. */
ADC_EnableTemperatureSensor(DEMO_ADC_BASE, false); in the void ADC_Configuration(void).

Secondly, you have to set up the ADC0 pins assignment with the code like:

(/* Enables clock for switch matrix.: enable */
CLOCK_EnableClock(kCLOCK_Swm);

you have to write the PINENABLE 0 register so that you can set up the register.

SWM->PINENABLE0&=~(0x0FFF<<10); //enable all ADC channels

You can use a function to write the PINENABLE 0 register in SDK, pls do it yourself.

Hope it can help you

Regard

XiangJun Rong

xiangjun_rong_0-1610073702488.png

 

 

 

 

0 Kudos