TPMS-measurement

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

TPMS-measurement

1,060 Views
xiaohui200808
Contributor III

I am now have some issues about 87000. following is  the demo code .

UINT8 Measurement(void)
{
UINT8 u8Status = 0;

u8Status = TPMS_READ_VOLTAGE(gu16UUMA);
u8Status |= TPMS_COMP_VOLTAGE(&u8CompVol,gu16UUMA);
u8Status |= TPMS_READ_TEMPERATURE(gu16UUMA);
u8Status |= TPMS_COMP_TEMPERATURE(&u8CompTemp,gu16UUMA);
u8Status |= TPMS_READ_PRESSURE(gu16UUMA, 1u);
if( TPMS_COMP_PRESSURE(&u16CompPress,gu16UUMA))   
{
gu16UUMA[UUMA_PRESSURE] = 0xFFFF;
}
u8Status |=TPMS_READ_ACCEL_XZ(gu16UUMA,1,0,7,7);
if( TPMS_COMP_ACCEL_XZ(u16CompAccelXZ,gu16UUMA))
{gu16UUMA[UUMA_Z] = 0xFFFF;
}
tRDEData.u8ElapsedTime = 1u;

return u8Status;
}

what is the meaning 

 u8Status |= TPMS_READ_PRESSURE(gu16UUMA, 1u);
if( TPMS_COMP_PRESSURE(&u16CompPress,gu16UUMA))   
{    gu16UUMA[UUMA_PRESSURE] = 0xFFFF;    }

could I use the following code 

 u8Status |= TPMS_READ_PRESSURE(gu16UUMA, 1u);

 u8Status |= TPMS_COMP_PRESSURE(&u16CompPress,gu16UUMA);

0 Kudos
3 Replies

792 Views
f20150335
Contributor III

Hi, Can you tell me where did you get this code from? Did you write it yourself?

0 Kudos

792 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Hi,

Please find below a detailed answer from our TPMS apps engineer.

Measuring the actual value of pressure is done in two steps:
1. TPMS_READ_PRESSURE(gu16UUMA, 1u) will store the 10-bit uncompensated value of pressure (output of the ADC) in UUMA.
2. TPMS_COMP_PRESSURE(&u16CompPress,gu16UUMA) performs a compensation of the pressure value stored in UUMA: the function linearizes the value and correct the error due to temperature and voltage (this is why this function must be called after the readings of pressure, temperature and voltage).
Both functions (READ and COMP) return a status to indicate if the pressure value is ok or if there has been a problem with the ADC or an underflow/overflow.
The returned status is explained in the firmware user guides. For example, below is the returned status of TPMS_COMP_PRESSURE:

Table 13.JPG

If the returned status is 0, it means the pressure value returned by TPMS_COMP_PRESSURE is valid and can be used. If the value is not 0, it means there has been a problem (overflow/undeflow) or we suspect there is a problem, so the value may not be accurate.

In the code, when there is:

if( TPMS_COMP_PRESSURE(&u16CompPress,gu16UUMA))   
{    gu16UUMA[UUMA_PRESSURE] = 0xFFFF;    }

... it means that if the returned status of TPMS_COMP_PRESSURE is not 0 (so there is or may be a problem), the uncompensated pressure value is set to 0xFFFF.
I suppose that later in the code the uncompensated pressure must be checked and if it is 0xFFFF, then the pressure value is discarded? But I do not know why this is done on the uncompensated pressure (in UUMA) and not on the compensated pressure value (u16CompPress). The person who wrote this code wanted to handle it like that, but this is not the only way.
So of course this can be modified and you can use:
u8Status |= TPMS_COMP_PRESSURE(&u16CompPress,gu16UUMA);
What is important to do is to check the returned status to know if the pressure value is ok or not. The way to verify the status and indicate if the pressure can be used or not can be done in many ways, it will depend on the person who is writing the application and on the requirements of the application.
The Firmware User Guides are on FXTH87 Documentation webpage, under User Guides.
UG.JPG
I hope it helps!
Best regards,
Tomas

792 Views
xiaohui200808
Contributor III

Hello

      I also want to ask:The Measuring randomly or not .

if there is a Measurement error .could I Measure it again ,does the next time  will occure error again?

if there is a Measurement error .what should I do next?

0 Kudos