Copyright © https://mongoose-os.com

Mongoose OS Forum

frame

UART.read strange output

Hello.
I am seeing a strange behavior when i use UART.read, maybe I am missing something here but I do not get the result that I am supposed to get.

Here is the simple code I use now during debug for reading the data that is sent to UART.

UART.setDispatcher(uartNo, function(uartNo, ud) {
  let ra = UART.readAvail(uartNo);
  if ( ra > 0 ) { // read buffer not empty
    data = UART.read(uartNo);
    print("Received UART data:", data);
  }
}, null);

And here is the output from the print.
Received UART data: \xa0\x9f\x81\x81
Received UART data: \xd0
Received UART data: \xb3
Received UART data: \x82
Received UART data: \xa7
Received UART data: \xaa
Received UART data: \x86

But the thing is that the output is not what is actually being sent from this output it looks like the response from the UART is this
0xA0 0x9F 0x81 0x81 0xD0 0xB3 0x82 0xA7 0xAA 0x86

But when i connect my logic Analyser on the same pin just to verify the data then I see the correct data.

What do you think about this?

Comments

  • rojerrojer Dublin, Ireland
    edited July 11

    wrong bitrate, perhaps?
    which platform are you using?

  • Hello.
    I am running this on an ESP32.

    The bitrate is correct because I also send data from the ESP32 before i receive the response, and with the help of my logic analyser then i know that the ESP32 is sending the correct data (I have also verified that data with my analyser).

    Here is the config that i use for my UART

    UART.setConfig(uartNo, {
    baudRate: 1200,
    numStopBits: 2,
    esp32: {
    gpio: {
    rx: 13,
    tx: 14,
    },
    },
    });
  • Anyone have any idea what is causing this issue with mongoose-os?
    I have now tried the exact same hardware and pins with other software and it is working as it should.

Sign In or Register to comment.