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.

HDC3021-Q1: Reconfiguring Sensor to Auto Measurement Mode after ALERT on MCU

Part Number: HDC3021-Q1
I am working on a project that involves monitoring temperature and humidity levels using the HDC302x humidity sensor and an MCU. I've configured the sensor in auto measurement mode (10 measurements per second, command: 0x27 0x37), but I'm experiencing an issue with the sensor's behavior after an ALERT is issued.
Issue: When the ALERT is triggered, the sensor defaults to Trigger mode, despite being initially configured to run in auto mode. To address this, I've added a step to reconfigure the sensor to auto-measurement mode within the ISR (code snippet below). However, I'm unsure if this is the correct approach or if there's a better solution.

See sample code snippet -

// ISR
void hum_alert_isr() {
    // Read humidity and temperature values
    hdc302x_read(hdc302x_handle, hdc302x_read_bytes);

    // Extract temperature and humidity values
    hdc302x_temp_celsius = hdc302x_to_celsius(hdc302x_read_bytes[0]);
    hdc302x_relative_humidity = hdc302x_to_rh(hdc302x_read_bytes[1]);

    // Clear status
    hdc302x_read_status(hdc302x_handle);
    hdc302x_clear_status(hdc302x_handle);

    // Re-enter auto measurement mode
    hdc302x_enter_auto_meas_mode(hdc302x_handle);
}

Question: Is this the correct approach to handling the ALERT and ensuring the sensor remains in auto measurement mode? Are there any other considerations or potential issues I should be aware of?
Relevant documentation: I've consulted the HDC302x datasheet and the MCU's documentation, but I'm still unsure about the best approach.
Thank you for your time and expertise. I look forward to your guidance.
  • Hello Manish,


    Thanks for your question. I would suggest issuing a soft reset (see page 20 of datasheet) and then putting the device back into Auto Measurement Mode. This may however require you to set your Alert values again.

    Hope this works for you!

    Harry