About Uno2IEC, the Arduino 1541 emulator Wiki and HowTo

Lars Wadefalk edited this page Dec 12, 2016 · 3 revisions

Welcome to the uno2iec wiki!

The uno2iec project is a 1541 IEC interface emulator using the Arduino Uno as the direct IEC interfacing link between the CBM (C64, C128, PET, Plus4) and a regular PC. The PC may be a Windows, Linux or MAC host machine. Even the Raspberry PI can be used as the host machine, in fact the project was developed with the CBM-->Arduino-->Raspberry Pi setup. The Uno2IEC is not a true emulator in the sense emulating the CPU (6502), RAM, ROM, drive mechanics and other peripheral circuits in the 1541. It only acts on direct signals on the IEC hardware interface and simulates the protocol between the CBM and a the one used by a real 1541.

The Uno2IEC has a Qt-based host side application that manages all the mounting and file handling of the D64, T64 and M2I images towards the Arduino (It also supports .PRG and .P00/.R00/.S00 files directly placed on the PC file system including directory handling). The host application also provides configuration of the hardware setup(Arduino IEC pin configuration, COM-port, baudrate, disk image location, filters etc.), persistency and status logging feature for the Arduino.

Any harddisk, USB stick, SD card memory or network share can be used as a file serving device to the CBM. This means, you can even let the CBM stream its data directly from a network share or server in your local area network, wired or wireless! The Commodore computer still only behaves as it would talking to a regular Commodore 1541 diskdrive.

To get started on the software side, first build the Qt project on the desired platform. Then build and deploy the arduino project using the latest arduino suite to the arduino target.

Building and running the PC host side Qt Application

Open the PC/Raspberry project (.pro) file in Qt creator and build either as release or debug. For windows, move back to the projects page and untick the "Shadow build" option. This puts object and executable files in release and debug folders under the source folder.

REQUIRES: (external dependencies): QextSerialPort project: https://code.google.com/p/qextserialport/ The QextSerialPort project must be located on the same directory level as the "rpi2iec" project. Note: Now uses Qt's QSerialPort since Qt5.1.

Then launching the PC host application (either from inside Qt creator or on the command line) you should see something like this. Be aware that application deployment/distribution for a different machine that has not Qt preinstalled on a Windows box is somewhat trickier than on Linux (both static builds and dynamic builds). This, I believe is a sad Qt issue that deployment is difficult and poorly documented.

The Event Log Window

For details on what's going on for the moment, both between the CBM <--> Arduino and between Arduino <--> host have a look at the event log. Messages may not always be so descriptive here, but they should give some hint what is happening. Each message line is divided into four columns; first comes a timestamp indicating when event occurred, a facility stating the region or part of the software reporting the message (if the Arduino is the reporting part the facility is prepended with an 'R:'), a severity level (Success, Information, Warning or Error) and the specific message itself. Notice that you can save a log for later view as either HTML or plain text format. Logs can be paused and later resumed, data arriving while being paused is lost. There is a filter feature planned for implementation.

Notice here that the Arduino will echo back its PIN configuration, once connected to the host. When connection is established the host sends the device number and IEC configuration to the Arduino. To change PIN or Device configuration, the Arduino must be reset. This can be done with the Reset Arduino button in the host application.

The PC host application ready for action.

Preparing and using the Raspberry PI as a media host


Building and flashing the Arduino code.

Open up the main sketch file (uno2iec.ino) in the rpi2iec/uno2iec folder in the project. Make any optional changes in the "global_defines.h" header (if there would be any changes needed). Connect the arduino with the USB cable (make sure no other application is using / accessing the USB comport, like for instance the rpi2iec application itself ;-) ). Then just go ahead and hit the compile/program button. The code should then compile and the binary should be properly flashed to the Arduino. Everything is working OK if the Arduino 'L' LED starts flashing quite rapidly with short intervals (this means it is ready and waiting to connect to the host over the USB serial interface).

External dependencies: none Optional dependencies: Max7219 driver library for LED 8x8 matrix (modified by Lars Wadefalk into C++ class with support for progress bar indication, font display and scroller). Lars Wadefalk's Github project: https://github.com/Larswad/arduino_max7219.git To make use of the MAX7219 LED matrix features, the global define USE_LED_DISPLAY in the global_defines.h header must be enabled. The Arduino IDE with the project opened, here ready to build and deploy the uno2iec sketch: The Arduino IDE.

Constructing the IEC Cable between the Arduino and PC Host

Connect at least ATN, CLOCK, DATA and GND pin to the IEC bus on the CBM. The Reset and SRQIN (latter one is unused on the C64) are optional to wire. I used an old floppy ribbon cable and stripped off unneeded wires. The I used breadboard jumper cables to fit the ardunio. Sadly enough I used the wrong gender on the breadboard wires so I made a little ugly solution with soldering some breakaway headers where I could connect the jumper wires.

Note 1: You can use whatever digital pins you want on the Arduino side. But gpio pin 13 is occupied by the 'L' LED on the Arduino (at least on the UNO). The sketch uses this pin for life sign indication when the Arduino is powered on and waiting for connection. If pin 13 absolutely must be used, then comment out the code for handling the flashing of the ledPort in the uno2iec.ino sketch.

Note 2: This project was developed for and tested on the Uno. It should work on other Arduino models as well, but there are some small details to consider. First, the system must use 5V TTL logics since the Commodore machines use TTL. If it is not (like the Arduino Due) you will need a level shifter to convert between the two different voltage domains. There are cheap ones at dx.com (if you have the time to wait that is). The flash space used for the moment of writing is between 30-40 % on the Uno. An Arduno with less flash (and/or RAM) may run into trouble.

The arduino IEC cable. Blue is GND.

In the picture below the cable is connected the blue pin is the ground. The arduino IEC cable connected. Blue is GND.

Connecting the MAX 7219 LED matrix


The LED matrix indicating Arduino is waiting for host to connect with an 'R' as in Reset: The LED matrix indicating Arduino is waiting.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.