Skip to main content
Associate
February 6, 2026
Solved

One wire interface fr STM32G474MBT6

  • February 6, 2026
  • 5 replies
  • 301 views

I want to interface STM32G474 MCU with DS18B20 digital temperature probe in my project. The DS18B20 uses one-wire interface. Is one wire interface supported with this MCU? 

 

Kindly provide a detailed explanation. Help please.

 

Datasheet link for DS1B20: EVVO DS18B20Axx

 

Regards,
Sreejith

Best answer by Andrew Neil

@sreejithrnair2026 wrote:

 do not have any UARTs free and all the UARTs are occupied. 


You can take a similar approach to synthesising 1-Wire using SPI ...

See:

https://community.st.com/t5/stm32-mcus-embedded-software/ds2431-read-rom-returns-0x00-on-stm32f446re/m-p/845399/highlight/true#M68752

 

Note also that Analog Devices (who are now the manufacturers, since they acquired Maxim) have various bridge chips to connect 1-Wire to more widely supported interfaces; eg, I2C:

https://www.analog.com/en/products/ds2482-100.html

 

 

5 replies

mƎALLEm
Technical Moderator
February 6, 2026

Hello @sreejithrnair2026 and welcome to the ST community,

The protocol used by this sensor is not supported natively by the MCU. You need to use GPIO and may be a timer to communicate with a such sensor.

"To give better visibility on the answered topics, please click on ""Accept as Solution"" on the reply which solved your issue or answered your question."
Uwe Bonnes
Chief
February 6, 2026

You can easily implement one-wire with an uart. Uart Feature of G4 like logic inversion, open drain  and half duplex  mode  allows implementation with one pullup.

mƎALLEm
Technical Moderator
February 6, 2026

And it seems others already implemented that:

Example: https://github.com/nimaltd/ds18b20/tree/master

"To give better visibility on the answered topics, please click on ""Accept as Solution"" on the reply which solved your issue or answered your question."
Associate
February 9, 2026

Thanks for sharing the implemented code. In my case, I do not have any UARTs free and all the UARTs are occupied. So, I can only use the option of bit banging for 1 wire interface.

Uwe Bonnes
Chief
February 9, 2026

Try to use the timer so you have constant timing. GPIO bitbanging will easily be disturbed by other interrupts...

mƎALLEm
Technical Moderator
February 9, 2026

@sreejithrnair2026 ,

If your question has been answered, please accept as solution the post that has answered it.

 

"To give better visibility on the answered topics, please click on ""Accept as Solution"" on the reply which solved your issue or answered your question."