Page 2 of 5

Re: UART not working with today's version of micropython

Posted: Thu Apr 15, 2021 11:47 am
by Tinus
Thank you very much, I will try that.

Re: UART not working with today's version of micropython

Posted: Thu Apr 15, 2021 1:46 pm
by Tinus
No that hasn't solved the problem.

I set the txBuf to 32 but the nextion still receives double digits.

when I send out json to the esp32 it does this:

{"sessionid":"0_4_1618493902","staarrttTT""::117755778844,,""eennddTT""::118855779977,,""ssttaarrttDD""::223344662222,,""eennddDD""::225500997722,,""aavvggHHRR""::00}}

so for 32 chars it works as expected and after that every character is doubled.

Re: UART not working with today's version of micropython

Posted: Thu Apr 15, 2021 2:02 pm
by Tinus
Changing the txbuf doesn't change the behaviour.

Re: UART not working with today's version of micropython

Posted: Thu Apr 15, 2021 2:11 pm
by Roberthh
I cannot replicate that behavior. I have set the UART to 9600 baud, txbuf to 32, and get the proper message, received by a USB/UART bridge:

{"sessionid":"0_4_1618493902","startT":175784,"endT":185797,"startD":234622,"endD":250972,"avgHR":0}

Which firmware version are you using? Type Ctrl-B to get it.

Edit: Looking at it with a logic analyzer shows not problems either.

Re: UART not working with today's version of micropython

Posted: Thu Apr 15, 2021 2:21 pm
by Roberthh
What happens if you set timeout_char=10?

Edit: What is the UART setting for writing to the nextion display?
Edit2: Do you use both UARTs at the same time?

Re: UART not working with today's version of micropython

Posted: Thu Apr 15, 2021 2:43 pm
by Tinus
Roberthh wrote:
Thu Apr 15, 2021 2:21 pm
What happens if you set timeout_char=10?

Edit: What is the UART setting for writing to the nextion display?
The same thing happens.

UART(1, baudrate=115200, bits=8, parity=None, stop=1, tx=4, rx=5, timeout=10, timeout_char=10, txbuf=32)

I am using this version today:
rp2-pico-20210415-unstable-v1.14-170-ga9bbf7083

(the ctrl-b thing doesn't work for me in thonny? )

Re: UART not working with today's version of micropython

Posted: Thu Apr 15, 2021 2:51 pm
by Tinus
Roberthh wrote:
Thu Apr 15, 2021 2:21 pm
Edit2: Do you use both UARTs at the same time?
Yes I do.

Re: UART not working with today's version of micropython

Posted: Thu Apr 15, 2021 2:53 pm
by Roberthh
Shouldn't it be:

UART(1, baudrate=115200, bits=8, parity=None, stop=1, tx=Pin(4), rx=Pin(5), timeout=10, timeout_char=10, txbuf=32)

Re: UART not working with today's version of micropython

Posted: Thu Apr 15, 2021 3:00 pm
by Tinus
Roberthh wrote:
Thu Apr 15, 2021 2:53 pm
Shouldn't it be:

UART(1, baudrate=115200, bits=8, parity=None, stop=1, tx=Pin(4), rx=Pin(5), timeout=10, timeout_char=10, txbuf=32)
Yes sorry, that is what happens, but it is constructed in different classes so I copy pasted some there (badly, apologies for that).

This is what it reports when I print(self.uart):

UART(1, baudrate=115200, bits=8, parity=None, stop=1, tx=4, rx=5, txbuf=32, rxbuf=256, timeout=10, timeout_char=10, invert=None)

Re: UART not working with today's version of micropython

Posted: Thu Apr 15, 2021 3:05 pm
by Roberthh
No worries. I just wanted to be sure. And the report of the UART setting could indeed reflect the way it is set.
But still I cannot replicate that, even if I send at two lines. Do you have the option to connect a logic analyzer, or just a UART/USB bridge to a PC for verification, that indeed double characters are sent.