Search code examples
stm32usart1wire

one-wire over bit banging vs. one wire over usart


I want to use a sensor with one-wire protocol, the matter is which way of using this protocol is optimized and more rational? over usart or using bit banging?

if it is important I'm using am2305 and stm32fxx microcontrollers.


Solution

  • I'm prefer to use USART+DMA with one buffer for transmit and receive. And I think this choice depends on your skill and requierements of your project.

    There many ways to implement one-wire protocol.

    • exti interrupts + timer base mode
    • timer input capture + dma
    • usart interrupts
    • usart (err interrupts only) + dma

    All of them have thier advantages and disadvantages:

    • busy or free pins
    • busy or free periferals (tim, usart)
    • busy or free dma channels
    • lower or higher frequency of interrupts in programm
    • easy or hard for implement it

    I have different projects where work first and last methods listed above.

    You must know which method is preferred for you and your project.