termite - tiny tty adapter
motivation
Flow control allows for two devices to apply backpressure when receiving data.
There are two main types - software (XON/XOFF) and hardware. Within
hardware flow control, there's the more modern RTS/CTS based control, but also
the DTR/DSR based control. Linux doesn't support DTR based flow control at the
kernel level. Control is possible with certain drivers in userspace, but this
isn't compatible with lots of software like agetty.
____ __
| | <-------rx/tx------>|==|
|____| <--------DTR------- | |
/⠶⠶⠶ / ---------DSR------->|__|
Most modern PCs can easily keep up with old equipment, but they can quickly overwhelm the equipment when sending data if they don't have flow control. Even with software flow control I've seen issues since it's a longer message to send and can get stuck behind queues or processing.
I have a WY-60 terminal that I want to use, but the software flow control has issues, and without it you can only get to 9600 baud. The theoretical maximum is 38400 baud. It supports DTR based flow control, and I want a compact adapter to connect my computer. We can make our serial port work properly if we connect the PC-side CTS pin (clear to send, input) to the equipment's DTR. It uses DB25 serial, which I want on-board so I don't need a large adapter. I want USB-C since it's small and reversible.
There are currently severe tariffs on PCBs from China, so I will be using OSHpark instead. They charge by square millimeter even for tiny boards, so I want the most compact adapter possible. One advantage is that I can make the boards look sick with the After Dark service at the cost of taking much longer to manufacture.
design
This is low volume, so I splurged and went for the FTDI 230X serial adapter. No driver issues and reliable performance. For the RS232 converter, I started with the classic MAX232, but then switched to the newer MAX3232, which is available in a smaller package and can use smaller capacitors.
DB25 can be edge-mounted on 1.6mm boards. This saves board space compared to right angle or vertical mounts. It does make it stick out more than a vertical mount. My first revision used vertical mount but I couldn't find a layout that I liked. I originally bought a fancy solder-cup style connector but the cups were too rigid and it didn't fit. My replacement was actually more expensive but had proper pins instead of cups.
termite PCB layout with curved traces
bringup
I won't be getting these assembled because it would be insanely expensive. I chose the TSSOP variant for the ICs to make it less of a headache. The 0402s are small but doable in low volume like this. Depending on the long-term state of trade, I may end up building a local assembly process that is a bit more sophisticated for QFN or BGA parts.
As far as software configuration, there is a tool to assign CBUS (extra GPIO) functions or invert specific pins. We can also assign a VID/PID but this isn't needed (though I could grab one from pid.codes!). A Linux command line tool exists that is available on GitHub.
testing
There's not much to test here - I already had a setup that worked with a bunch of adapters, so I just replaced it with termite and tried it out. After a mishap with the terminal configuration everything worked on the first try. It's a simple project so it's not that impressive, but it's a nice feeling regardless.
a render of the PCB
next
This was cheap enough to make, so I have an extra. I'm not really sure what I could use it for. It has a weird mapping of DTR and CTS, so it's not super useful as a general serial adapter. It also uses DB25 which is uncommon. For now I just have it on my desk to look at.