0% found this document useful (0 votes)
326 views

Usb Setting

This document describes a USB to parallel port converter device called USB2LPT. It allows connecting hardware that normally uses a parallel port to a computer via USB, without needing to modify interface software. The circuitry fits into a small dongle housing. Several revisions of the device are detailed, and it can be used to program microcontrollers, connect data loggers and lab equipment, and more. Limitations include reduced speed for hardware relying on frequent data input and incompatibility with proprietary driver-based devices.

Uploaded by

Cowps
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
326 views

Usb Setting

This document describes a USB to parallel port converter device called USB2LPT. It allows connecting hardware that normally uses a parallel port to a computer via USB, without needing to modify interface software. The circuitry fits into a small dongle housing. Several revisions of the device are detailed, and it can be used to program microcontrollers, connect data loggers and lab equipment, and more. Limitations include reduced speed for hardware relying on frequent data input and incompatibility with proprietary driver-based devices.

Uploaded by

Cowps
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

USB control of the N2PK-VNA based on USB2LPT by Henrik Haftmann

A first USB-interface to control the N2PK-VNA has been designed by Dave Roberts G8KBB.
Unfortunately the use of this interface is limited to VNA4WIN.
Following a hint from Michael OE1MIS, I found USB2LPT from Henrik Haftmann. This design is
able to implement an LPT-port, that looks like a normal port for the software, but physically is
connected via USB.
The original PCB, Henrik designed to fit into a plug housing, needs professional assembling.
Therefore, I slightly redesigned the schematic and PCB for the following targets:

Use of an SOP processor chip, that can be manually soldered


Use an EEprom in DIL package,
that can be programmed with standard programmer without special socket
if the user is unfamiliar to the Cypress tools
Use SIL-Resistor Networks that can be easily replaced by single resistors,
if networks are difficult to get
Direct 1-to-1 connection to N2PK's VNA-boards for a Dual-Detector configuration
No need for modification of Henrik's firmware and driver

Up to now, I was able to successfully pass the following tests:

Run Exeter via UserPort and USB2LPT on Win2K


Run VNA4WIN via UserPort and USB2LPT on Win2K

I was not able to run the original N2PK-DOS-software on the Win2K machine.
May be, this can work with the interface using another configuration.

Thanks to all, who contributed to these projects, expecially to Paul (N2PK) and Henrik, who
allowed me to put some the contents of his site to the Yahoo-Groups file area.
For the design of the schematic and PCB, EAGLE has been used.
A free version for non-profit use of this software can be downloaded from www.cadsoft.de .
73 de
Friedhelm
DL9GAZ

This is, what it actually looks like :


To the right of the 3 resistor networks, a female horizontal 25-pin Amphenol connector can be
mounted instead of the direct cable connection to the VNA. In that case, the outermost rihgt part of
the PCB can be cut away at the marks.
top view:

bottom view:

06.05.2006 09:36:52 C:\Programme\EAGLE-4.11\projects\VNA-USB\ul-13-SSOP.sch (Sheet: 1/2)

06.05.2006 09:36:52 C:\Programme\EAGLE-4.11\projects\VNA-USB\ul-13-SSOP.sch (Sheet: 2/2)

06.05.2006 09:38:33 f=2.73 C:\Programme\EAGLE-4.11\projects\VNA-USB\ul-13-SSOP.brd

06.05.2006 09:39:58 f=2.73 mirrored C:\Programme\EAGLE-4.11\projects\VNA-USB\ul-13-SSOP.brd

Converter From USB To Parallel

Keywords: USB, LPT, parallel, parallel port, printer port, converter,


adaptor; programmer, ATmega, ISP, FPGA, CPLD, JTAG, direct port
Deutscher Originaltext
access emulation, IEEE 1284, IEEE1284

Converter From USB To Parallel


Contrary to all other USB parallel ports which can connect to printers only, this makes connection to
most hardware - without adapting the software! The entire circuitry fits into a usual dongle housing.
A reverse device called LPT2USB for connecting a USB printer to a legacy parallel port is in
preparation and will be available in 2006.
For ordering devices, please email me.

