Serial Flow Control. What's CTS RTS XOFF XON and why should you care?

Поділитися
Вставка
  • Опубліковано 28 жов 2023
  • How do you control serial besides TX and RX? That's what I try to explain in this video featuring a Raspberry Pi Zero W, a USB to Serial FTDI232 dongle and my very own 6502 Single Board Computer - the 65uino.
    Guest starring: An 8 channel logic analyzer.
    Free Discord Clubhouse: / discord
    Let's chat about what you like best about old chips, electronics, breadboards and hacking all sorts of things!
    Join this channel to get access to perks that let you see videos early and make you stand out in comments.
    / @andersnielsenaa
    Check out the whole series (playlist): • 6502 Computer
    Mentions:
    en.wikipedia.org/wiki/Flow_co...)
    en.wikipedia.org/wiki/Softwar...
    en.wikipedia.org/wiki/Data_Te...
    The device tree overlay files I used are here:
    github.com/HiassofT/AtariSIO/...
  • Наука та технологія

КОМЕНТАРІ • 16

  • @AndersNielsenAA
    @AndersNielsenAA  8 місяців тому

    Leave a comment and come say hi on Discord - I promise nobody bites: discord.gg/kmhbxAjQc3 :)

  • @GregCoonrod
    @GregCoonrod 8 місяців тому +2

    It is so cool to see this working with minimal (if annoying) changes to the Pi! Thanks for taking the time to explore this topic. I will be leaning on your work for my own 6502 SBC.

    • @AndersNielsenAA
      @AndersNielsenAA  8 місяців тому +2

      I certainly thought it was worth covering a little bit - it’s easy to overlook when you learn the RX/TX basics and don’t need flow control until much later :)

  • @derekchristenson5711
    @derekchristenson5711 5 місяців тому

    Neat! I'm often frustrated, while trying to get a serial connection (a "simple" serial connection) between two computers by how many different possibilities there are for flow control and no flow control, and the problems that arise when two computers both eschew flow control, but they still drop characters, showing that they clearly need it. It's interesting to see it implemented on your 65uino!

    • @AndersNielsenAA
      @AndersNielsenAA  5 місяців тому +1

      There's also matter of noise - doesn't take very long wires to make serial data into complete nonsense. But at least 9600 baud is rather forgiving :)

  • @GregStrike
    @GregStrike 8 місяців тому

    Hey Anders, GREAT explanation of flow control. Keep it up man!

  • @ScienceReasonLove
    @ScienceReasonLove 8 місяців тому

    For the kernel boot messages: check the kernel command line. The documentation says that the console=ttyS0 line takes flow control information from the second passed parameter. So to have ttyS0 be configured for RTS/CTS flow control at 9600 baud with no parity you’d have this: console=ttyS0,9600n0r

    • @AndersNielsenAA
      @AndersNielsenAA  8 місяців тому +1

      That part is actually in the video :) For the kernel in Raspbian though, that part doesn't seem to be compiled in, so console=ttyAMA0,4800n8r only sets 4800 baud, no parity and 8 bits ... but doesn't make it respect CTS.

  • @giova2927
    @giova2927 7 місяців тому

    Hi I would send gcode from esp32 to an old CNC could you help me? My friend said me this CTS control

    • @AndersNielsenAA
      @AndersNielsenAA  7 місяців тому

      If it's a really old CNC router you might need RS-232 (+-10V signal levels). Hard to say without knowing anything about the device :)

    • @giova2927
      @giova2927 7 місяців тому

      @@AndersNielsenAA we should talk another place. It's a sigma vc1000

    • @AndersNielsenAA
      @AndersNielsenAA  7 місяців тому

      You’re welcome to come hang out on Discord and ask in the #project-help channel - it doesn’t sound like I’ll be of much help though

    • @giova2927
      @giova2927 7 місяців тому

      @@AndersNielsenAA ok thanks I'm writing there

  • @melkiorwiseman5234
    @melkiorwiseman5234 8 місяців тому

    Short version of how RS-232C flow control is supposed to work: If XOFF/XON flow control is used, the transmitter is supposed to monitor incoming bytes and if an XOFF byte is received, the transmitter side should pause transmission and wait for an XON byte to be received before continuing sending. If CTS/RTS flow control is used, then the transmitter is supposed to check RTS before sending each byte and wait for RTS to be enabled before transmitting the byte.
    Unfortunately, the advent of very fast CPUs has caused many programmers even at the system level to just assume that the receiver can handle whatever speed has been selected and so the transmitter programs often do not implement any form of flow control. This is a very common but very poor practice and illustrates how common "lazy programming" has become.

    • @AndersNielsenAA
      @AndersNielsenAA  8 місяців тому

      Yup. But note the transmitter should check (its) CTS - not RTS.
      I hope the correct meaning came across in the video even if I misnamed RTS as CTS in the 6502 code.

    • @melkiorwiseman5234
      @melkiorwiseman5234 8 місяців тому

      @@AndersNielsenAA Yeah, I got confused. The receiver requests sending, and the transmitter checks that it's clear to send. I have to remember that.