reading voltage on pin PTB0 on NTM88

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

reading voltage on pin PTB0 on NTM88

Jump to solution
1,109 Views
ankit2631
Contributor II

I am using NTM88 TPMS sensor, i want to read the voltage on pin PTB0. i am calling this function vfnTakeSensorsMeasurements(TAKE_P|TAKE_V|TAKE_T|TAKE_Z|COMP); to take pressure, voltage ,temperature and Z axis reading. my other parameters are giving proper readings but voltage readings are not coming.it is constantly giving raw reading as 195 irrespective of whether the pin is grounded or connected to vcc. i want to take voltage measurement on pin PTB0, is there any other step that i am missing. where do we configure the pin on which the voltage is to be measured. in my case it is PTB0

0 Kudos
Reply
1 Solution
1,097 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Hi Ankit,

TPMS_READ_VOLTAGE function, called in vfnTakeSensorsMeasurements(), measures the battery voltage.

Measuring the voltage at PTB0 pin is done with the function TPMS_READ_V0. Before calling the function, PTB0 pin must be configured as input.

Measuring the voltage at PTB1 pin is done with the function TPMS_READ_V1. Before calling the function, PTB1 pin must be configured as input.

The list and description of all library functions is available in the firmware library user guide:

https://www.nxp.com/webapp/Download?colCode=UM11145

Best regards,

Tomas

View solution in original post

4 Replies
1,072 Views
ankit2631
Contributor II

Hi Tomas,

After going through datasheet i saw that for measuring external voltage on pin PTB0 and PTB1 it takes VDD as reference voltage that is the reason it may be giving 1023 as raw count always, because i am trying to measure the supply voltage (voltage of coin cell battery used as a supply source) using this pin and as my supply voltage is going low the reference voltage also goes low hence it shows 1023. is there any way to measure supply voltage given to the NTM88.

0 Kudos
Reply
1,067 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Hi Ankit,

If VDD is connected to PTB1 then it is indeed normal that the function returns 1023.

Measuring the supply voltage is done with TPMS_READ_VOLTAGE followed by TPMS_COMP_VOLTAGE. The transfer function converting the compensated voltage value from counts to volt is given in the datasheet.

Best regards,

Tomas

1,075 Views
ankit2631
Contributor II

i tried using TPMS_READ_V1 for measuring voltage on PTB1 pin, it is constantly giving 1023 as a raw count in "gau16UUMA" irrespective of the voltage value and after compensation i get the compensated voltage count as 255 in "gu8CompVolt".  am i doing something wrong?

 

void vfnTakeSensorsMeasurements (UINT8 u8sens_select)
{
/* Enable Bandgap - required for V and T measurements
* It takes 25µs to stabilize.
*/
SPMSC1_BGBE = 1;
vfnDelayMicroSec(4); // Perform a 28us delay

/* Clear acquisition status */
gu8StatusAcq = 0;

/*
* TEMPERATURE
*/
if ((u8sens_select & TAKE_T) == TAKE_T)
{
gu8StatusAcq |= TPMS_READ_TEMPERATURE (gau16UUMA);

if ((u8sens_select & COMP) == COMP)
{
gu8StatusAcq |= TPMS_COMP_TEMPERATURE (&gu8CompTemp, gau16UUMA);
}
}

/*
* VOLTAGE
*/
if ((u8sens_select & TAKE_V) == TAKE_V)
{
PTBDD_PTBDD1 = 0;
gu8StatusAcq |= TPMS_READ_V1 (gau16UUMA,1);

if ((u8sens_select & COMP) == COMP)
{
gu8StatusAcq |= TPMS_COMP_VOLTAGE (&gu8CompVolt, gau16UUMA);
}
}

/*
* PRESSURE
*/
if ((u8sens_select & TAKE_P) == TAKE_P)
{
gu8StatusAcq |= TPMS_READ_PRESSURE (gau16UUMA, 1u);

if ((u8sens_select & COMP) == COMP)
{
// Performing pressure compensation requires raw temperature and voltage
if ((u8sens_select & TAKE_T) != TAKE_T)
{
gu8StatusAcq |= TPMS_READ_TEMPERATURE (gau16UUMA);
}

if ((u8sens_select & TAKE_V) != TAKE_V)
{
gu8StatusAcq |= TPMS_READ_VOLTAGE (gau16UUMA);
}

gu8StatusAcq |= TPMS_COMP_PRESSURE (&gu16CompPressure, gau16UUMA);
}
}

/*
* ACCELERATION X
*/

gu8AccelOffsetX = 7;

if ((u8sens_select & TAKE_X) == TAKE_X)
{
if ((u8sens_select & RAW_DYN) == RAW_DYN)
{
gu8StatusAcq |= TPMS_READ_DYNAMIC_ACCEL_X (LPF_500HZ, &gu8AccelOffsetX, gau16UUMA);
}
else
{
gu8StatusAcq |= TPMS_READ_ACCEL_X(gau16UUMA, 1, LPF_500HZ, gu8AccelOffsetX);
}

if ((u8sens_select & COMP) == COMP)
{
// Performing acceleration compensation requires raw temperature and voltage
if ((u8sens_select & TAKE_T) != TAKE_T)
{
gu8StatusAcq |= TPMS_READ_TEMPERATURE (gau16UUMA);
}

if ((u8sens_select & TAKE_V) != TAKE_V)
{
gu8StatusAcq |= TPMS_READ_VOLTAGE (gau16UUMA);
}

gu8StatusAcq |= TPMS_COMP_ACCEL_X ((UINT16*) &gu16CompAccelX, gau16UUMA);
}
} // end X measurement

/*
* ACCELERATION Z
*/

gu8AccelOffsetZ = 7;

if ((u8sens_select & TAKE_Z) == TAKE_Z)
{
if ((u8sens_select & RAW_DYN) == RAW_DYN)
{
gu8StatusAcq |= TPMS_READ_DYNAMIC_ACCEL_Z (LPF_500HZ, &gu8AccelOffsetZ, gau16UUMA);
}
else
{
gu8StatusAcq |= TPMS_READ_ACCEL_Z(gau16UUMA, 1, LPF_500HZ, gu8AccelOffsetZ);
}

if ((u8sens_select & COMP) == COMP)
{
// Performing acceleration compensation requires raw temperature and voltage
if ((u8sens_select & TAKE_T) != TAKE_T)
{
gu8StatusAcq |= TPMS_READ_TEMPERATURE (gau16UUMA);
}

if ((u8sens_select & TAKE_V) != TAKE_V)
{
gu8StatusAcq |= TPMS_READ_VOLTAGE (gau16UUMA);
}

gu8StatusAcq |= TPMS_COMP_ACCEL_Z ((UINT16*) &gu16CompAccelZ, gau16UUMA);
}
} // end Z measurement

/* Disable bandgap - allows us to save some power */
SPMSC1_BGBE = 0;
}

0 Kudos
Reply
1,098 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Hi Ankit,

TPMS_READ_VOLTAGE function, called in vfnTakeSensorsMeasurements(), measures the battery voltage.

Measuring the voltage at PTB0 pin is done with the function TPMS_READ_V0. Before calling the function, PTB0 pin must be configured as input.

Measuring the voltage at PTB1 pin is done with the function TPMS_READ_V1. Before calling the function, PTB1 pin must be configured as input.

The list and description of all library functions is available in the firmware library user guide:

https://www.nxp.com/webapp/Download?colCode=UM11145

Best regards,

Tomas