Max bytes in a single message through UART

Discussion in 'Embedded Systems and Microcontrollers' started by EngIntoHW, Jun 7, 2010.

  1. EngIntoHW

    Thread Starter Member

    Apr 24, 2010
    128
    0
    Hello.

    What is the largest payload that can be transferred through UART in a single message?

    Thanks.
     
  2. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    It is 8 bits for 16c550 type UARTs. In many micro controllers parity is not supported by the hardware. But they accept 9 bit in each transmission. So this bit may be implemented for something else than parity. But I would not recommend this setup if one of the units communication is a general purpose UART (or unknown).
     
  3. Papabravo

    Expert

    Feb 24, 2006
    10,137
    1,786
    In a typical UART there is no limit to the size of a message. It can be as many bytes as both sides are prepared to handle. For example RFC 1055 talks about SLIP (Serial Link Internet Protocol) aka TCP/IP over a serial port. Ethernet does have a maximum packet size in the neighborhood of 1520 bytes, but it is a synchronous protocol. A UART is asyncronous; that is a huge difference.
     
  4. BMorse

    Senior Member

    Sep 26, 2009
    2,675
    234
    If you are talking Microcontrollers, most have a 1 or 2 byte transmit and receive buffer....

    B. Morse
     
  5. Papabravo

    Expert

    Feb 24, 2006
    10,137
    1,786
    I don't understand how you can posit an equivalence between a "message" and a "buffer". In no way that I know of are they even remotely the same thing. Even TCP/IP allows for the assembly of messages over multiple packets and buffers.
     
  6. BMorse

    Senior Member

    Sep 26, 2009
    2,675
    234

    In some cases, if sending multiple packets of data without any kind of handshaking going on, you could loose data if transmit buffer is full and you try to send more with out first waiting for buffer to be emptied or have some room for more data..... same with receiving, if data is not pulled quick enough from the buffer, you could loose some data also if other device keeps transmitting data....

    here is an excerpt from the Pic16F887 datasheet:

    this is what I meant in the first post.... Plus usually you would compose a "message" in a "buffer" before you can transmit it, so IMO they are directly related....

    B. Morse
     
    Last edited: Jun 7, 2010
  7. Papabravo

    Expert

    Feb 24, 2006
    10,137
    1,786
    You're entitled to your opinion about the relative meanings of "buffer" and "message", but I think the consensus of people I've worked with over the last 45 years is that a "buffer" has a fixed deterministic size and a message does not. One message may span multiple buffers as it does in TCP/IP or there may be "n" one character messages in a circular buffer of size "n". We are speaking here of memory buffers and not a handful of hardware registers that implement a FIFO of some depth in a UART.

    In any case the OP's question had to do with the maximum size of a message, and there is no deterministic answer to that question because it depends on what the two processors that are talking want to define it as.
     
  8. GetDeviceInfo

    Senior Member

    Jun 7, 2009
    1,571
    230
    further, a 'message' is something that is produced or consumed as a whole entity. If the transmitting or recieving device cannot accept or digest the transmission as a 'whole', then you've exceeded a useful length. This is different than data streaming, where some loss may acceptable.
     
Loading...