AnsweredAssumed Answered

DS18B20 HAL lib for STM32F0

Question asked by farouk majdoub on Jan 23, 2018
Latest reply on Jan 23, 2018 by Vasile Guta_Ciucur



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