This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430FR2033: Pressure data from pressure sensors

Part Number: MSP430FR2033

Hello everyone,

I am trying to measure pressure using a couple Honeywell sensors. I have 3 i2c pressure sensors, which all have the same address. There is a mux allowing communication with all 3 sensors. Every time I print pressure data I get a random hex value. Converting the value, the returned value isn't the expected value. The returned hex value is 0x8523 = ‭34083‬ in decimal.

This is the function that reads the raw data from the pressure sensors and returns a raw pressure value

uint32_t i2cReadHWPressureTemp(uint8_t channel)
{
  uint8_t c_cmd_data[1] = {channel};

  *((uint32_t*)pressure_data) = 0xFFFFFFFFU;
  I2C_Master_WriteReg(0xF0, 0x01, c_cmd_data, 1);
  I2C_Master_ReadData(0x28, pressure_data, 4);
  return *((uint32_t*)pressure_data);

This is the part of the code that is reading from the function. It is turning the raw data into pressure and temperature data.

static uint8_t Press[PRESSURE_NUM_BYTES] = {0xFFU, 0xFFU, 0xFFU, 0xFFU};
uint32_t bridge_data;
uint32_t pressure;
uint32_t temp_data;
uint32_t temperature;

case sensors:
*((uint32_t*)Press) = i2cReadHWPressureTemp(4);
bridge_data = (((uint32_t)Press[0] & ~STATUS_MASK) << 8) | (uint32_t)Press[1];
pressure = ((bridge_data - OUTPUT_MIN)*(PRESSURE_MAX_001BA - PRESSURE_MIN_001BA))/ (OUTPUT_MAX - OUTPUT_MIN) + PRESSURE_MIN_001BA;
temp_data = ((uint32_t)(Press[2]) << 8) | ((uint32_t)(Press[3] >> 5));
temperature = ((temp_data*0.0977) - 50);

SendSignedHexNumStr(pressure, 4, false);
break;

My issue is that bridge_data always comes out to be 0, which means the the list Press[PRESURE_NUM_BYTES]  is an empty list even when it is filled by the function i2cReadHWPressureTemp. I need help figuring out how to fill the list. 

I hope this is clear.

Thank you

  • Hi Anish,

    Just to clarify, have you probed your I2C lines as well to make sure everything is communicating okay? 

    Where and how are you defining pressure_data? It might be easier to pass your array pointer into the i2cReadHWPressureTemp function, and just update it directly there. 

    Best Regards,
    Brandon Fisher

  • I was able to resolve my issue. The problem was not with i2c; it was with timing. The time I set was too short to compute everything in the code I sent. The code I sent is only a snippet of a larger program. And, I did allot enough time to the sequence, which resulted in the sensors not reading and computing the raw data.

    Thank you for your help

**Attention** This is a public forum