List of successfully tested programs


To driver software
USB2LPT is a multifunction device

Operational areas
Typical devices are:

Programming devices (AVR, JTAG)


Data logger, data acquisition
slow controls, like for garden, model railway
Synchronous bus connections, like IC, SPI
Laboratory automation, simple robots

Certain equipment categories are excluded from correct emulation:

Time critical equipment, like direct stepper motor controls (above 100 Hz or so)
Due to free programmability of the microcontroller used you may run dedicated stepper motor control software
on its 8051 core and so greatly reduce the impact to the overall PC performance. Access to source code of the
stepper motor control software is required.

Things with intentionally hard-coded (non-hookable) drivers, such as Dongles (= software


protection plugs)
For most software there is a USB dongle available too.

The software accessing the parallel hardware must be run under Windows! A DOS program may run
in a DOS box, window or full-screen. 16-bit Windows programs are supported too. A Pentium class
processor is required. 486 is too old.

Restrictions, Performance
http://www-user.tu-chemnitz.de/~omat/bastelecke/Rund%20um%20den%20PC/USB2LPT/index.html.en (1 von 5) [06.05.2006 09:41:53]

Converter From USB To Parallel

Interception of port accesses takes place in a driver in privileged mode. But wasted time for the
interception itself is small in opposite to that with each IN instruction a USB frame must be
waited for, at least 125 s. This may lead to 100x lengthening of time!
I will hope that your software is not so much input-intensive. While processing time is lengthened, the processor yields
to other running processes. Solely modifying the software can reduce execution time of IN instructions, but that's
exactly what should be avoided.
In contrast to competitors I don't want to make false hope!

OUT instructions do not lead to considerable lengthening.


It is stupid to use this converter only for a printer! All other converters do this job correct! They are
inexpensive too.
However, this converter contains a printer-compatible USB interface, therefore, printing is possible
without loss of performance, see USB2LPT as multifunction device.
Programs that come with her own kernel driver will work too. This ist due to the brute force of a
debug register trap.
Interferences with debuggers may occur. For program developers, this converter is relatively
uninteresting.
Hint: If you are looking for a working parallel port for laptops carefully, you will find
out that there are PCMCIA cards. And if you have a PC, you can buy an appropriate
PCI card. Such solutions will work much more reliable as there is no trap of port
accesses by a piece of driver software.
Unluckily, such cards are more expensive and not very convenient.

History of USB2LPT
I had built this device in several versions, or revisions. Here are self-make instructions too.
USB2LPT Evaluation system

September 2004, Quantity: 1


AN2131SC - Full Speed
Handmade PCB (included in Diploma work of Eik
Arnold)
99% compatible to Original Version and
Revision 1, only pull-up resistors are missing
A handy utility for troubleshooting is the LPT
checker
Do not clone! Errors on PCB!

Evaluation system

http://www-user.tu-chemnitz.de/~omat/bastelecke/Rund%20um%20den%20PC/USB2LPT/index.html.en (2 von 5) [06.05.2006 09:41:53]

Converter From USB To Parallel

USB2LPT Release 1.0

February 2005, Quantity: 10


AN2131SC - Full Speed
Handmade PCB (two-sided), manual via, handsoldering
Dongle housing, USB-B receptacle, 25 pin SubD
receptacle
Wire for extra 5V supply included
Recommended to clone (small changes necessary)
Attention: AN2131SC is about to be discontinued.

The Original

USB2LPT Release 1.1

First Revision

April 2005, Quantity: 18


AN2131SC - Full Speed
100% compatible to Original Version
Industrial PCB (two-sided, 350 m), hand-soldering
Plug housing, USB-MiniB receptacle, 25 pin SubD
receptacle
Do not clone! Cumbersome! Errors on PCB!

USB2LPT Release 1.2 called USB2LPT2 too

Second Revision

August 2005, Quantity: 33


