UARTE spontaneous disable

Hi,

I am currently using the NRF52840 in a 2 MCU setting (2nd MCU is from STM). UART0 is connected to the PC while UART1 is connected to the second MCU for communication. I currently experience the problem that I sometimes receive a UART_RX_DISABLED event from Zephyr if the second MCU is resetted while a message is being received on the NRF52840. I can also reproduce the problem by removing the jumper for the RX pin while receiving.

When I receive the UART_RX_DISABLED event I try to reenable the UART which works, but after the reenable it seems the UART is a bit unstable since my messages then have corrupted bytes which are detected by a CRC check in my messages. The UART stays unstable until I reset the NRF52840. Resetting the second MCU does not help.

Is there a way to avoid this problem or completely reset the UART in Zephyr to recover from it?

My device tree is

uartIpc: &uart1 {
    compatible = "nordic,nrf-uarte";
    status = "okay";
    current-speed = <115200>;
    data-bits = <8>;
    stop-bits = "1";
    parity = "even";
    pinctrl-0 = <&uart1_ipc>;
    pinctrl-names = "default";
};
&pinctrl {
    uart1_ipc: uart1_ipc {
        group1 {
            psels = <NRF_PSEL(UART_TX, 0, 14)>;
            bias-pull-up;
        };
        group2 {
            psels = <NRF_PSEL(UART_RX, 0, 15)>;
            bias-pull-up;
        };
    };
};

Thank you in advance

Antek

Parents
  • When I receive the UART_RX_DISABLED event I try to reenable the UART which works, but after the reenable it seems the UART is a bit unstable since my messages then have corrupted bytes which are detected by a CRC check in my messages.

    What do you see? Do you see random bit flips, or does the CRC not add up? Are the messages shifted? (how do you determine the start and end of the UART message?)

    Best regards,

    Edvin

  • The Start of the message is a predefined character sequence followed by the length, payload and then CRC

    I tried listening on the communication line to see if the problems were a bad message from the sensor but what I saw was that the message was correctly sent but it had a faulty byte in the payload while the CRC was received correctly. I didn't see any missed characters so I assume as long as the start sequence does not contains a bad byte there wouldn't be any shifts in the received messages.

    Best Regards

    Antek

Reply
  • The Start of the message is a predefined character sequence followed by the length, payload and then CRC

    I tried listening on the communication line to see if the problems were a bad message from the sensor but what I saw was that the message was correctly sent but it had a faulty byte in the payload while the CRC was received correctly. I didn't see any missed characters so I assume as long as the start sequence does not contains a bad byte there wouldn't be any shifts in the received messages.

    Best Regards

    Antek

Children
Related