LPC55S28 chip - reading temperature sensor

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

LPC55S28 chip - reading temperature sensor

403 Views
omersh649
Contributor I

I am trying to read the chip temperature sensor. 

I tried using the LPADC component in order to read the sensor. I realized I had to disable the power down, enable the kclock_adc0 and attach a clock to it in order to calculate the analog value for the ADC.

The clock-Enable-Clock function doesn't work for kclock_adc0 for some reason (always returning 0). Even though kclock_adc0 exists in FSL clock header file. 

clock-Enable-Clock function works in other files for other clocks.

Maybe I need to enable another clock before the ADC clock?

Maybe there should be an additional action before that prevents this from working now?

I then tried to just communicate with any channel of the ADC, and not specifically channel 26 for temperature. I didn't manage to do it as well.

 

Is there any example code of how to communicate with the ADC and use it in order to read the temperature sensor in the chip? 

 

I am attaching the file I wrote for that. I call the initialization function in main, and then I call the HAL-read-CPU-temperature function in another file when the get temperature API is being called.

The clock-enable-Clock(kclock_adc0 ) doesn't work in the initialization function, always returning 0.

 

Please review the code I added in the txt file and advice how to continue from here in 2 aspects:

- Communication with the LPADC and its channels, including the power on, clocks and configurations for the temperature sensor.

- Converting the digital value the ADC returns. What is the value that it returns and how to convert it to Celsius degrees.

 

Something must be incorrect with my code.

Thanks,

Regards,

Omer. 

Labels (1)
0 Kudos
Reply
1 Reply

384 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @omersh649 

For ADC read temperature code, I recommend you firstly  refer to the LPCxpresso55s69 SDK demo "lpadc_temperature_measurement". This demo shows  how to measure the temperature within the internal sensor.

11122.jpg

 

You can contact me if still have issue after refer to it.

 

BR

Alice

 

 

 

0 Kudos
Reply