2024-08-14 09:26 AM - edited 2024-08-14 09:54 AM
I am trying to use the DS18B20 temp sensor on a stm32h7 board to display the current temperature using putty, and if the temp is higher than 45 degrees celsius to display a heat warning, but for whatever reason the sensor is not beign registered.
I have connected the vdd cable to the 5v pin and the data cable to the A2 pin, I have configured the A2 pin as Output Open Drain with pull-up and I think that the sensor is not being registered.
I have attached my code so far
I followed a lot with this tutorial: https://controllerstech.com/ds18b20-and-stm32/#google_vignette
So I think I got the delays correct but I am not entirely sure
Any help would be really appreciated
2024-08-14 11:12 AM
Welcome @smakivic, to the community!
you should check your main.c again. I've already found a few strange things when quickly looking over it:
Have you also verified the waveform on the bi-directional pin using a scope?
Which compiler are you using?
Which compiler optimisation have you set?
Regards
/Peter
2024-08-15 03:04 AM
Tutorials aside, people should read datasheets.
In the sensor's DS, I only see a 4k7 pull-up in each schematic.
Compare that to the STM's pull-up, so no surprise here.
2024-08-15 04:14 AM
Im pretty sure that the compiler is arm-none-eabi-gcc and the optimisation is None (-O0)