Uart multiplying messages when configuration is changed #12231
Replies: 10 comments
-
You did not mention the board. Is it a ESP32? |
Beta Was this translation helpful? Give feedback.
-
What do you get at the other pin's you have chose for output. You might get the same. To stop the output at a TX pins and to resolve a possible conflict at the input pins, you have to disable the rx, tx pins switching input and output to another pin pair. Just declare them as GPIO input (rx) and output(tx) pins using machine.Pin. Set the tx to high. |
Beta Was this translation helpful? Give feedback.
-
Sorry, the board is generic esp32 like this one |
Beta Was this translation helpful? Give feedback.
-
Thanks for the quick response,
I get the same, yes. Its sending all the messages to all devices
I will try that and post my result here. |
Beta Was this translation helpful? Give feedback.
-
wow, this worked. May I ask what was happening? To my understanding, only the hardware UARTs have the capacity to save message. Where are the messages being saved after I deinit the uart? |
Beta Was this translation helpful? Give feedback.
-
The UARt does not store any messages. It's more simple. The ESP32 has an internal kind of switchboard, which connects the signals of modules like UART or GPIO to the pins of the chip. You can connect e.g. the UART tx signal to several pins. That happens here. Connecting tx to pin 17 does not remove the previously made connection to pin 15. That is done by connection Pin15 to GPIO. |
Beta Was this translation helpful? Give feedback.
-
Thanks, very clear. For the ones ending here in the future, I end up with something like this:
|
Beta Was this translation helpful? Give feedback.
-
Do not forget to detach the rx pin. While it seems fine to connect UART TX to several pins, connection RX to several pins leads to an undefined state, where several external outputs are connected together. |
Beta Was this translation helpful? Give feedback.
-
Something like this?
|
Beta Was this translation helpful? Give feedback.
-
Pin(tx, Pin.OUT, value=1)
Pin(rx, Pin.IN) Otherwise the output of the ESP32 would drive against the output of the connected serial device. And value=1 ensures, that the connected RX does not see a |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Uart sending previously sended messages when running
init()
with another rx-tx configuration. Minimal example:I expect that if I connect something to the uart 1, I should revieve something like:
But instead I see:
I also try to flush, deinit and redefine the uart each time, but got the same problem. So it seems a bug in the micropython uart implementation.
I could work on it if someone points me in the right direction.
Thanks,
Beta Was this translation helpful? Give feedback.
All reactions