s32k358 MCU temperature measurement

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

s32k358 MCU temperature measurement

Jump to solution
958 Views
BillWen
Contributor III

Hi :

I have some problem on measure s32k358 mcu temperature, I also check other post on NXP community, but I can't find the problem, please help us check, thanks.

The following is my ADC setting :

BillWen_1-1775803665355.png

BillWen_2-1775803680527.png

BillWen_3-1775803723072.png

Function code I follow the formula from S32K3RM

BillWen_0-1775803642764.png

I get Mcu temp raw data about 8208, and after ADC 8208* (3300/16384)

and formula from RM then can get MCU temp = 48~49, I think the value is not correct.

Is there any wrong setting in my MCAL or code?

Thanks

BR, BillWen

0 Kudos
Reply
1 Solution
792 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@BillWen

The TEMPSENSE output can be read by an ADC on demand so that the software can determine the current die temperature. The software should enable the TEMPSENSE by setting ETSCTL[ETS_EN].

 

Secondly, there are requirements for the ADC sampling time of the temperature sensor; it must be greater than 1.2us. I suggest you use a larger value.

image.png

View solution in original post

0 Kudos
Reply
11 Replies
937 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@BillWen

First, the calculation process you provided is correct, but I see some obvious errors:

1. The parameter you entered here is 53, which is 0b00110101.

This indicates that the reference voltage is 3.5V, not 3.3V.

image.png

So this should be wrong :ADC 8208* (3300/16384)

---------------------------------------------------------------------------------

I've created a simple table based on the calculation formulas provided in the datasheet for your reference.

image.png

image.png

0 Kudos
Reply
821 Views
BillWen
Contributor III
Hi Senlent:
Thanks for your reply.
For the parameter you entered here is 53, which is 0b00110101.
I change the value to 3.3V(51) or 5V(80), I still get the same raw data. I use the same way to get mcu temp just like how I get other ADC value, is it correct? or do I need to use Adc_TempSenseGetTemp function?

Thanks
BR,BillWen
0 Kudos
Reply
819 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@BillWen

I think that's incorrect, because this should change.

Have you enabled the internal temperature sensor?

It's not mandatory, but our driver already provides an API for calculation.

You can refer to this example.

https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K344-TempSenser-S32DS36-RTD600-500-400-p...

 

0 Kudos
Reply
814 Views
BillWen
Contributor III
Hi Senlent:
As I know is that we can use Adc_TempSenseGetTemp API to get the temperature value after convert, but I also can convert by myself, right? I also check the following post on community. It seems that I still can just get rawdata and use formula from Reference manual to calculate the real temperature value.
https://community.nxp.com/t5/S32K/Reading-the-internal-temperature-of-S32K388-using-TEMPSENSE/m-p/18...

Btw, I also check the example you uploaded, due to the project is based on driver layer not MCAL layer, I think is different process.
Thanks
BR, BillWen
0 Kudos
Reply
808 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@BillWen

Yes, you can calculate it yourself, but since an API has been provided, there's no need to do it manually.

0 Kudos
Reply
802 Views
BillWen
Contributor III
Hi Senlent:

Yes, I know this, but the problem for now is that I can't get right raw data. The real temperature value won't be correct no matter calculate by API or manually if the raw data not correct.

Thanks
BR, BillWen
0 Kudos
Reply
800 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@BillWen

1. Check if the internal temperature sensor is enabled.

2. Check if the ADC is configured correctly.

If the sampling values ​​of your other ADC channels are correct, there's no reason why the temperature sensor's sampling value shouldn't change at all.

0 Kudos
Reply
794 Views
BillWen
Contributor III
Hi Senlent:
I think ADC configuration is correct because I can get correct other ADC value correct like power voltage which according to our project.
Do you know how to check internal temperature sensor is enabled or not?
Thanks
BR, BillWen
0 Kudos
Reply
793 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@BillWen

The TEMPSENSE output can be read by an ADC on demand so that the software can determine the current die temperature. The software should enable the TEMPSENSE by setting ETSCTL[ETS_EN].

 

Secondly, there are requirements for the ADC sampling time of the temperature sensor; it must be greater than 1.2us. I suggest you use a larger value.

image.png

0 Kudos
Reply
785 Views
BillWen
Contributor III
Hi Senlent:
Thanks for your support, I find the problem.
After I fix my problem, I get the temperature around 35~36, it seems normal I think.

Thanks
BR, BillWen
0 Kudos
Reply
777 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@BillWen

If this post answers your question, please click the "ACCEPT AS SOLUTION" button.

0 Kudos
Reply