According to Pete - Demystifying Serial Communication

Check out today's edition of "According to Pete."

Favorited Favorite 0



Comments 32 comments

  • "The gear is jacked and we need to send someone out on a horse." I now need to clean my breakfast off my monitor! Love it! Keep up the awesome work, Pete.

    • Isn't RS232 12 Volts? That's why you had to translate it for the old TTL(5V)? {now down to Pete's 3.3V ?}


    • Has anyone written any sort of a "Hackers of the Old West" type graphic novel? With all the popularity of Steam Punk in the last couple of decades, it's surprizing I've never run across something like that...

      • If you like magic in your "Hackers of the Old West" novels, look up the Mistborn series.






      Another reason to have adjusted start/stop bits, if you suspect the Rx/Tx lines are going to be affected by noise (even then you'd want to do parity).

      These are just a couple ideas, because the hardware now is running faster and faster, and requires more of the designer's attention to designing communications. People that use the Arduino code have it easy, because you just write a few lines and you got serial, but you don't know what is going in the background. What if you wanted to do check for other flags that the UART can use?


  • Nice one as usual! I'm already waiting for the I2C and CAN Bus version :)



  • Love your vidz. Please keep it up.


    With that being said, since most data "back in the day" was transmitted at very low baud rates due to the high equipment costs and bad lines (75/110/300/600/1200 baud) it was expensive in terms of throughput to add all of these stop and parity bits (essentially "throwaway" bits if the data was indeed valid) since they could consume almost 1/3rd of the total bits sent. Hence the 8/N/1 (8 bits, No parity, 1 Start bit) over good quality lines since it allowed the most information to be "packed" into the smallest number of bits sent. Just a little history there.

    As Pete asked "Why would you choose Even or Odd Parity?" I actually had several occasions where the noise on the line (back in the day) would tend to spike either "Low or High" most of the time. Choosing a parity opposite of where the noise or spikes would tend to be would help eliminate a lot of bad frames - again, showing my age.

    Noise is generally not a problem now with well-shielded wiring but remember that the protocol does not determine the method of transfer. You can use the RS-232 (485, etc) protocol through IR, Radio, Optical Fiber or anything else you can think of (with its own set of "noise" so that should give some idea about the reason for all of this parity and start/stop bit discussion.

    And one last tidbit: The "while(!Serial.available())" in the arduino is just a check against a bit to indicate a full byte has been received into the buffer.


  • Siiick! Psyched for I2C and SPI.

    UART: Demystified.

  • I have a software UART for AVRs using the ICP for Arduino and ATtiny4313 on to talk to my Valentine 1 radar detector.


    Where is the discussion of the break signal?





    To test crystals or resonators syncing, heat or freeze them.




  • Parity bits aren't used much because there's nothing to do about the error. The hardware layer isn't that useful of a spot to catch the error. These days, errors are usually detected at a higher layer, where a resend can be requested. The UART counts the 1-bits in the message, the parity bit is then used to make the total even or odd, depending on how it's set. It's not particularly good at catching errors, either. Parity was just a bad idea and that's why no one uses it any more (well, I'm sure SOMEone does).

    • The parity bit is used for checking the integrity of the data being sent/received. If the data being transmitted/received has the wrong parity, how else would you discard the data? Without the parity, you'd be getting garbage, and that could be the difference of making a robot serve a human, and not serve them for dinner.





    • buffering, most modern UARTS and a lot of micro's have an on chip buffer.
    • The 8250 and 16550, as it's simple to tell the capabilities of a device when they claim to be compatible with those chips.
    • Address driver chips. Some ( all? ) micro's have logic level UARTS and will need a driver, such as a MAX232 to comunicate with a PC, but would be fine micro to micro.
    • I've blown lots of driver chips over the years, especially 485, and you can occasionally take out a UART as well, but if the driver is doing it's job, and is opto isolated, it should be OK.
    • you didn't mention connecting RX to TX and visa versa !



  • Just a note about, you don't need to provide a variable. Just because a function returns a value, it doesn't mean you have to provide a variable to store it in.

    void setup()
      Serial.begin(9600);         // Setup serial at 9600 baud
    void loop()
      while(!Serial.available()); // Wait until data is received;              // Remove the data
      delay(5);                   // Delay 5ms


  • An engineering degree: $60k problem solving degree.

    Best way to understand USART is to understand encoding types. UART has the 8n1, but USART will have to encode more bits. From here, the master will be looking for a set of bits in a specific order, once it finds that order it knows it's got a frame to work with at a specific rate.



    • Thanks for that. Regarding the degree being $60K, work a job in electronics to help pay and educate yourself, only do 12 credits per semester, get married to somebody who's also working, and don't have kids until you're done. Oh, and make sure you're a resident of wherever you go. I eeked it out without any debt, but a lot of late nights.

  • You should allow us to download these videos. I can't watch youtube at school :(

Related Posts

Recent Posts


All Tags