2021-05-07 05:11 AM
I am trying to interface DS18B20 (Temperature Sensor) with STM32L072 using OneWire communication. But not able to generate proper delay.
I have reached some of the solutions but did't worked.
https://community.st.com/s/question/0D53W000003LJZsSAO/micro-sec-delay-with-stm32l0
This solution uses UART and custom HAL, that I cannot use.
Please Help If any one have better solution
2021-05-07 05:28 AM
Delay can only gurantee a minimum timing. Maximum timing can not be guaranteed if interrupts happen. Disable interrupts for the delay.
2021-05-07 06:10 AM
Using a free-running TIM to measure elapsed time should work, so perhaps other issues you need to address, like interrupts, or reducing the prescaler to improve the granularity of the count.
You'll need to evaluate "not working" into a more specific timing failure you can demonstrate/understand on a scope or logic analyzer.