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.

HDC1080: IC application problem

Part Number: HDC1080

Tool/software:

Our company is developing a project called an alcohol chain device, with an estimated annual usage of 700k
We have selected TI's temperature and humidity sensor, model: HDC1080DMBR, DFN-6 (3x3).
Currently encountering the following issues:
HDC1080, after successful communication establishment. Only the device ID number can be read, and the temperature and humidity values cannot be read. It is empty and defaults to zero.
Please help us check what the problem is and provide a solution, thank you!

The following are schematic diagrams and software for reference

新建文本文档.txt
#include "dmm_hdc1080.h"
#include "dmm_function.h"
#include "dmm_gpio.h"
#include "dmm_systick.h"
#include "dmm_timer_module.h"
#include "math.h"
//******************************************************************************************//
#define  IIC_DELAY		50
//******************************************************************************************//
static void iic_start(void)
{
		SDA_OUT_H;	delay_us(IIC_DELAY);
		SCL_OUT_H;	delay_us(IIC_DELAY);
		SDA_OUT_L;	delay_us(IIC_DELAY);
		SCL_OUT_L;	delay_us(IIC_DELAY);
}
//******************************************************************************************//
static void iic_stop(void)
{
		SCL_OUT_L;	delay_us(IIC_DELAY);
		SDA_OUT_L;	delay_us(IIC_DELAY);
		SCL_OUT_H;	delay_us(IIC_DELAY);
		SDA_OUT_H;	delay_us(IIC_DELAY);
}
//******************************************************************************************//
static uint8 iic_wait_ack(void)
{
		uint8 ERROR_TIME=0;
		SDA_OUT_H;	delay_us(IIC_DELAY);
		SCL_OUT_H;	delay_us(IIC_DELAY);
		while(SDA_IN)
		{
				ERROR_TIME++;
				if(ERROR_TIME>250)	{iic_stop();return 1;}
		}
		SCL_OUT_L;	delay_us(IIC_DELAY);
		return 0;
}
//******************************************************************************************//
static void iic_ack(void)
{
		SCL_OUT_L;	delay_us(IIC_DELAY);
		SDA_OUT_L;	delay_us(IIC_DELAY);
		SCL_OUT_H;	delay_us(IIC_DELAY);
		SCL_OUT_L;	delay_us(IIC_DELAY);
}
//******************************************************************************************//
static void iic_no_ack(void)
{
		SCL_OUT_L;	delay_us(IIC_DELAY);
		SDA_OUT_H;	delay_us(IIC_DELAY);
		SCL_OUT_H;	delay_us(IIC_DELAY);
		SCL_OUT_L;	delay_us(IIC_DELAY);
}
//******************************************************************************************//
static void iic_send_byte(uint8 txd)
{
    uint8 t;
    SCL_OUT_L;delay_us(IIC_DELAY);
    for(t=0;t<8;t++)
    {
				if((txd&0x80)>>7)		SDA_OUT_H;
				else								SDA_OUT_L;
				txd<<=1;						delay_us(IIC_DELAY);
				SCL_OUT_H;					delay_us(IIC_DELAY);
				SCL_OUT_L;					delay_us(IIC_DELAY);
    }
}
//******************************************************************************************//
static uint8 iic_read_byte(uint8 ack)
{
    uint8 i,receive=0;
    SDA_OUT_H;delay_us(IIC_DELAY);
    for(i=0;i<8;i++ )
    {
        SCL_OUT_L;						delay_us(IIC_DELAY);
				SCL_OUT_H;						delay_us(IIC_DELAY);
				receive<<=1;
        if(SDA_IN)						receive++;
    }
    if(!ack)							iic_no_ack();
    else									iic_ack();
    return receive;
}
//******************************************************************************************//
extern void HDC1080_Write_Register(u8 Addr,u16 Data)
{
		unsigned char data[2];
		data[0] = (uint8_t)((Data& 0xFF00) >> 8); 			//¸ß°ËλÊý¾Ý
		data[1] = (uint8_t)(Data & 0x00FF); 						//µÍ°ËλÊý¾Ý
		iic_start();
		iic_send_byte(HDC1080_WRITE_ADDR);iic_wait_ack(); //µØַΪ10000000£¬Ð´¼Ä´æÆ÷
		iic_send_byte(Addr);iic_wait_ack(); //д¼Ä´æÆ÷µØÖ·
		iic_send_byte(data[0]);iic_wait_ack(); //·¢Ë͸߰ËλÊý¾Ý
		iic_send_byte(data[1]);iic_wait_ack(); //·¢Ë͵ͰËλÊý¾Ý
		iic_stop(); //Í£Ö¹ÐźÅ
}
//******************************************************************************************//
unsigned char HDC1080_Read_Register(unsigned char ReadAddr,unsigned char *buf,unsigned int length)
{	
		uint8_t i = 0;
	            
	iic_start();   									//ÆðʼÐźÅ
	iic_send_byte(HDC1080_WRITE_ADDR);			//HDC1080É豸µØÖ·(7λÉ豸µØÖ·+W/R)
	iic_wait_ack();									//²úÉúÓ¦´ð
	iic_send_byte(ReadAddr);						//¼Ä´æÆ÷µØÖ·
	iic_wait_ack();									//²úÉúÓ¦´ð
	
	iic_start();									//ÆðʼÐźÅ
	iic_send_byte(HDC1080_READ_ADDR);			    //HDC1080É豸µØÖ·(7λÉ豸µØÖ·+W/R) ¶Á
	iic_wait_ack();									//²úÉúÓ¦´ð
	for(i = 0; i < length-1; i++)
	{
		buf[i] = iic_read_byte(1);					//¶ÁÊý¾Ý
	}
	buf[i] = iic_read_byte(0);						//¶ÁÊý¾Ý
	
	iic_stop();													//Í£Ö¹ÐźŠ 
	
	return 0;
}
//******************************************************************************************//
void Read_TH_Register(unsigned char *pbuff)
{
	uint8_t length = 4, i = 0;					    //ת»»Êý¾Ý×Ö½ÚÊý
	
	iic_start();   									//ÆðʼÐźÅ
	iic_send_byte(HDC1080_WRITE_ADDR);			//HDC1080É豸µØÖ·(7λÉ豸µØÖ·+W/R)
	iic_wait_ack();									//²úÉúÓ¦´ð
	iic_send_byte(HDC1080_TEMPERATURE_ID);		//´¥·¢Ê¼þµØÖ·
	iic_wait_ack();									//²úÉúÓ¦´ð
	iic_stop();	
	
	delay_ms(50);									//µÈ´ýת»¯
	iic_start();   									//ÆðʼÐźÅ
	iic_send_byte(HDC1080_READ_ADDR);				//HDC1080É豸µØÖ·(7λÉ豸µØÖ·+W/R) ¶Á
	iic_wait_ack();									//²úÉúÓ¦´ð
	for(i = 0; i < length-1; i++)
	{
		pbuff[i] = iic_read_byte(1);				//¶ÁÊý¾Ý
	}                        
	pbuff[i] = iic_read_byte(0);                     

	iic_stop();										//Í£Ö¹ÐźŠ  
}
//******************************************************************************************//
void HDC1080_Driver_Init(void)
{
	uint8_t menufacture_buf[2] = {0}, device_buf[2] = {0};
	uint16_t menufacture_id = 0, device_id = 0;
	
	HDC1080_Read_Register(HDC1080_MENUFACTURE_ID, menufacture_buf, 2);
	menufacture_id = (uint16_t)(menufacture_buf[0]<<8);
	menufacture_id |= menufacture_buf[1];
	
	HDC1080_Read_Register(HDC1080_DEVICE_ID, device_buf, 2);
	device_id = (uint16_t)(device_buf[0]<<8);
	device_id |= device_buf[1];
	if(menufacture_id==HDC1080_MENUFACTURE_ID_VALUE&&device_id==HDC1080_DEVICE_ID_VALUE)
	{
		printf("<-----HDC1080 Á¬½Ó³É¹¦£¡----->\r\n");
	}
	else
		printf("<-----HDC1080 Á¬½Óʧ°Ü£¡----->\r\n");   
	//ÉèÖÃͬʱ²É¼¯Î¶ȺÍʪ¶È 14λ·Ö±æÂÊ   Ö»Òª·¢ËÍÒ»¸ö´¥·¢ÃüÁîÎÂʪ¶È¾Í»áÁ¬Ðø×¼»»
	HDC1080_Write_Register(HDC1080_CONFIG_ID, HDC1080_CONFIG_VALUE);  
}
//******************************************************************************************//
void Get_HDC1080_THValue(float *temp, float *humid)
{
	uint8_t buf[4] = {0};
	
	//¶ÁÎÂʪ¶È¼Ä´æÆ÷Öµ±£´æÔÚÊý×éÖÐ
	Read_TH_Register(buf);
	//ζÈת»»
	*temp = (float)(buf[0]<<8|buf[1]);
	*temp = (*temp/pow(2,16))*165-40;
	//ʪ¶Èת»»
	*humid = (float)(buf[2]<<8|buf[3]);
	*humid = (*humid/pow(2, 16))*100;
}
//******************************************************************************************//




