printf is something [StorePeter] has always found super handy, and as a result he’s always been interested in tweaking the process for improvements. This kind of debugging usually has microcontrollers sending messages over a serial port, but in embedded development there isn’t always a hardware UART, or it might already be in use. His preferred method of avoiding those problems is to use a USB to Serial adapter and bit-bang the serial on the microcontroller side. It was during this process that it occurred to [StorePeter] that there was a lot of streamlining he could be doing, and thanks to serial terminal programs that support arbitrary baud rates, he’s reliably sending debug messages over serial at 5.3 Mbit/sec, or 5333333 Baud. His code is available for download from his site, and works perfectly in the Arduino IDE.
The whole thing consists of some simple, easily ported code to implement a bare minimum bit-banged serial communication. This is output only, no feedback, and timing consists of just sending bits as quickly as the CPU can handle, leaving it up to the USB Serial adapter and rest of the world to handle whatever that speed turns out to be. On a 16 MHz AVR, transmitting one bit can be done in three instructions, which comes out to about 5333333 baud or roughly 5.3 Mbit/sec. Set a terminal program to 5333333 baud, and you can get a “Hello world” in about 20 microseconds compared to 1 millisecond at 115200 baud.
He’s got additional tips on using serial print debugging as a process, and he’s done a followup where he stress-tests the reliability of a 5.3 MBit/sec serial stream from an ATMega2560 at 16 MHz in his 3D printer, and found no missed packets. That certainly covers using
printf as a debugger, so how about a method of using the debugger as printf?
What do you do when you want to rock out on your keytar without the constraints of cables and wires? You make your own wireless keytar of course! In order to get the job done, [kr1st0f] built a logic translator circuit. This allows him to transmit MIDI signals directly from a MIDI keyboard to a remote system using XBEE.
[kr1st0f] started with a MIDI keyboard that had the old style MIDI interface with a 5 pin DIN connector. Many new keyboards only have a USB interface, and that would have complicated things. The main circuit uses an optoisolator and a logic converter to get the job done. The MIDI signals are converted from the standard 5V logic to 3.3V in order to work with the XBEE.
The XBEE itself also needed to be configured in order for this circuit to work properly. MIDI signals operate at a rate of 31,250 bits per second. The XBEE, on the other hand, works by default at 9,600 bps. [kr1st0f] first had to reconfigure the XBEE to run at the MIDI bit rate. He did this by connecting to the XBEE over a Serial interface and using a series of AT commands. He also had to configure proper ID numbers into the XBEE modules. When all is said and done, his new transmitter circuit can transmit the MIDI signals wirelessly to a receiver circuit which is hooked up to a computer.
For a bottom of the barrel website like our retro edition, there’s little reason to have a fast Internet connection. Even the fastest hands in the land can barely type faster than 300 baud. The problem with low-speed connections is the overhead involved, as [Pierre] discovered when he dug out an acoustic modem from the ’80s and loaded up our retro site.
While this isn’t the first modem ever made – that’s 1960s tech – but it does operate at the same speed – 300 bits per second, or slower than you reading this sentence. [Pierre] stuck a desk phone into the modem’s cups, plugged it in to a phone line simulator, and connected to a Raspberry Pi equipped with another modem. From there, it was pretty easy to set up a terminal at 300 baud.
A serial connection isn’t a connection to the Internet, however, and at 300 baud, PPP is nearly impossible. The overhead of encapsulating packets is just that high. SLIP is a much better choice to send IP packets over a slow serial connection, but [Pierre]’s mac doesn’t include the proper tools.
[Pierre] ended up using the serial connection between his Mac and Raspi with Zterm. From there, Lynx and Bob’s your uncle.
There’s an unsurprisingly long video of [Pierre] loading up the retro site below, as well an unsurprisingly long video of speedtest.net running at 56k.
Continue reading “Hackaday Retro Edition: Hackadaying At 300 Baud”
Tired of waiting for that Arduino sketch to upload? Find yourself limited by code space? Optiboot eases both of these problems. The package is an alternative bootloader that runs at a higher baud rate (115200 versus 57600) and it takes up 1.5 KB less space than the stock version. This means your sketches can be larger without upgrading to a beefier chip and they will take less time to upload, a lot less.
This fully compatible alternative to the Arduino bootloader requires an AVR ISP programmer to burn it to the chip on your Arduino. If you have an extra AVR lying around you could use the Arduino as a programmer and then physically swap the chips.