cancel
Showing results for 
Search instead for 
Did you mean: 

Dallas iButton and UART

SGian.1
Senior

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

1 ACCEPTED SOLUTION

Accepted Solutions

@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)

 

View solution in original post

6 REPLIES 6
TDK
Guru

> 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".
SofLit
ST Employee

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.
PS: This is NOT an online support (https://ols.st.com) but a collaborative space. So please be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help/support.

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 ...


@SofLit wrote:

Not everyone here knows what is "Dallas Ibutton".


Indeed.

And they haven't been Dallas for decades now!  And correct spelling is iButton.


@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)