home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Commodore Free 7
/
Commodore_Free_Issue_07_2007_Commodore_Computer_Club.d64
/
t.xu1541
< prev
Wrap
Text File
|
2023-02-26
|
12KB
|
368 lines
uXU1541
The xu1541 is the modern way to connect
CBM IEC bus devices to todays USB
equipped PCs & it is meant to replace
the printer port solutions based on the
so-called original x1541 cable. The
xu1541 interface allows you e.g. to
attach a VC1541 disk drive to your
desktop PC as depicted below. This
allows for easy transfer of disk images
from and to the old units & helps you
preserve your ancient data. The xu1541
is a proprietary interface. It does not
transform the vc1541 into a standard
USB mass storage compliant device.
Instead it provides a means to send low
level IEC commands forth & back via the
USB. PC software developed to support
this interface may then directly access
the disk drive & the contents of a disk
inserted. It should also be possible to
access other IEC devices like printers.
Currently e.g. the CVS version of the
open cbm software supports this
interface.
Intended audience
Project is still under development.
It works with my own 1541-II & my
SX-64's internal floppy drive. As a PC
only two machines have so far been used
which are my Sony Vaio TX3 notebook &
my XCube barebone based desktop. First
tests by other people have shown that
there's still work to be done e.g. none
of the 157X drives currently works. And
there's also a problem with an old
Pentium based Laptop computer.
At least the 157X part should be
fixable in software, although I don't
own a 157X myself. So I currently
recommend this for people who are
willing to cope with glitches & will
perhaps even do some testing & bug
hunting. We hope to have a end-user-
proven version, soon. Stay tuned!
Design goals
The xu1541 was designed to be made of
easily obtained parts, easy to assemble
& cheap. In order to avoid having to
write all the necessary PC software the
xu1541 was designed to easily integrate
into existing software developed for
the original x1541 parallel cable
family. The xu1541 is not meant to be
the all-in-one cable. It is meant to
connect the PC to CBM IEC serial
periphery like the vc1541 floppy disk
drive. It cannot act as CBM IEC client
& can thus not be used to emulate a
floppy disk drive with the PC. Further-
more it does not support the so-called
nibbler, meaning that the cable cannot
be used to transfer copy protected disk
images from & to the 1541. These limit-
ations are due to the simplicity of the
design. A CBM IEC floppy emulation
requires an interface to respond faster
to incoming requests from the C64 than
the xu1541 currently can do with the
software USB implementation. Nibbler
support requires a 8 kilobytes (one
1541 disk track) buffer which exceeds
the 1 kilobyte RAM present in the
Atmega8 used on the xu1541. These
options are left for future & more
complex & more expensive USB to IEC
solutions. The xu1541 is fully
compatible with all tools delivered
with the opencbm package. It therefore
fully supports e.g. the tools cbmctrl,
cbmcopy, cbmformat & d64copy. It allows
to control the disk drive (e.g. read
the drive status or the directory),
it allows to format a disk, to copy
single files from & to the disk, & to
copy entire not-copy-protected disk
images (d64 images). The xu1541 was
developed on & for a Linux PC & the
cbm4linux toolset, the linux version
and predecessor of opencbm. But the
xu1541 has also been designed to work
with Windows/cbm4win as well as a port
of opencbm to MacOS (cbm4mac) is being
planned & should finally be able to
bring cheap & simple c64 file transfer
to the MacOS platform.
Implementation
The xu1541 is based on some other
projects. These are: lcd2usb, a project
of mine which i have based the first
xu1541 prototype on, opencbm, formerly
cbm4linux, a framework for accessing
the CBM IEC bus under linux & windows,
cbm4win, the windows incarnation of
opencbm, AVR USB, a great software
implementation for the AVR, usbtiny,
another software USB implementation for
the AVR, AVRUSBBoot, a USB boot loader
for the AVR, libusb, a user space USB
interface library, & libusb-win32, the
windows port of the libusb.
The firmware of the xu1541 device is
based on the software USB solutions
for the AVR cpu. It also includes parts
of the source code from opencbm, namely
parts of the linux kernel driver for
the x1541 cable family. This includes
generic CBM IEC routines following the
communication style of the stock c64 as
well as the special "speeder" modes
supported by opencbm.
On the PC side the opencbm framework
has been updated to be able to redirect
the IEC communication via USB. It now
uses the libusb to access the USB based
xu1541. Other software intended to make
use of the xu1541 cable thus needs
libusb support as well. This e.g. means
that very old DOS programs like Star
Commander cannot easily be updated to
support the xu1541 since there's no USB
support for DOS. On the other hand the
platforms that lack a printer port
driver for the old x1541 cable family
but have libusb support can be equipped
with the xu1541. This is e.g. true for
MacOS X, Solaris & some freeBSD
platforms which weren't able to support
the x1541 printer port cable family &
weren't supported by opencbm so far.
CBM IEC support
The current xu1541 can act as a CBM IEC
master only. This means that it can
play the role of a C64 & control a
floppy disk or printer. It can not be
connected to a C64 in order to act as a
virtual disk drive. This is due to the
fact that the software USB solution
used in this project prevents the AVR
from being able to react fast enough on
incoming requests (the USB stack
requires that no other hardware
interrupts are being used). This very
interesting application is left for the
successor of the xu1541.
In order to support the CBM IEC
protocol at a reasonable speed, some
aspects of the protocol are handled
inside the xu1541 itself. The downside
of such an approach is that "speeder"
support has also to be hardcoded into
the firmware of the xu1541. The speeder
support routines present in the current
xu1541 version are the "serial1",
"serial2" & "pp" (d64copy & cbmcopy
versions) routines from the opencbm
package. The latest version of the
xu1541 firmware package includes a boot
loader to ease the implementation of
new speeder routines & to help the
xu1541 to keep pace with the ongoing
development of opencbm.
The xu1541 also allows to control each
IEC control line seperately over the
USB. This approach is only recommended
for low performance things like device
initialization etc. Using this approach
causes a seperate USB transfer to take
place for every single change of one of
the IEC lines resulting in several USB
transfers for every single bit to be
tranferred. This is possible but
nowhere near fast. This approach is
therefore only being used during device
initialization right before the
accelerated "speeder" modes are being
used. The data transfer phase itself
then uses the specialized predefined
byte transfer routines mentioned
before. This entire approach has the
advantage of moving only the timing
critical byte transfer routines into
the xu1541 itself & thus reducing the
probability of having to change these
functions in the firmware once bugs in
the current speeder protocol
implementations are found.
Host support
Since the xu1541 implements a
proprietary USB-to-CBM-IEC protocol
only host software aware of the xu1541
is able to make use of the interface.
The xu1541 cable is supported by the
following host software:
CVS version of opencbm
opencbm version 0.4.0 needs a patch
(this patch is quite old, buggy & for
reference only, use the CVS version
instead)
The hardware
The hardware is designed to be as
simple as possible. It therefore
consists of through-hole components
only. Additionally all components are
cheap (less than EUR 5 total) & easily
available e.g. from Reichelt. The
entire device is powered from USB &
doesn't need an additional power
supply.
Version 1.0 of the xu1541 incl. its
adaptor for firmware upload The xu1541
includes two IEC connectors (X2 & X3).
Both are connected in parallel & can
be used at the same time. The parallel
port connector SV1 can be used to
connect one of those parallel speeder
cables that once were a popular way to
speed up the slow 1541 in these ancient
days.
Version 1.1 of the PCB allows for two
popular types of the DIN 6 sockets.
The version sold bei Reichelt (see part
list below) fits as well as the
Hirschmann connector.
The parts:
Part Qty Name Reichelt Part No.
Q1 1 12Mhz crystal, HC49U package
12-HC49U-S
R1 1 1.5k ohm resistor 1/4W 1,5k
R2, R3 2 68 ohm resistor 1/4W 68
R4 1 220 ohm resistor 1/4W 220
R5, R6, R7 3 10 ohm resistor 1/4W 10
C1, C2 2 22pF ceramic capacitor,
2.54mm KERKO 22P
C3, C5 2 100nF capacitor, 5.08mm
Z5U-5 100N
C6 1 10F electrolytic capacitor RAD
10/35
SV1 1 20 pin parallel connector WSL
20G
SV2 1 10 pin ISP connector WSL 10G
X1 1 USB-B print connector USB BW
X2, X3 2 6 pin DIN sockets MABP 6
LED1 1 LED 3mm yellow LED 3MM GE
IC1 1 Atmega8-16 DIP ATMEGA 8-16 DIP
-- 1 socket for IC1 GS 28P-S
D1, D2 2 3.6V zener diode ZD 3,6
Firmware upload
The AVR CPU of the xu1541 requires a
firmware to be installed in order to
make it work. If no boot loader is
installed on the xu1541, a special
download cable/interface connected to
connector SV2 is required to download
either the firmware or the boot loader.
Various download solutions exist from
the simple STK200 compatible interface
to devices like the stk500, the
AVR-Doper, or the AVR Dragon.
Once such a cable is connected, the
firmware is uploaded from a PC using
programmer software like uisp (linux),
avrdude (windows, macos & linux)
or Ponyprog (linux & windows). The
Makefile in the firmware archive is
prepared to support the stk200
compatible adapter using avrdude
under linux. To use it just enter "make
program". This should also work under
Windows. The command required to
manually flash the firmware
(firmware-xxxx.hex in this example)
using the stk200 compatible adaptor is:
avrdude -c stk200 -p atmega8 -U
lfuse:w:0x9f:m -U hfuse:w:0xc9:m -U
flash:w:firmware-avrusb.hex
or
avrdude -c stk200 -p atmega8 -U
lfuse:w:0x9f:m -U hfuse:w:0xc9:m -U
flash:w:firmware-usbtiny.hex
Two versions of the firmware (and the
boot loader) exist. Both provide the
same functionality but are based on
different AVR usb implementations. It
shouldn't make a difference which
version you use. But if you encounter
problems it may be worth giving the
other version a try. Please report such
incompatibilities.
Using the boot loader
The xu1541 includes an optional boot
loader. This boot loader has to be
installed once using the methods
explained above. The command required
to flash the boot loader
(bootldr-xxxx.hex in this example)
using the stk200 compatible adaptor is:
avrdude -c stk200 -p atmega8 -U
lfuse:w:0x9f:m -U hfuse:w:0xc8:m -U
flash:w:bootldr-avrusb.hex
or
avrdude -c stk200 -p atmega8 -U
lfuse:w:0x9f:m -U hfuse:w:0xc8:m -U
flash:w:bootldr-usbtiny.hex
Please notice the different fuse
settings which are due to the fact that
the boot loader is being installed &
run in a seperate memory section than
the firmware. Once the boot loader is
installed, it can be used to easily
install the firmware itself via USB. In
order to install the firmware on a boot
loader equipped xu1541 the following
steps are required:
Unplug the xu1541
Place a jumper switch between pin 9 &
10 of the 10 pin header (SV2)
Plug device in, the LED should go on
and stay on (the boot loader is active)
Use upload tool with latest firmware:
./xu1541_update ../firmware/firmware-
xxxx.hex
Unplug device
Remove the jumper switch
Plug the device into the USB, the LED
should flash a fraction of a second
(the firmware is active)
Use the device as usual
Downloads
Till Harbaum-Impressum
http://www.harbaum.org/till
http://www.harbaum.org/till/xu1541/in
dex.shtml