cancel
Showing results for 
Search instead for 
Did you mean: 

DS18B20 HAL lib for STM32F0

farouk majdoub
Associate II
Posted on January 23, 2018 at 14:33

Hello,

I have been looking for a library for the ds18b20 compatible with stm32f0 and with the HAL driver but without success, so I decided to modify old one to make it compatible.

this lib uses while loop delay, the stm32f0 cannot count precisely with µs, so i calibrated value with scope to match the precise timing for DS18B20, also this lib use 2 pins for the one wire communication, one for receiving data and other for sending data.

this lib is compatible with stm32f0 and cubemMX, just put the file in a project and assign 2 pins for the 'onewire'. the delay function is already calibrated for using with 48mhz stm32f0 mcu.

don't forget to disable code optimization for the file 'DS18B20.c' 

this lib support only one device on the network and only one resolution (12bit)

i hope that this lib could help someone else ! 

any improvement will be welcome

2 REPLIES 2
Posted on January 23, 2018 at 14:55

Some time ago I implemented the 1-wire driver through UART following the MAXIM app note:

https://www.maximintegrated.com/en/app-notes/index.mvp/id/214

 

It was much easier to use UART than taking care of 1-wire timing.

Posted on January 23, 2018 at 15:11

Here is one for nucleo_l152re (32MHz) using LL driver for Visual Studio Code IDE under Linux. With examples for a single device on onewire bus and with multiple devices on the same bus. 

https://gitlab.com/funlw65/vscode_nucleo_l152re/tree/master/ll_old

And here is the presentation page:

https://nucleobytes.blogspot.ro/2017/01/the-wire-has-fever.html