How to send a "break" condition to the UART of a RN2483

Posted on
  • In a project with focus on low power consumption I use an Espruino Pico and a Microchip RN2483 for LoRaWAN communication.

    I send the RN2483 to sleep with a command, and to wake it up from sleep I need to send a "break" condition to the UART and send a 0x55 character for auto-baud detection.
    https://www.microchip.com/forums/m930725.aspx

    I can use Serial1.unset() followed by pulling down TX from some time, then again Serial1.setup(...) and send the 0x55 character.

    My issue is that I use the AT command handler wrapped around the Serial1, and doing this break-condition stuff on the Serial1 causes garbage characters piled up in the AT command handler, disturbing future use of this command handler.

    Is there an elegant solution to that?
    Maybe a command to "clean" the AT command handler?
    I cannot re-instantiate the AT command handler, because it consumes too much memory if you do it periodically.

    Yes, I can send a dummy command to the RN2483's UART and just deal with the fact that it will return an error due to the piled up garbage characters, but that doesn't seam elegant to me. There has to be a more attractive solution :)

  • Ahh, forget about it. Just sending \r\n on the AT command handler and ignore the returned result works okay for me. Sorry for this post. I tried to delete it, but could not find this feature.

  • Sat 2020.09.19

    Actually @wklenk, this post contains the condition others may encounter with UART comm, along with your discovery. It is good information.

  • Thanks, that's handy to know though.

    Some other potential ideas:

    • You could just poke the data straight into Serial1 without having to get the RN2483 involved - I think just Serial1.emit('data','\r\n') should sort it.
    • Serial ports can forward framing errors to the code if configured to do so: http://www.espruino.com/Reference#l_Serial_setup - not sure of that helps you (I can't remember if adding framing errors stops the extra characters from being reported)
  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

How to send a "break" condition to the UART of a RN2483

Posted by Avatar for wklenk @wklenk

Actions