.h

#ifndef  _DMM_DMM_HDC1080_H_
#define  _DMM_DMM_HDC1080_H_

/******************************************************************************/ 
#include "dmm_type.h"
/******************************************************************************/   
//¼Ä´æÆ÷µØÖ·
typedef enum{
	HDC1080_WRITE_ADDR = 		0x80,
	HDC1080_READ_ADDR = 		0x81,
	HDC1080_MENUFACTURE_ID = 	0xfe,
	HDC1080_DEVICE_ID = 		0xff,
	HDC1080_CONFIG_ID = 		0x02,
	HDC1080_TEMPERATURE_ID =    0x00,
	HDC1080_HUMIDITY_ID	= 		0x01,
}REGISTER_ADDR;
 
//¼Ä´æÆ÷Öµ
typedef enum
{
	HDC1080_MENUFACTURE_ID_VALUE = 	 0x5449,
	HDC1080_DEVICE_ID_VALUE = 		 0x1050,
	HDC1080_CONFIG_VALUE = 			 0x1000,		//ÎÂ¶È Êª¶Èͬʱת»» 14λ·Ö±æÂÊ
}REGISTER_VALUE;
 
void HDC1080_Driver_Init(void);
extern void HDC1080_Write_Register(u8 Addr,u16 Data);
unsigned char HDC1080_Read_Register(unsigned char ReadAddr, unsigned char *buf, unsigned int length);
void Read_TH_Register(unsigned char *pbuff);
void Get_HDC1080_THValue(float *temp, float *humid);
/******************************************************************************/