CY7C68013A-56PVXC (FX2LP) - High Speed (not
firmware-compatible to predecessor, other chip)
Industrial PCB (two-sided, 250 m), hand-soldering
Plug housing, blue High-Speed LED, USB-MiniB
receptacle, 25 pin SubD receptacle
Cloning OK, but maybe you will await next
revision

http://www-user.tu-chemnitz.de/~omat/bastelecke/Rund%20um%20den%20PC/USB2LPT/index.html.en (3 von 5) [06.05.2006 09:41:53]

Converter From USB To Parallel

USB2LPT Release 1.3

?
Third Revision

March 2006, Quantity: 100


CY7C68013A-56LFXC (FX2LP) - High Speed (not
firmware-compatible to predecessor, other wiring)
Industrial PCB (two-sided, 150 m), reflow
soldering
Plug housing, blue High-Speed LED, USB-MiniB
receptacle, 25 pin SubD receptacle
Professional clones recommended

Software
That download you need for running the device on your host PC:

Driver for Windows 98/Me/2k/XP


These drivers are not so much plug'n'play. Up to three LPT port address rages are automatically captured. Up
to 10 devices may be connected due to naming scheme. The driver and software appears english on nonGerman Windows. All other languages may be added by modifying the resources and the .INF file. Windows
does the automatic selection.

That download you only need to upgrade the firmware:


Firmware for serial EEPROM (AN2131)
Firmware for serial EEPROM (FX2LP)
It simply puts USB OUT transfers to the OUT port, and answers to IN transfers. ECP are EPP are simulated
too.

Usage

http://www-user.tu-chemnitz.de/~omat/bastelecke/Rund%20um%20den%20PC/USB2LPT/index.html.en (4 von 5) [06.05.2006 09:41:53]

Converter From USB To Parallel

Have a look to Device


Manager! In the
Connections (COM &
LPT) tree, you will find a
new parallel port. Its property
dialog has two extra sheets:

Emulation: Here you


can set up properties
like the port address
emulated, the usage of
debug registers, etc.
Statistics: Here you
can inspect how
USB2LPT is working,
and maybe shooting
some trouble

There is an API for


programmers too. It is simply
DeviceIoControl based. Open
the device with CreateFile and file name "\\.\LPT1" (or LPT2 if you already have one), and
transfer IN/OUT data with (see USB2LPT.A51, label "upv") via a single call of DeviceIoControl.
This part of API is not subject to change in the future. (The IOCTL code is $222010.) Of course, a
helpful documentation must follow.
Via IOCTL code IOCTL_VLPT_AnchorDownload, you can inject additional firmware to speed-up
your applications. Therefore, USB2LPT is a Pocket Development Kit for EZUSB
AN2131/CY7C68013 too.

Frequently Asked Questions (FAQ)


You can read the FAQ by following this link.

Henrik Haftmann, Chemnitz, November 25, 2005

http://www-user.tu-chemnitz.de/~omat/bastelecke/Rund%20um%20den%20PC/USB2LPT/index.html.en (5 von 5) [06.05.2006 09:41:53]

USB to Parallel converter - List of successfully tested programs

Deutscher Originaltext
Keywords: USB, LPT, parallel, parallel port, printer port,
converter, adaptor
USB2LPT overview

USB2LPT, List of successfully tested programs


These list should grow with appropriate user feedback

PonyProg2000 (Freeware programmer esp. for PIC, ATmega, serial EEPROMs)


