TINI from Mac OS X

August 13, 2009 | 4 Minute Read

Still experimenting with the “master” portion of Ifos (the device itself being a Modbus slave), looking to replace/simplify the current communication path:

PC → USB-to-Serial (RS232) cable →
my RS232-to-RS485 converter → Ifos

(The RS232-to-RS485 converter is described elsewhere.) The great advantage of this is unlimited flexibility; I can use just about any method to send data directly to the device, then process the response in myriad ways. Ruby has been the real workhorse here, and I rely on irb and my tiny Modbus master for most of this communication and control.

Practically speaking, though, an Ethernet connection would be more user-friendly. Ifos doesn’t have one of its own because I thought that would be overkill. The slaves are supposed to be cheap and simple, and you can’t get much simpler than basic serial connections. (Well, ok. RS232 is simpler than RS485, but it can only connect two devices together, and RS422 is limited to 10.) Using a PC as the master has been fine for development, but the plan has always been to have a small, web-server-capable device provide the interface between Ifos and the rest of the world.

Enter the TINI® network microcontroller. A while ago I spent about $100 on the DS80C400 Evaluation Kit, and though I didn’t do much with it at the time, it was clear that building an Ifos master on the TINI platform would be possible. Unfortunately, I’ve since started a love affair with a new iMac, and the TINI development environment is PC-based. I had already updated the TINI firmware from the PC, but I’d really like to use the Mac going forward.

Problem 1: No drivers for my USB-to-Serial cable

Though TINI supports TCP/IP over Ethernet, its IP address and submask must be configured first. TINI has a control serial port, but the new iMac didn’t support my old RadioShack USB-to-Serial cable. Using USB Prober (Developer » Applications » Utilities » USB Prober), however, I was able to determine it used a Prolific chipset:

USB Prober output

A Google search led to an Apple support page discussing the PL2303 chip, which led to a driver project on SourceForge. I didn’t have any proof that this was the correct Prolific chip, but I took a chance and installed it anyway. Worked great!

peter@McMullen ~ $ ls -l /dev/tty.*
crw-rw-rw-  1 root  wheel    9,   4 Aug 13 20:00 /dev/tty.Bluetooth-Modem
crw-rw-rw-  1 root  wheel    9,   2 Aug 13 20:00 /dev/tty.Bluetooth-PDA-Sync
crw-rw-rw-  1 root  wheel    9,   0 Aug 13 20:00 /dev/tty.PL2303-0000201A

Problem 2: No HyperTerminal on Mac

Turns out this is a non-issue, since OS X provides an actual terminal program (Applications » Utilities » Terminal). I used screen to connect to the appropriate tty at the appropriate baud rate (TINI uses 115200 by default):

peter@McMullen ~ $ screen /dev/tty.PL2303-0000201A 115200

I powered up the TINI, and voilà!

----> TINI Boot <----
TINI OS 1.15 - Copyright (C) 1999 - 2004 Maxim Integrated Products
API Version: 9007
Crystal: 14.7396MHz x 2
POR Count: 0000000B
Running POR Code
Memory POR Routines
Transient blocks freed: 007C, size: 015784
CPersistant blocks freed: 0000, size: 000000
Memory Available: 0EF640
Creating Task:
Loading application: 470100
Creating Task:
Application load complete
[-=         slush Version 1.15        =-]
[           System coming up.           ]
[      Beginning initialization...      ]
[        Not generating log file.       ]    [Info]
[    Initializing shell commands...     ]    [Done]
[        Checking system files...       ]    [Done]
[ Initializing and parsing .startup...  ]
[        Initializing network...        ]
[     Starting up Telnet server...      ]    [Done]
[       Starting up FTP server...       ]    [Done]
[         Network configuration         ]    [Done]
[         System init routines          ]    [Done]
[    slush initialization complete.     ]
Hit any key to login.

Problem 3: TBD, but I’m sure I’ll run into something

Still, I’m happy with small successes. Next step, write a light-weight Modbus controller for TINI (or maybe just use jamod) and a REST web service to wrap it.