Skip to main content
SGian.1
Associate III
December 22, 2024
Solved

Dallas iButton and UART

  • December 22, 2024
  • 3 replies
  • 2460 views

Hi there!

i start to work with Dallas Ibutton and for my project i use STM32G031K8 nucleo. Because i need to read only one ibutton i use the UART peripheral and no ic dedicate for 1Wire. My problem is when i try to  use the rx callback function for know when i receive all data (and i start wit  receive one bit at the time) never shoot, If i put a simple delay of 1ms everythingh wor very well i can see all my data on my logic analyzer .Question because the nucleo use the second uart2 for debug is possible that give me the problem ? and if yes how can i resolve ?

Thank you soo much 

Sergio

Best answer by Andrew Neil

@SGian.1 wrote:

If i put a simple delay of 1ms everything wor very well i can see all my data on my logic analyzer 


The AD article does say:

A delay may need to be added between the UART bytes being transmitted to allow for the required recovery time (TREC)

https://www.analog.com/en/resources/technical-articles/using-a-uart-to-implement-a-1wire-bus-master.html#:~:text=A%20delay%20may%20need%20to%20be%20added%20between%20the%20UART%20bytes%20being%20transmitted%20to%20allow%20for%20the%20required%20recovery%20time%20(TREC)

 

3 replies

TDK
Super User
December 23, 2024

> Question because the nucleo use the second uart2 for debug is possible that give me the problem ?

No, if you're not using USART2 in your code, it won't affect your program. Doesn't matter that it's hooked up to the ST-Link chip.

 

"If you feel a post has answered your question, please click ""Accept as Solution""."
mƎALLEm
Technical Moderator
December 23, 2024

Hello,

Not everyone here knows what "Dallas Ibutton" is. So, when you formulate a request please think about others that need the have a clear a picture of your issue/request.

https://community.st.com/t5/community-guidelines/how-to-write-your-question-to-maximize-your-chances-to-find-a/ta-p/575228

 

"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."
SGian.1
SGian.1Author
Associate III
December 23, 2024
Andrew Neil
Super User
December 23, 2024

More specifically, you're talking about hacking 1-WireTM comms on a UART:

https://www.analog.com/en/resources/technical-articles/using-a-uart-to-implement-a-1wire-bus-master.html

 

But, to understand what's going wrong with your implementation, you're going to have to give a lot more detail!

  • Schematic of your connection
  • Your code

See: https://community.st.com/t5/community-guidelines/how-to-write-your-question-to-maximize-your-chances-to-find-a/ta-p/575228

 


@SGian.1 wrote:

My problem is when i try to  use the rx callback function for know when i receive all data (and i start with  receive one bit at the time) never shoot


Before getting into 1-WireTM, have you got this working well on a "normal" serial connection to a terminal (or whatever)?

 


@SGian.1 wrote:

If i put a simple delay of 1ms everything work very well i can see all my data on my logic analyzer


So look carefully at your LA traces with & without that delay.

Compare & Contrast.

Does the non-working case comply with the 1-WireTM specifications?

As well as a LA, you should also check with an oscilloscope - that the analogue behaviour is correct ...

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Andrew Neil
Andrew NeilBest answer
Super User
December 23, 2024

@SGian.1 wrote:

If i put a simple delay of 1ms everything wor very well i can see all my data on my logic analyzer 


The AD article does say:

A delay may need to be added between the UART bytes being transmitted to allow for the required recovery time (TREC)

https://www.analog.com/en/resources/technical-articles/using-a-uart-to-implement-a-1wire-bus-master.html#:~:text=A%20delay%20may%20need%20to%20be%20added%20between%20the%20UART%20bytes%20being%20transmitted%20to%20allow%20for%20the%20required%20recovery%20time%20(TREC)

 

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.