Close

Serial Communications with Badge

A project log for 2018 Hackaday Superconference Badge

Based on the Hackaday Conference in Belgrade, this badge will be a stand-alone, battery powered vintage computer packed with features

mike-szczysMike Szczys 10/16/2018 at 16:212 Comments

Badge to Badge

Remember those TI graphic calculators that had a cable to transfer programs? The badges can work in the same way.

         IMPORTANT TIP: If the receiving badge doesn't react, reset that badge (shift-reset) and try again.                                                   Sometimes this is necessary after first connecting the cables.

Computer-to-Badge

A serial-to-TTL cable will allow you to communicate between the badge and a computer. If you own one of this cables we highly recommend you bring it with you! We will have cables on hand but it will be necessary to share them so extras are great!

Wiring Diagram:

Serial Connection Info:

Linux: Simple Instructions for Transferring BASIC Programs

This quick walkthrough assumes that USB to TTL serial cable will enumerate as /dev/ttyUSB0. Look at dmesg output after plugging cable to ensure this is true.

Setup simple Linux serial connection:

Use dmesg and look for where the serial cable is mounted -- this example assumes /dev/ttyUSB0. It then sets permissions to that mounting point, sets the serial parameters to a "sane" value, and configures the port as needed. When in doubt, power cycle your badge and try again.

sudo chmod 777 /dev/ttyUSB0
stty -F /dev/ttyUSB0 sane
stty -F /dev/ttyUSB0 19200 cs8 -cstopb -parenb -opost -inlcr
stty -F /dev/ttyUSB0

Send a File to Badge

Receive a File from Badge

MacOS X

Be sure your adapter is properly installed and set up (may require downloading and installing driver) before using either of the two options below: command line vs. GUI

Option 1: Command line configuration with 'stty'

(Works with some but not all adapters on MacOS X. Notably, this doesn't appear to work with PL2303-based adapters like the one sold by Adafruit.)

MacOS X also has the 'stty' command like Linux above. However, the MacOS implementation doesn't follow the same rules on persisting settings. According to information from this page on StackExchange, the trick is to "hold" the serial port so that it retains settings yet does not return a "Resource busy" error when something else tries to use the port.

The procedure is as follows:

$ ls /dev/cu.usb*
/dev/cu.usbserial-ABCD1234
$ exec 3<>/dev/cu.usbserial-ABCD1234
$ stty -f /dev/cu.usbserial-ABCD1234 19200 cs8 -cstopb -parenb -opost -inlcr
$ cat basic.txt > /dev/cu.usbserial-ABCD1234
$ cat /dev/cu.usbserial-ABCD1234 > newbasic.txt
$ exec 3<&- 

Option 2: CoolTerm

(Works with all known adapters, but requires installing software.)

  1. Download CoolTerm for MacOS X, install, and launch.
  2. Click 'Options' to configure CoolTerm.
    1. 'Port' = the USB to serial adapter.
    2. 'Baudrate' = 19200
    3. 'Data Bits' = 8
    4. 'Parity' = N
    5. 'Stop bits' = 1
  3. Click 'Connect' to establish connection.
  4. To upload a text file: Inside "Connection" menu, select "Send Textfile..."
  5. To download, "Connection"/"Capture to Textfile"

Windows: Serial transfer

Courtesy of [Electron Plumber]:

Configure serial port (COM3)

C:\Users\user>mode COM3 BAUD=19200 PARITY=n DATA=8

 Copy file to serial port

C:\Users\user>copy basic.txt COM3
        1 file(s) copied. 

Discussions

James Newton wrote 11/08/2018 at 20:51 point

You can also use the serial connection to avoid the keyboard / screen by pressing: Lshift-Rshift-BRK. This makes the connection the serial console. Works from the main screen ONLY. E.g. you must reset (both shifts and reset) then switch (both shifts and BRK) and THEN your terminal program will work. You can do 2 and Ctrl+enter to get to CPM and it will work normally until the badge is power cycled.

  Are you sure? yes | no

Rebelbot wrote 11/03/2018 at 21:22 point

Putty on windows also seems to work for ssave but make sure to turn on implied CR for every LF.


sload is ok too.

  Are you sure? yes | no