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.

HDC2022: The HDC2022 code example of ARM M4.

Part Number: HDC2022
Other Parts Discussed in Thread: HDC2021, HDC2080

Hi experts,

My cusotomer want to use HDC2022 to replace HTU21DF.  The using the code of HTU21DF, but they could not read any data from HDC2022..

So could you provide the code of ARM M4? Thanks!

BR,

Gordon

  • Dear Gordon - 

    Thanks for the post. 

    Here, choosing the HDC2080, HDC2021 or HDC2022 to replace the HTU20 or HTU21 is a good one, as the HDC2 devices outclass the HTU21 in every way. 

    Assuming they left pin 3 unconnected (this pin is NC for the HTU21, and is address line for the HDC2 devices) the 7-bit I2C address for either part would be 0x40, so the first thing they should check is that they are getting an ACK from the HDC2 part on their board when an addressed command is sent. 

    If that is OK, then they would look at changing the commands themselves in the code they have and deleting or commenting out commands that are specfic to the HTU21. 

    For example, in the most basic implementation -

    1. The HTU21 requires a soft reset of the device after power up, using an addressed write command of 0xFE, with a delay of 20mSec. The HDC2 devices do not need this, so that command can be removed. 

    2. The HTU21 requires that %RH and temp be read separately, using addressed write command 0xF5 (for %RH) with a delay of 40mSec, then a readback of two bytes of data, followed by an addressed write of 0xF3 (for temp) with another delay of 40mSec and a read back of two bytes of data.

    By contrast, the HDC2 family of devices only needs 3mSec after power up and they are ready to be used.

    The most basic implementation would be an addressed write to register 0x0F with a 0x01, followed by a delay of 1.5mSec and a readback of four data bytes will yield both temperature and %RH values from the part, LSByte first. See LSA captures below.

          ==>  1.5msec delay   ==> 

    The HDC2 does have an ALERT pin, which could also be used, for more advanced operations, but they may not have connected this on their board.

    Also, attached is some MCU agnostic code, from ASC Studio (Sysconfig) for the HDC2 set for address 0x40, which is default (for both HTU21 and HDC2 devices)

    HDC2.zip

    Hopefully with the instructions above and the attached code example, they can convert their design over quickly.

    Please do come back to this Forum with any more questions. 

  • Hi Josh,

    Thanks for your support.

    The customer keep the pin3 and pin4 as float state. Could the customer use HDC2.zip code directly? 

    BR,

    Gordon

  • Hi Gordon,

    The HDC2.zip file can be used with your existing setup. 

    Regards,
    Pavani Tenneti