LPC55S69: temperature measurement example in SDK 2.8.0

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

LPC55S69: temperature measurement example in SDK 2.8.0

1,818 Views
EugeneHiihtaja
Senior Contributor I

Hi !

I can see significant changes in example lpadc_temperature_measurement and would like to understand better what there are.

1. For what reason need this line:

/* set BOD VBAT level to 1.65V */
POWER_SetBodVbatLevel(kPOWER_BodVbatLevel1650mv, kPOWER_BodHystLevel50mv, false);

What is relation with temperature measurement ?

2.  New comment recommend to limit input frequency to 6Mhz.

/* Maximum advised frequency for temperature sensor measurement is 6MHz whether the source is XTAL or FRO.

I'm using FROH source and div 8 and have clock 12 Mhz.

How critical this recommendation ?

In case of crystal-less clocking this is only possible clock for ADC.

3. What about new configuration parameter  ?

lpadcConfigStruct.powerLevelMode          = kLPADC_PowerLevelAlt4;

How it effect to Power management ?

In my case I wakeup from PowerDown mode periodically, fully reinitialize ADC and take temperature measurement.

4. What can be ADC settings for execute as fast conversion as possible ?

 With example settings:

g_LpadcCommandConfigStruct.sampleTimeMode = kLPADC_SampleTimeADCK131;
g_LpadcCommandConfigStruct.hardwareAverageMode = kLPADC_HardwareAverageCount128;

 Initialization and get first sample take ~7 ms what is too long.

And I have disabled skip of 2 first inaccurate values already.

Shorter average show almost random result and some accurate and fast values are need to be "calculated."

There are should be stable in wide temperature range of MCU usage,

Regards,

Eugene

Labels (1)
0 Kudos
7 Replies

1,688 Views
Omar_Anguiano
NXP TechSupport
NXP TechSupport

Hello Eugene Hiihtaja

 

I will gladly answer your questions:

 

  1. This is not related to the example. The reason why this was added was that there is a known issue where you may see a hard fault under some specific conditions. These conditions are running the LPC55 with 150MHz at 1.8V.

 

  1. I suggest you take in count this recommendation, at frequencies above 6MHz this example may behave differently as expected.

 

  1. This new configuration implies that the power consumption will be higher since to set the ADC to the lowest power setting this value needs to be zero.

 

  1. To decrease the conversion time I suggest you low the sample time and the average, if the ADC is in its lower power level the time spent will be higher, for lower conversion time the ADC will consume more power.

 

Let me know if this is helpful, if you have more questions do not hesitate to ask me.

Best regards,

Omar

0 Kudos

1,689 Views
EugeneHiihtaja
Senior Contributor I

Hi nxf54944‌ !

Thank you !

Can you give more details about 2.

What effects I can see in case of 12 Mhz usage ?

In case of crystall-less clocking, FRO_96 Mhz is lowest clock what can be routed to ADC.

Or may be I can use PLL0 in bypass mode and route FRO_12Mhz via it to ADC.

And take PLL1 in use for generate system clock ~150Mhz.

My main clock switch between 12,96 and ~150Mhz  on fly and ADCCLKSEL can route the same clock value from different sources.

ADC can be in conversion process and how clock source can have effect to it ? 

So clock value can be the same, but source of it is different  and clock source can change while conversion because it take some ms

and it is quite long time to lock execution.

Regards,

Eugene

0 Kudos

1,689 Views
Omar_Anguiano
NXP TechSupport
NXP TechSupport

Hello Eugene Hiihtaja

About the effects of doing the temperature measuring with ADC frequency above 6Mhz, the results are uncertain, in some cases, you may experience inaccurate results.
 
In the example, the PLL is adequated to be attached to the ADC clock, the other PLL can be used as main clock source.
I do not suggest to change the clock source while the ADC is running, the samples collected during the switch may not be reliable.
 
Let me know if this is helpful, if you have more questions do not hesitate to ask me.
Best regards,
Omar

0 Kudos

1,689 Views
EugeneHiihtaja
Senior Contributor I

Hi nxf54944‌ !

I have activated PLL0 in bypass mode and use FRO_12MHz as clock source for ADC. After ADC divisor - clock is 6Mhz what is expected value. The same path is used for all my clocking trees. Path is configured once at startup and do not refreshed after powerDown mode and while changing of system clock. I think this is good way to so it.

I can see that with the next average parameters , I can have stable temperature value in room temperature quite fast ( ~ 2ms ?). And no need to skip first 2 values like in example. But may be there are should be skipped in any way ?

lpadcConfigStruct.conversionAverageMode = kLPADC_ConversionAverage8;

lpadcConfigStruct.powerLevelMode = kLPADC_PowerLevelAlt4;

g_LpadcCommandConfigStruct.sampleTimeMode = kLPADC_SampleTimeADCK131;
g_LpadcCommandConfigStruct.hardwareAverageMode = kLPADC_HardwareAverageCount16;

But few default parameters are not so clear for me :

config->powerUpDelay = 0x80;
config->convPauseDelay = 0U;

Should they be adjusted as well ?

Looks like ADC convertor require full reinitialization after PowerDown mode. In my case temperature measured not every wakeup from PowerDown mode and for conserve power, ADC clock is disabled before entry to PowerDown mode and enabled back where full reinitialization  of ADC is required before temperature measurement ( every 60 s ).

So can I disable ADC clock freely or better to keep it ON all the time ?

What kind of other tips and tricks and parameters can be suggested for have stable and fast temperature measurement

in current scheme ?

Thank you !

Regards,

Eugene

0 Kudos

1,689 Views
Omar_Anguiano
NXP TechSupport
NXP TechSupport

Hello Eugene Hiihtaja

 

The reason why the first two results are skipped is that they may be inaccurate if you think that it is convenient to maintain these two values you can do it.

 

About these parameters:

config->powerUpDelay = 0x80;

config->convPauseDelay = 0U;

 

When the analog circuits are not pre-enabled, the ADC analog circuits are only powered while the ADC is active and there is a counted delay defined by powerUpDelay after initial trigger transitions the ADC from its Idle state to allow time for the analog circuits to stabilize.

The convPauseDelay controls the duration of pausing during command execution sequencing.  Only available when ADC pausing function is enabled.

To minimize the effects of the powerup delay you can pre-enable the analog circuits of the ADC setting the CFG(PWREN) field at the expense of power consumption.

 

Disabling and Enabling the ADC may increase the conversion time since it needs time to be powered up.

 

Let me know if this is helpful, if you have more questions do not hesitate to ask me.

Best regards,

Omar

0 Kudos

1,689 Views
EugeneHiihtaja
Senior Contributor I

Hi nxf54944‌ !

I think in example , ADC convertor is pre-enabled, becouse of :


POWER_DisablePD(kPDRUNCFG_PD_LDOGPADC);
POWER_DisablePD(kPDRUNCFG_PD_GPADC);
POWER_DisablePD(kPDRUNCFG_PD_TEMPSENS);

After that, after every powerdown I just call

ADC_Configuration() and ADC_GetTemperature();

How inaccurate values can be if I take first sample ?

If it just +-2C it is not problem for me.

When I had trial with old example from SDK, sometimes temperature was 433C or other weired values.

But now even first sample after PowerDown looks good. 

Regards,

Eugene

0 Kudos

1,681 Views
Omar_Anguiano
NXP TechSupport
NXP TechSupport

Hello yevgen_gyl

You are correct, the ADC is pre-enabled when this sentence is true. This sentence is inside the function "ADC_Configuration":

    lpadcConfigStruct.enableAnalogPreliminary = true;

I cannot assure you a value for the inaccurate values, the user manual and the examples suggest to discard the first two samples however if you are having good results and you feel it is convenient you can keep these values.

If you have more questions do not hesitate to ask me.

Best regards,

Omar

0 Kudos