home *** CD-ROM | disk | FTP | other *** search
/ Commodore Free 7 / Commodore_Free_Issue_07_2007_Commodore_Computer_Club.d64 / t.xu1541 < prev   
Text File  |  2023-02-26  |  12KB  |  368 lines

  1. uXU1541
  2.  
  3. The xu1541 is the modern way to connect
  4. CBM IEC bus devices to todays USB
  5. equipped PCs & it is meant to replace
  6. the printer port solutions based on the
  7. so-called original x1541 cable. The
  8. xu1541 interface allows you e.g. to
  9. attach a VC1541 disk drive to your
  10. desktop PC as depicted below. This
  11. allows for easy transfer of disk images
  12. from and to the old units & helps you
  13. preserve your ancient data. The xu1541
  14. is a proprietary interface. It does not
  15. transform the vc1541 into a standard
  16. USB mass storage compliant device.
  17. Instead it provides a means to send low
  18. level IEC commands forth & back via the
  19. USB. PC software developed to support
  20. this interface may then directly access
  21. the disk drive & the contents of a disk
  22. inserted. It should also be possible to
  23. access other IEC devices like printers.
  24. Currently e.g. the CVS version of the
  25. open cbm software supports this
  26. interface.
  27.  
  28. Intended audience
  29. Project is still under development.
  30. It works with my own 1541-II & my
  31. SX-64's internal floppy drive. As a PC
  32. only two machines have so far been used
  33. which are my Sony Vaio TX3 notebook &
  34. my XCube barebone based desktop. First
  35. tests by other people have shown that
  36. there's still work to be done e.g. none
  37. of the 157X drives currently works. And
  38. there's also a problem with an old
  39. Pentium based Laptop computer.
  40.  
  41. At least the 157X part should be
  42. fixable in software, although I don't
  43. own a 157X myself. So I currently
  44. recommend this for people who are
  45. willing to cope with glitches & will
  46. perhaps even do some testing & bug
  47. hunting. We hope to have a end-user-
  48. proven version, soon. Stay tuned!
  49.  
  50. Design goals
  51. The xu1541 was designed to be made of
  52. easily obtained parts, easy to assemble
  53. & cheap. In order to avoid having to
  54. write all the necessary PC software the
  55. xu1541 was designed to easily integrate
  56. into existing software developed for
  57. the original x1541 parallel cable
  58. family. The xu1541 is not meant to be
  59. the all-in-one cable. It is meant to
  60. connect the PC to CBM IEC serial
  61. periphery like the vc1541 floppy disk
  62. drive. It cannot act as CBM IEC client
  63. & can thus not be used to emulate a
  64. floppy disk drive with the PC. Further-
  65. more it does not support the so-called
  66. nibbler, meaning that the cable cannot
  67. be used to transfer copy protected disk
  68. images from & to the 1541. These limit-
  69. ations are due to the simplicity of the
  70. design. A CBM IEC floppy emulation
  71. requires an interface to respond faster
  72. to incoming requests from the C64 than
  73. the xu1541 currently can do with the
  74. software USB implementation. Nibbler
  75. support requires a 8 kilobytes (one
  76. 1541 disk track) buffer which exceeds
  77. the 1 kilobyte RAM present in the
  78. Atmega8 used on the xu1541. These
  79. options are left for future & more
  80. complex & more expensive USB to IEC
  81. solutions. The xu1541 is fully
  82. compatible with all tools delivered
  83. with the opencbm package. It therefore
  84. fully supports  e.g. the tools cbmctrl,
  85. cbmcopy, cbmformat & d64copy. It allows
  86. to control the disk drive (e.g. read
  87. the drive status or the directory),
  88. it allows to format a disk, to copy
  89. single files from & to the disk, & to
  90. copy entire not-copy-protected disk
  91. images (d64 images). The xu1541 was
  92. developed on & for a Linux PC & the
  93. cbm4linux toolset, the linux version
  94. and predecessor of opencbm. But the
  95. xu1541 has also been designed to work
  96. with Windows/cbm4win as well as a port
  97. of opencbm to MacOS (cbm4mac) is being
  98. planned & should finally be able to
  99. bring cheap & simple c64 file transfer
  100. to the MacOS platform.
  101.  
  102. Implementation
  103. The xu1541 is based on some other
  104. projects. These are: lcd2usb, a project
  105. of mine which i have based the first
  106. xu1541 prototype on, opencbm, formerly
  107. cbm4linux, a framework for accessing
  108. the CBM IEC bus under linux & windows,
  109. cbm4win, the windows incarnation of
  110. opencbm, AVR USB, a great software
  111. implementation for the AVR, usbtiny,
  112. another software USB implementation for
  113. the AVR,  AVRUSBBoot, a USB boot loader
  114. for the AVR, libusb, a user space USB
  115. interface library, & libusb-win32, the
  116. windows port of the libusb.
  117.  
  118. The firmware of the xu1541 device is
  119. based on the software USB solutions
  120. for the AVR cpu. It also includes parts
  121. of the source code from opencbm, namely
  122. parts of the linux kernel driver for
  123. the x1541 cable family. This includes
  124. generic CBM IEC routines following the
  125. communication style of the stock c64 as
  126. well as the special "speeder" modes
  127. supported by opencbm.
  128.  
  129. On the PC side the opencbm framework
  130. has been updated to be able to redirect
  131. the IEC communication via USB. It now
  132. uses the libusb to access the USB based
  133. xu1541. Other software intended to make
  134. use of the xu1541 cable thus needs
  135. libusb support as well. This e.g. means
  136. that very old DOS programs like Star
  137. Commander cannot easily be updated to
  138. support the xu1541 since there's no USB
  139. support for DOS. On the other hand the
  140. platforms that lack a printer port
  141. driver for the old x1541 cable family
  142. but have libusb support can be equipped
  143. with the xu1541. This is e.g. true for
  144. MacOS X, Solaris & some freeBSD
  145. platforms which weren't able to support
  146. the x1541 printer port cable family &
  147. weren't supported by opencbm so far.
  148.  
  149. CBM IEC support
  150. The current xu1541 can act as a CBM IEC
  151. master only. This means that it can
  152. play the role of a C64 & control a
  153. floppy disk or printer. It can not be
  154. connected to a C64 in order to act as a
  155. virtual disk drive. This is due to the
  156. fact that the software USB solution
  157. used in this project prevents the AVR
  158. from being able to react fast enough on
  159. incoming requests (the USB stack
  160. requires that no other hardware
  161. interrupts are being used). This very
  162. interesting application is left for the
  163. successor of the xu1541.
  164.  
  165. In order to support the CBM IEC
  166. protocol at a reasonable speed, some
  167. aspects of the protocol are handled
  168. inside the xu1541 itself. The downside
  169. of such an approach is that "speeder"
  170. support has also to be hardcoded into
  171. the firmware of the xu1541. The speeder
  172. support routines present in the current
  173. xu1541 version are the "serial1",
  174. "serial2" & "pp" (d64copy & cbmcopy
  175. versions) routines from the opencbm
  176. package. The latest version of the
  177. xu1541 firmware package includes a boot
  178. loader to ease the implementation of
  179. new speeder routines & to help the
  180. xu1541 to keep pace with the ongoing
  181. development of opencbm.
  182.  
  183. The xu1541 also allows to control each
  184. IEC control line seperately over the
  185. USB. This approach is only recommended
  186. for low performance things like device
  187. initialization etc. Using this approach
  188. causes a seperate USB transfer to take
  189. place for every single change of one of
  190. the IEC lines resulting in several USB
  191. transfers for every single bit to be
  192. tranferred. This is possible but
  193. nowhere near fast. This approach is
  194. therefore only being used during device
  195. initialization right before the
  196. accelerated "speeder" modes are being
  197. used. The data transfer phase itself
  198. then uses the specialized predefined
  199. byte transfer routines mentioned
  200. before. This entire approach has the
  201. advantage of moving only the timing
  202. critical byte transfer routines into
  203. the xu1541 itself & thus reducing the
  204. probability of having to change these
  205. functions in the firmware once bugs in
  206. the current speeder protocol
  207. implementations are found.
  208.  
  209. Host support
  210. Since the xu1541 implements a
  211. proprietary USB-to-CBM-IEC protocol
  212. only host software aware of the xu1541
  213. is able to make use of the interface.
  214. The xu1541 cable is supported by the
  215. following host software:
  216.  
  217. CVS version of opencbm
  218. opencbm version 0.4.0 needs a patch
  219. (this patch is quite old, buggy & for
  220. reference only, use the CVS version
  221. instead)
  222.  
  223. The hardware
  224. The hardware is designed to be as
  225. simple as possible. It therefore
  226. consists of through-hole components
  227. only. Additionally all components are
  228. cheap (less than EUR 5 total) & easily
  229. available e.g. from Reichelt. The
  230. entire device is powered from USB &
  231. doesn't need an additional power
  232. supply.
  233.  
  234. Version 1.0 of the xu1541 incl. its
  235. adaptor for firmware upload The xu1541
  236. includes two IEC connectors (X2 & X3).
  237. Both are connected in parallel & can
  238. be used at the same time. The parallel
  239. port connector SV1 can be used to
  240. connect one of those parallel speeder
  241. cables that once were a popular way to
  242. speed up the slow 1541 in these ancient
  243. days.
  244.  
  245. Version 1.1 of the PCB allows for two
  246. popular types of the DIN 6 sockets.
  247. The version sold bei Reichelt (see part
  248. list below) fits as well as the
  249. Hirschmann connector.
  250.  
  251. The parts:
  252. Part Qty Name Reichelt Part No.
  253. Q1 1 12Mhz crystal, HC49U package
  254. 12-HC49U-S
  255. R1 1 1.5k ohm resistor 1/4W 1,5k
  256. R2, R3 2 68 ohm resistor 1/4W 68
  257. R4 1 220 ohm resistor 1/4W 220
  258. R5, R6, R7 3 10 ohm resistor 1/4W 10
  259. C1, C2 2 22pF ceramic capacitor,
  260. 2.54mm KERKO 22P
  261. C3, C5 2 100nF capacitor, 5.08mm
  262. Z5U-5 100N
  263. C6 1 10F electrolytic capacitor RAD
  264. 10/35
  265. SV1 1 20 pin parallel connector WSL
  266. 20G
  267. SV2 1 10 pin ISP connector WSL 10G
  268. X1 1 USB-B print connector USB BW
  269. X2, X3 2 6 pin DIN sockets MABP 6
  270. LED1 1 LED 3mm yellow LED 3MM GE
  271. IC1 1 Atmega8-16 DIP ATMEGA 8-16 DIP
  272. -- 1 socket for IC1 GS 28P-S
  273. D1, D2 2 3.6V zener diode ZD 3,6
  274.  
  275. Firmware upload
  276. The AVR CPU of the xu1541 requires a
  277. firmware to be installed in order to
  278. make it work. If no boot loader is
  279. installed on the xu1541, a special
  280. download cable/interface connected to
  281. connector SV2 is required to download
  282. either the firmware or the boot loader.
  283. Various download solutions exist from
  284. the simple STK200 compatible interface
  285. to devices like the stk500, the
  286. AVR-Doper, or the AVR Dragon.
  287. Once such a cable is connected, the
  288. firmware is uploaded from a PC using
  289. programmer software like uisp (linux),
  290. avrdude (windows, macos & linux)
  291. or Ponyprog (linux & windows). The
  292. Makefile in the firmware archive is
  293. prepared to support the stk200
  294. compatible adapter using avrdude
  295. under linux. To use it just enter "make
  296. program". This should also work under
  297. Windows. The command required to
  298. manually flash the firmware
  299. (firmware-xxxx.hex in this example)
  300. using the stk200 compatible adaptor is:
  301.  
  302. avrdude -c stk200 -p atmega8 -U
  303. lfuse:w:0x9f:m -U hfuse:w:0xc9:m -U
  304. flash:w:firmware-avrusb.hex
  305. or
  306. avrdude -c stk200 -p atmega8 -U
  307. lfuse:w:0x9f:m -U hfuse:w:0xc9:m -U
  308. flash:w:firmware-usbtiny.hex
  309.  
  310. Two versions of the firmware (and the
  311. boot loader) exist. Both provide the
  312. same functionality but are based on
  313. different AVR usb implementations. It
  314. shouldn't make a difference which
  315. version you use. But if you encounter
  316. problems it may be worth giving the
  317. other version a try. Please report such
  318. incompatibilities.
  319.  
  320. Using the boot loader
  321. The xu1541 includes an optional boot
  322. loader. This boot loader has to be
  323. installed once using the methods
  324. explained above. The command required
  325. to flash the boot loader
  326. (bootldr-xxxx.hex in this example)
  327. using the stk200 compatible adaptor is:
  328.  
  329. avrdude -c stk200 -p atmega8 -U
  330. lfuse:w:0x9f:m -U hfuse:w:0xc8:m -U
  331. flash:w:bootldr-avrusb.hex
  332. or
  333. avrdude -c stk200 -p atmega8 -U
  334. lfuse:w:0x9f:m -U hfuse:w:0xc8:m -U
  335. flash:w:bootldr-usbtiny.hex
  336.  
  337. Please notice the different fuse
  338. settings which are due to the fact that
  339. the boot loader is being installed &
  340. run in a seperate memory section than
  341. the firmware. Once the boot loader is
  342. installed, it can be used to easily
  343. install the firmware itself via USB. In
  344. order to install the firmware on a boot
  345. loader equipped xu1541 the following
  346. steps are required:
  347.  
  348. Unplug the xu1541
  349. Place a jumper switch between pin 9 &
  350. 10 of the 10 pin header (SV2)
  351. Plug device in, the LED should go on
  352. and stay on (the boot loader is active)
  353. Use upload tool with latest firmware:
  354. ./xu1541_update ../firmware/firmware-
  355. xxxx.hex
  356. Unplug device
  357. Remove the jumper switch
  358. Plug the device into the USB, the LED
  359. should flash a fraction of a second
  360. (the firmware is active)
  361. Use the device as usual
  362.  
  363. Downloads
  364. Till Harbaum-Impressum
  365. http://www.harbaum.org/till
  366. http://www.harbaum.org/till/xu1541/in
  367. dex.shtml
  368.