LPC802M001JDH20J adc not working with SDK adc driver example

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

LPC802M001JDH20J adc not working with SDK adc driver example

跳至解决方案
827 次查看
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 项奖励
回复
1 解答
806 次查看
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 项奖励
回复
2 回复数
796 次查看
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 项奖励
回复
807 次查看
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 项奖励
回复