The INI file must be modified to get PonyProg to work: change
AutoDetectPorts=NO!
Xilinx iMPACT (JTAG programmer esp. for Xilinx CPLD and FPGA)
The current version of usb2lpt.sys has a bug!
Please copy an old version of driver (in directory alt) to directory
Windows\system32\drivers!
Built-in automatic port detektion fails, therefore iMPACT needs the following
environment variables:
set XIL_IMPACT_ENV_LPT_BASE_ADDRESS=378 (according to setting
of USB2LPT in Device Manager)
set XIL_IMPACT_ENV_LPT_ECP_ADDRESS=778 (always LPT_BASE +
400h)
All of (my) h#s programs (of course!)
LabView
Only with the current driver version due to DWORD-wide port accesses (really!)
SP12 (Programmer for Atmel AVR, http://www.xs4all.nl/~sbolt/e-spider_prog.html)
AVRDude (Programmer for Atmel AVR)
Antenna analyzer by(?) Gerd Koetter (see here)
Discolitez Delux32

There is also a list of unsuccessfully tested applications:

Matlab: digitalio('parallel','lpt1');

Henrik Haftmann,

Chemnitz, November 24, 2005

http://www-user.tu-chemnitz.de/~omat/bastelecke/Rund%20um%20den%20PC/USB2LPT/liste.htm.en [06.05.2006 09:42:23]

USB2LPT as multifunction device

Deutscher Originaltext
Up to USB2LPT Overview

USB2LPT as multifunction device


USB2LPT was developed as a so-called multifunction device with two concurrent functions.
Main function is simply passing direct access commands to the parallel port, in conjunction with USB delays when
reading a port. All parallel port extensions (PS/2, EPP, and ECP) are simulated and fully supported by firmware, but
extra trapping by Windows driver may be necessary (is off by default).
The extra printer interface enables USB2LPT to be efficient on printers without loss of performance. All bidirectional
printer protocols (Nibble Mode, Byte Mode, EPP, and ECP) are supported and used for the back-link bulk channel, but
that's not tested!

Structure of firmware
The third function (JTAG) is not yet implemented. There is a lack of documentation about data streams used. When
implemented, USB2LPT could be even much faster than a conventional parallel JTAG adapter connected to a legacy
parallel port.
The user must take care that the functions do not interfere! For example, do not try to print over
USB2LPT while you are programming.

When plugging USB2LPT to a Windows host, there will be the following driver structure under the hood:

http://www-user.tu-chemnitz.de/~omat/bastelecke/Rund%20um%20den%20PC/USB2LPT/mf.htm.en (1 von 2) [06.05.2006 09:43:23]

USB2LPT as multifunction device

Structure of drivers
The port-accessing application software will be trapped by usb2lpt.sys by either a Debug Register trap or a trapped
port access function *. The access will be transcoded and put to USBD, who is communicating via USB with
firmware function Direct Input/Output.
The third function is missing there too. A modified .INF file is sufficient for enabling this data path.

* Trapped port access functions are:

READ_PORT_UCHAR()
READ_PORT_USHORT()
READ_PORT_ULONG()
WRITE_PORT_UCHAR()
WRITE_PORT_USHORT()
WRITE_PORT_ULONG()

Henrik Haftmann, Chemnitz, November 25, 2005

http://www-user.tu-chemnitz.de/~omat/bastelecke/Rund%20um%20den%20PC/USB2LPT/mf.htm.en (2 von 2) [06.05.2006 09:43:23]

Converter From USB To Parallel

Deutscher Originaltext

Frequently Asked Questions (FAQ)


Q. Why work USB to serial (RS232, COMx) converters well? And USB to parallel converters not
at all?
A. Most hardware attached to parallel port doesn't act like a printer, but is controlled by a selfmade protocol. For example, not to disturb a printer behind a dongle.
There is no Windows function available to control dedicated pins of parallel port, therefore, the
only choice for programmers is to directly access the hardware.
Serial ports are very well wrapped by Win32 functions, and it is very inconvenient for
programmers to access a serial port directly. The two control lines and four status lines are
easily controllable using EscapeCommFunction.
Some programs are very slow when working with USB to serial converters. For example,
simple PIC programmers.

Q. Would it be more convenient to use existing converters and use its built-in
2305 instead?

Prolific PL-

A usual parallel adapter (NOT my PCB!)


http://www-user.tu-chemnitz.de/~omat/bastelecke/Rund%20um%20den%20PC/USB2LPT/faq.htm.en (1 von 3) [06.05.2006 09:44:00]

Converter From USB To Parallel

A. Those converters emulate


USB printers according to
USB device class code 7. The
protocol used in printer class USB devices doesn't allow to set some printer port pins; that
protocol doesn't know a parallel port at all. For compatibility reasons, Paper End, Select,
and Error port statii may be requested, that's all. You can use such a device only and only if
your external device is capable of EPP transfer, and you have to adapt your software. Most
external devices need direct pin control.

Q. Is there a chance to reprogram the PL-2305 chip?


A. Surely not. Those chips are mask-programmed, or maybe OTP (one-time programmable
PROM).
Maybe there is a backdoor (undocumented features to access the pins directly), but that's hard
to find out, if any available.
The PL-2305 has a backdoor. Its descriptor is as follows:
Device (string descriptors can be defined in EEPROM), Class
Multifunction
Configuration Nr. 1
Interface Nr. 0
Alternate Setting Nr. 0
Class: 07/01 = Drucker, Protocol: 01 = one direction
Endpoint Nr. 2, Bulk, Output, 64 Bytes
Alternate Setting Nr. 1
Class: 07/01 = Drucker, Protocol: 02 = two directions
Endpoint Nr. 1, Bulk, Output, 64 Bytes
Endpoint Nr. 2, Bulk, Input, 64 Bytes
Alternate Setting Nr. 2
Class: FF/00 = gusto, Protocol: FF = gusto
Endpoint Nr. 1, Bulk, Output, 64 Bytes
Endpoint Nr. 2, Bulk, Input, 64 Bytes
Endpoint Nr. 3, Interrupt, 4 Bytes, Interval:
1 ms
The Alternate Setting Nr. 2 had no function. Probably, this is a IEEE 1284.4
protocol stub.

Q. May it's possible to speed up the emulated IN instructions? (Even without changing software?)
A. If you are a great programmer, you may write an on the fly disassembler for the code
following the IN instruction and look where the IN byte (AL register) is spread. After you get
the true IN byte, you patch all locations where the IN byte is spreaded. Unluckily, most IN
instructions are followed by a conditional jump, so you have to predict the condition... forget
ist!
http://www-user.tu-chemnitz.de/~omat/bastelecke/Rund%20um%20den%20PC/USB2LPT/faq.htm.en (2 von 3) [06.05.2006 09:44:00]

Converter From USB To Parallel

On the other hand, it's easy to speed up REP INSB instructions. But these are seldom used in
conjunction with ECP/EPP ports. With a standard parallel port, REP INSB is completely
useless and therefore never used.

Q. May it's possible to speed up changing the accessing software?


A. Yes, of course. You can concatenate IN instructions to two USB packets. You send data
blocks, according to the documentation in this source code, to the converter, and get the
answers in a multi-byte IN block.
Each instruction consumes about 1 s. Delayed operation can be achieved using WAIT
instructions (20h, thereafter the delay time in units of 4 s) in the OUT packet. Slower delays
you should achieve in software.
This converter (until Revision 1.1) has the following descriptor:
Device "USB2LPT Converter", Class Multifunction
Configuration Nr. 1
Interface Nr. 0
Alternate Setting Nr. 0
Class: FF/FF = gusto, Protocol: FF = gusto
Endpoint Nr. 2, Bulk, Output, 64 Bytes
Endpoint Nr. 2, Bulk, Input, 64 Bytes
Interface Nr. 1
Alternate Setting Nr. 0
Class: 07/01 = Printer, Protocol: 01 = one direction
Endpoint Nr. 4, Bulk, Output, 64 Bytes
Alternate Setting Nr. 1
Class: 07/01 = Printer, Protocol: 02 = two directions
Endpoint Nr. 4, Bulk, Output, 64 Bytes
Endpoint Nr. 4, Bulk, Input, 64 Bytes
Such a two-interface device forms two devices. For this, Windows loads a fork
driver, that itself loads two real drivers.
For more exact timing I advise you to roll your own and write your own 8051 program. You
can download it anytime to the converter. [This converter is actually almost the same as an EZUSB development board!]

Q. Are enough devices available?


A. Next year (2006)

Henrik Haftmann, Chemnitz, November 7, 2005

http://www-user.tu-chemnitz.de/~omat/bastelecke/Rund%20um%20den%20PC/USB2LPT/faq.htm.en (3 von 3) [06.05.2006 09:44:00]

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy