How do I convert ADC samples from hex values to temperature values (QN908x)? info not provided in data sheet!

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

How do I convert ADC samples from hex values to temperature values (QN908x)? info not provided in data sheet!

2,087 Views
silentsam
Contributor II

Using a QN9080-DK for a project, I have configured the system to use the built-in temperature sensor (Channel 13 of ADC), when I receive sampled data at an instance, the data is shown in a hex value format.

Is there a scaling technique/formula I can use to obtain actual temperature values? This is not provided in the data sheet!

Also, does this temp sensor detect ambient temperature? or temperature of ADC input to an allocated channel?

The former would be very odd as temp of the IC would surely be affected by operating temps?!

Does the sensor use peripheral circuitry on the QN908x module of the DK?

Any insight would be greatly appreciated.

Thanks in advance

Sam

Tags (2)
5 Replies

1,715 Views
xing_chang
NXP Employee
NXP Employee

Hi Sam,

You can obtain the temperature data through the following modifications.

base on “release_conn_ksdk_2.2_qn9080_1.5.3_RC5_1\boards\qn908xcdk\wireless_examples\bluetooth\temperature_sensor”, you can download it at  https://mcuxpresso.nxp.com/en/builder 

This modification will be added in the subsequent SDK, and there will be correction factor participation, and the accuracy will be higher.

@@ -314,11 +314,15 @@ int32_t BOARD_GetTemperature(void)
{}

/* Get the result */
adcConvResult = ADC_GetConversionResult(ADC);

// return (int32_t) ADC_ConversionResult2Temperature(ADC, adcConvResult);
 float mvResult = ADC_ConversionResult2Mv(ADC, ADC_TEMP_CHANNEL, ADC_CFG_IDX, mAdcBandgap, mAdcVinn,
 adcConvResult);
 return (int32_t)((865.735696 - mvResult) / 1.35) * 100;

1,715 Views
silentsam
Contributor II

Xing,

Thanks for your reply.

Could you elaborate on the equation for the return value?

From this equation the range of mV is tiny, if result is in degrees C then 865.735696mV = 0C, 864.385696mV = 100C – which doesn’t seem like a reliable source.  Or have I misunderstood?
Also, you have mentioned using the ADC - is there a dedicated input pin for the temperature sensor? eg. the ADC demo uses ADC4/A2 (PA08) on the DK board. I cant find anything in the datasheet. The temperature sensor configuration is poorly documented.
 
0 Kudos
Reply

1,715 Views
xing_chang
NXP Employee
NXP Employee

Hi Sam,

(int32_t)((865.735696-mvresult) / 1.35)

is the true temperature value, multiplying by 100, which should be a convenient conversion for processing data of bluetooth profile, converting decimal to integer.

The temperature sensor uses adc channel 13,no external input pins correspond to it.

0 Kudos
Reply

1,715 Views
joseraffucci
Contributor IV

I found some code that does this in the new SDK that was released today (2.2).  Look at the temperature sensor project in the Bluetooth examples.

1,715 Views
silentsam
Contributor II

I dont suppose you happen to know the name of the function or source file? are these the latest SDK examples? They say they were last updated (2.2) in July on the QN908x software and tools section.

0 Kudos
Reply