cancel
Showing results for 
Search instead for 
Did you mean: 

Difficulty interfacing DS2482 & DS18b20 with STM32F4

akshay bansod
Associate II
Posted on July 06, 2018 at 13:26

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);

}

#ds2482 #stm32 #stm32f4 #stm32f4-discovery #temperature-sensor #ds18b20 #12c
3 REPLIES 3
Posted on July 12, 2018 at 12:15

I guess this issue is more about integration the 1-wire device with DS2482.

I would start with to understand how the 1-Wire DS18B20 is accessible (particularly registers) through DS2482:

https://github.com/cybergibbons/DS2482_OneWire

 

I did consider the DS2482 many times in my projects but rejected it for other reasons.

My favorite solution: connect the 1-wire device to the uart as per maxim app note:

/external-link.jspa?url=https%3A%2F%2Fwww.maximintegrated.com%2Fen%2Fapp-notes%2Findex.mvp%2Fid%2F214

 

This way you can access the 1-wire device the same as you use the uart.

Here is the project in Russian:

/external-link.jspa?url=http%3A%2F%2Fwe.easyelectronics.ru%2FSTM32%2Fstm32-1-wire-dma.html

 

I made a few project using UART for the purpose of handling 1-wire thermometer e.g. DS18B20

akshay bansod
Associate II
Posted on July 12, 2018 at 12:51

Thank You

Golab.Bogdan

.

I have integrated it correctly, I am able to read & modify register following DS2482 Datasheet.

I just need to extract the One wire ROM data to my microcontroller via Ds2482. 

Searched a lot online but didn&39t got any support.

Posted on July 12, 2018 at 16:12

For me the UART-based approach was simpler (although slightly more coding involved).

Unfortunately have no Ds2482 now.