This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Can't receive complete XBee signal from UART

Hi all, 

I am having a problem receiving the whole signal from an XBee via UART. I have a master slave configuration with 3 MCUs, each one with an XBee. I can send a signal from the master to the slaves. The problem is receiving. A signal from an XBee using DigiMesh protocol is at least 18 bytes long. Using UARTCharGet I can only receive up to 16 bytes. Is there a way for the MCU to receive more than 16 bytes at a time? Is there a way to extend the buffer size of the UART or somehow divide the signal in two and then concatenate it?

-Bryan

  • Hello Bryan,

    When the data arrives in the FIFO of the UART, you must read it out so that the FIFO can receive additional characters. Physically the FIFO is 16 bytes deep and cannot be changed. Buffer management must be handled in software.

    Regards
    Amit
  • Implied - but not expressly stated in the above - you must "empty or at minimum (somewhat) drain" that UART FIFO - prior to the arrival of UART character # 17.

    Mechanisms exist w/in the UART which signal certain FIFO "levels" - its your job to read/review - then experiment to determine which best suits your unique application...    Waiting for the FIFO to completely "fill" requires your (empty or drain) prior to character # 17's arrival - to overcome your issue...

    The alternative is to limit your source transmission size - so that the MCU's FIFO never is, "over-challenged."

  • How do I empty or drain the FIFO?
  • Bryan Mitchell89 said:
    Using UARTCharGet I can only receive up to 16 bytes

    Does not that statement - your initial post - describe how you'd, "empty and/or drain" the UART's FIFO?

    Yet - if you do that after the 17th char. w/in the serial byte stream arrives - you'll miss chars.

    My mention of the UART's "signaling" of its current char "inventory" should have given you a good clue - as should the direction to better read/review the UART section - nicely detailed w/in the MCU manual...

    As always - experimentation does much to extend - and then likely, "cement" your understanding.   (silver platter delivery - not so much...)