#endif






















  • Tony,

    When going through the attached code, I did not see that the configuration register was written too. You must write to the configuration register to acquire temperature and humidity.

    You should set bit 12, the MODE bit, to 1 so that both Temp and RH are acquired. Then once you do that (write 0x1000 to register 0x02), set the register to 0x0 to read temp, then set it to 0x01 to read RH.

    Regards

    -Alex Thompson

  • Why does the device ID read normally and the manufacturer ID read 0x1000
    The device ID address is 0xff, and the manufacturer ID is 0xfe, which is also correct

    The waveform is as follows. Could you please help me check where there is a problem and how to solve it?

  • Is R70 1kOhm resistor connected to HDC1080's supply? If so, this resistor should be much smaller. The device may brown-out and behave erratically. 

    The waveform shared shows the HDC1080 did not ACK its device address. This points to a connectivity issue, or even EOS damage. 

    thanks,

    ren

  • 1.This is a newly tested waveform, using a new board

    2.This is a separate module we built externally, all of which have the same code, but the waveform is different on the 8th falling edge

    Now there are a bunch of problems that I can't figure out. Please help me see how to solve these problems

  • Hello Tony, 

    I just wanted to double check, but are these problems persisting even with the previously suggested changes implemented (especially writing the configuration settings in your code)?

    Regards,

    Harry