AnsweredAssumed Answered

Difficulty interfacing DS2482 & DS18b20  with STM32F4

Question asked by akshay bansod on Jul 6, 2018
Latest reply on Jul 12, 2018 by Bogdan Golab

Hello,

 

I am working on STM32F4 discovery board, trying to interface DS2482-100 (I2C driver ic) and DS18b20 (Temperture sensor one wire).

 

my interface is like

stm32f4 ---i2c---> DS2482-100 ----one wire----->DS18b20 

 

I am able to access the registers for  DS2482-100, but the difficulty i am facing is to access DS18b20 register through the I2C drive IC. 

I need to access DS18b20 register the Read ROM register & Read scratchpad register which contains the temperature values.

 

Some of you may find it unnecessary but i am doing this for curiosity and R&D.

 

Any help will be appreciated.

Thank you. 

 

This is how i am writing a byte to DS2482-100

void write_byte(uint8_t byte)
{
buffer[0]=0xA5; buffer[1]=byte;
HAL_I2C_Master_Transmit(&hi2c1, 0x18<<1, buffer, 2, 100);
HAL_Delay(20);
}

 

This is how i am reading a byte to DS2482-100

void read_byte()
{
buffer[0]=0x96;
HAL_I2C_Master_Transmit(&hi2c1, 0x18<<1, buffer, 1, 100);

buffer[0]=0xE1; buffer[1]=0xE1;
HAL_I2C_Master_Transmit(&hi2c1, 0x18<<1, buffer, 2, 100);

HAL_I2C_Master_Receive(&hi2c1, 0x18<<1, data, 8, 100);
HAL_Delay(20);
}

Outcomes