6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Nov 24, 2024 10:22 pm

All times are UTC




Post new topic Reply to topic  [ 71 posts ]  Go to page 1, 2, 3, 4, 5  Next
Author Message
PostPosted: Wed Jan 18, 2012 2:27 am 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
Once upon a time...

... PCs used to be extremely easy to connect to. COM and LPT (serial and parallel) ports were standard on all PCs, and DOS and early versions of Windows didn't prevent you from executing IN and OUT instructions in your code. For hobbyists and experimenters it was a simple matter to create custom hardware and software that worked together. But nowadays things aren't so simple, because of
  • modern Operating Systems, and
  • the move from COM/LPT to USB connectivity

In the thread Hardware -> Writing to a parallel EEPROM,
8BIT wrote:
This will also require an OS that will allow you to access the parallel port from software. I used windows 95 back then [...]

Win 95 and 98 will let your code talk to an IO port but newer Windows versions won't. (You just get a Protection Error.) Two possible solutions are directio and userport, found here and perhaps other places as well. (userport appears to have various incarnations.) According to the pdf found in userport.zip, ...

    UserPort.SYS is a kernel mode driver for Windows NT/2000 that gives usermode programs access to I/O Ports. This makes it possible to access hardware directly from a normal executable in the same way as under Windows 95/98/ME. [...] The driver gives user mode program access to selected ports by changing the x86-processors IOPM (I/O Permission Map).
    Attachment:
    UserPort.zip [33 KiB]
    Downloaded 186 times


The other half of the puzzle is USB. Can anyone comment on whether a common, inexpensive USB serial port is an effective substitute for a "real" serial port? Of course I'm thinking of the experimenter, someone who's possibly planning to connect to some custom hardware.

And, even more important, what about parallel ports? Certainly the old-style LPT ports had excellent hacking potential. Are the modern USB versions comparable? Is it common for them to offer bi-directional modes (ECP and EPP)? Any info and comments will be appreciated :)

Jeff
ps- for an extensive reference on LPT ports, see Parallel Port Complete


Last edited by Dr Jefyll on Mon Jul 11, 2016 5:02 am, edited 2 times in total.

Top
 Profile  
Reply with quote  
PostPosted: Wed Jan 18, 2012 4:06 am 
Offline

Joined: Mon Mar 02, 2009 7:27 pm
Posts: 3258
Location: NC, USA
Dr Jefyll wrote:
...The other half of the puzzle is USB. Can anyone comment on whether a common, inexpensive USB serial port is an effective substitute for a "real" serial port? Of course I'm thinking of the experimenter, someone who's possibly planning to connect to some custom hardware...

I am currently using Microchip's MCP2200 USB to UART together with br@y terminal, under a Windows 7 environment very successfully @256Kbaud. br@y terminal sees com4 available after programming the MCP2200 with the Microchip Config Utility, which was very cool since Win7 is such a security concious OS. I don't remember having to modify any security settings either...


Top
 Profile  
Reply with quote  
PostPosted: Wed Jan 18, 2012 6:02 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1748
Location: Sacramento, CA
Dr Jefyll wrote:
Can anyone comment on whether a common, inexpensive USB serial port is an effective substitute for a "real" serial port? Of course I'm thinking of the experimenter, someone who's possibly planning to connect to some custom hardware.


I have been using the Pololu module for a long time and it works well. The nice thing is that it has 5v logic so your target system does not need a MAX232 or equiv.

http://www.pololu.com/catalog/product/391

Image

Daryl


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Jan 18, 2012 8:26 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
richarde and I used the predecessor to this USB-ISS usb-serial module which offers serial, i2c, spi or 4 bits of gpio for bit-banging. (The predecessor is less capable but the two are now the same price.)

Image

Note that the bit-banging can't be done especially quickly as it takes a USB command to change the pin states.

This module is breadboard friendly too, and can bring 5v supply from USB cable to the breadboard if you don't need much current.


Top
 Profile  
Reply with quote  
PostPosted: Wed Jan 18, 2012 4:56 pm 
Offline
User avatar

Joined: Fri Oct 31, 2003 10:00 pm
Posts: 200
Dr Jefyll wrote:
Once upon a time...

... PCs used to be extremely easy to connect to. COM and LPT (serial and parallel) ports were standard on all PCs, and DOS and early versions of Windows didn't prevent you from executing IN and OUT instructions in your code. For hobbyists and experimenters it was a simple matter to create custom hardware and software that worked together. But nowadays things aren't so simple, because of
  • modern Operating Systems, and
  • the move from COM/LPT to USB connectivity
In the thread Hardware -> Writing to a parallel EEPROM,
8BIT wrote:
This will also require an OS that will allow you to access the parallel port from software. I used windows 95 back then [...]

I'm happy to report a solution for this. Win 95 and 98 will let your code talk to an IO port but newer Windows versions won't. (You just get a Protection Error.) The good news is that there's a utility that'll allow you to access IO ports even under the newer Windows versions. A friend of mine reports success using UserPort -- see http://hem.passagen.se/tomasf/UserPort/


The other half of the puzzle is USB. Can anyone comment on whether a common, inexpensive USB serial port is an effective substitute for a "real" serial port? Of course I'm thinking of the experimenter, someone who's possibly planning to connect to some custom hardware.

And, even more important, what about parallel ports? Certainly the old-style LPT ports had excellent hacking potential. Are the modern USB versions comparable? Is it common for them to offer bi-directional modes (ECP and EPP)? Any info and comments will be appreciated :)

Jeff
ps- for an extensive reference on LPT ports, see Parallel Port Complete


I still program and experiment with parallel ports on the PC and notebook, in Delphi 7 and all Windows versions (32 bit, Windows 7).

You need a driver like DLPORTIO and hardware port. The only notebook friendly solution seems to be a Delock PCMCIA Cardbus card. USB to LPT thingies are useless for this kind of work.

More details here: http://www.hansotten.com/index.php?page ... d-pc-ports


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Jan 20, 2012 2:36 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
How about the Bus Pirate for $30? (Also available for 25EUR. New model for $40.) Seems to be a near-universal serial and parallel port-style USB adapter (but with just 5 I/Os.)

Image

    USB interface, USB powered
    0-5.5volt tolerant pins
    0-6volt measurement probe
    1Hz-40MHz frequency measurement
    1kHz – 4MHz pulse-width modulator, frequency generator
    On-board multi-voltage pull-up resistors
    On-board 3.3volt and 5volt power supplies with software reset
    Macros for common operations
    Bus traffic sniffers (SPI, I2C)
    Transparent USB->serial bridge mode
    10Hz-1MHz low-speed logic analyzer
    AVR STK500 v2 programmer clone
    Scriptable from Perl, Python, etc.
    Translations (currently Spanish and Italian)


(Never used one, but it's open-source hardware and seems well-established with a forum and so on.)

Cheers
Ed


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Jan 20, 2012 4:47 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
The intrepid might like to have a read of some of the technical posts on the very long stardot thread where MartinB covers some difficulties with parallel ports and USB/Serial adaptors in the course of eventually making a reliable bit-banged 115k serial connection.

It turns out that the RTS/CTS handshaking is inconsistently applied between the various devices, so if you really care about that, you need to buy carefully, or engineer the other end carefully.

I've a feeling that one type of USB/Serial adaptor was felt to be more cooperative than another, but I don't see the details jumping out at me at the moment. If I find it, I'll link to it.
(OK, it's felt that FTDI-based adaptors are a good choice and Prolific-based adaptors are not such a good choice. See here for example. That said, I have a 2003-vintage Prolific-based adaptor and it passed a stress test on a linux host.)
(some detail here on differences between proper serial ports and usb serial ports.)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Jan 20, 2012 5:27 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
On the LPT question, it seems most likely that USB adapters are useful only up to a point: see Q8 in this FAQ (USB2LPT is an open hardware design of a true parallel port over USB solution.)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Jan 23, 2012 5:56 am 
Offline
User avatar

Joined: Wed Jan 04, 2012 4:28 am
Posts: 31
Location: Florida
I used this USB to parallel interface to drive LCD display from PC:
http://electronics-diy.com/USB_IO_Board.php
Device driver creates virtual serial port. Programming on the PC side is with any serial port API. I used Java and RxTx (gnu.io) from javax.com.

_________________
Marek Karcz
---
"Don't worry. We've got our best people working on it."


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Feb 02, 2012 10:31 pm 
Offline

Joined: Tue Jul 05, 2005 7:08 pm
Posts: 1043
Location: near Heidelberg, Germany
BigEd wrote:

Note that the bit-banging can't be done especially quickly as it takes a USB command to change the pin states.


I second that. I have a C2N232 connector using a serial interface to the PC and a commodore tape connector to the PET (and other CBMs) to transfer files between old and new worlds. The author used a clever protocol, which is unfortunately not passed through over the serial-over-USB.

So your mileage may vary

André


Top
 Profile  
Reply with quote  
PostPosted: Thu Jul 02, 2015 7:38 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
Thanks to BDD for links to StarTech which makes RS-232 and parallel-port cards for modern desktop PCs. The RS-232 cards are at http://www.startech.com/Cards-Adapters/ ... s-Adapters . This interests me, as the FTDI USB-to-RS232 adapter I got is very clumsy for the job, a real pain. Talking to the workbench computer from the old DOS machine with a real RS-232 port is trivial and very efficient, but I know that a day will come when I can no longer get old PCs to replace it. They don't last indefinitely, and I've had to transfer to another one every several years, and the supply will dry up. I also want to get the better access on my modern Linux machine.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Thu Jul 02, 2015 1:37 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
Thanks to all who responded -- somehow I failed to say that earlier.

Relevant to this discussion is the thread CH375B USB Mass Storage Controller
Quote:
It is very cheap (~£2), and lets you interface with USB mass storage devices over an 8-bit parallel bus (it also has some serial modes).


GARTHWILSON wrote:
Talking to the workbench computer from the old DOS machine with a real RS-232 port is trivial and very efficient, but I know that a day will come when I can no longer get old PCs to replace it. They don't last indefinitely, and I've had to transfer to another one every several years, and the supply will dry up.
E-waste drop-offs are a good source of outdated PC's -- and some surprisingly modern equipment as well. Most of this gear is fully functional or, at worst, suffering from a minor ailment such as a virus infection or a dust-clogged CPU fan. Also note that e-waste facilities offer both competitive pricing (!) and a no-questions-asked Returns Policy! :D

-- Jeff

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Last edited by Dr Jefyll on Sat Aug 20, 2016 10:49 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Thu Jul 02, 2015 2:17 pm 
Offline
User avatar

Joined: Tue Mar 02, 2004 8:55 am
Posts: 996
Location: Berkshire, UK
GARTHWILSON wrote:
Thanks to BDD for links to StarTech which makes RS-232 and parallel-port cards for modern desktop PCs. The RS-232 cards are at http://www.startech.com/Cards-Adapters/ ... s-Adapters . This interests me, as the FTDI USB-to-RS232 adapter I got is very clumsy for the job, a real pain. Talking to the workbench computer from the old DOS machine with a real RS-232 port is trivial and very efficient, but I know that a day will come when I can no longer get old PCs to replace it. They don't last indefinitely, and I've had to transfer to another one every several years, and the supply will dry up. I also want to get the better access on my modern Linux machine.

On my retro chip emulator I programmed a 14 pin PIC to act as a USB Serial adapter. One chip, two capacitors and a USB socket are all you need. Microchip sell a pre-programmed chips if you don't want custom firmware and VID/PID numbers.

_________________
Andrew Jacobs
6502 & PIC Stuff - http://www.obelisk.me.uk/
Cross-Platform 6502/65C02/65816 Macro Assembler - http://www.obelisk.me.uk/dev65/
Open Source Projects - https://github.com/andrew-jacobs


Top
 Profile  
Reply with quote  
PostPosted: Wed Mar 09, 2016 9:45 pm 
Offline

Joined: Wed Sep 23, 2015 3:43 pm
Posts: 9
I've been asked to come link this post into this thread. Of course, since anyone can drop a link, I suppose there's also an implied request that I post more than just the link. So, let's see...

Quote:
Can anyone comment on whether a common, inexpensive USB serial port is an effective substitute for a "real" serial port?

I've only had one or two, but I've found them to be complete ****. (...or I suppose I should say "****" since someone edited that word out of my last post, which seems strange as I recall way back in 1985 having friends whose parents allowed them to use any words they wanted, and I don't recall anyone making a sincere effort to limit their children's vocabulary since 2005. Indeed, one of those friends' parents had a much better rule in that their kids weren't allowed to lie, and that rule was enforced with the same vigor that other parents might use to keep their kids from saying "****" while allowing them to lie without consequence. I recall once that I discovered one of them had lied to me about having to go do something and I happened to mention it around his father, and I could tell from his reaction that lying wasn't tolerated in that family at all. My friend replied with a quick one-sentence explanation of how he was just trying to get away from me because I was being a **** and wouldn't let him leave (I really was being a ****) and, probably because he didn't lie to his parents all the time, his dad accepted his explanation and immediately forgot all about it. I haven't seen anyone in that family since I was 12, but I imagine they all grew up to be decent human beings despite their naughty vocabulary.)

Anyway, there are a few things that make serial ports ****. First of all, the +/- voltages are a PIT* to work with, but to make things worse, the voltages aren't even well-defined. I think the "official" specs are that the voltages are anywhere from 3 to 15 volts. So you end up with devices that are looking for at least +/- 10 volts since the person who designed them had a serial port that output +/- 12 volts, but the device you have only puts out +/- 3, and so the connection doesn't work. It's also just terrible in that you now need -12, +5 and +12 volts for your project, all to support some idiotic signal voltages.

I suppose if you don't mind dealing with stupid signal voltages then they're OK, but I wouldn't recommend serial at all, let alone the USB converters which seem to make serial a bit worse than it already was. Of course, some of the modern USB serial stuff uses TTL signal levels, which is much better, though personally I wouldn't touch anything that doesn't output CMOS levels. (Most of them probably do, as HCT signal levels are most popular these days, but you'd have to check the spec sheets to be sure.)

The other nasty thing about serial is that it is serial. This means that you either need a UART and a microcontroller to read the data, or you can use a bunch of 74LS123 to time bits and bytes to control shift and latch registers, which surprisingly is far more reliable than a both a UART and a parallel port in my experience, but it's a large circuit and you have to calibrate it with an oscilloscope to get the bit & byte timings right. Even using UARTs isn't that great. I had a nice 16550D with "PATENTED" stamped on it in bold letters, which despite toying with for days, it always seemed to read specific bits of specific bytes incorrectly and I never was able to figure out why. My oscilloscope showed perfect voltage levels and timing going into the chip so it really had no excuse, it just ******.

Quote:
And, even more important, what about parallel ports?

Even real parallel ports were awful. The only good thing they had going for them was that they were easy to access, but voltage specifications were similarly weak, and at least everything I built for them found itself prone to frequent data errors. I suppose I might have been doing something wrong, since they apparently work well-enough for printers, but the whole experience left a bad taste in my memory. ...and they might have only worked well for printers because they likely would have included electronics specifically designed around the fact that they were likely to receive **** voltage levels. Despite the simplicity of the parallel data access, it was so error-prone that when I switched to using serial ports decoded with a bunch of shift/latch registers and a bunch of 74LS123s, the result was so much more reliable that I never looked back. I suppose it could also have just been a problem with my computer's parallel port, but still, the bad experience makes it something I'd never want to recommend to anyone.

As for the USB variety, I've heard that they come in two types. One is a "printer port" and really only works for printers, as it isn't designed to do bit-bang stuff, it's designed to communicate data to a printer in the way that printers communicate data over a parallel port. The other provides a real parallel port that works with hardware that does other strange things. I think the two are different USB device classes. I've never attempted to use either of them for an electronics project, given that I stopped using parallel ports before such things existed.

Quote:
How about the Bus Pirate for $30?

I've never touched this or similar projects (like the Arduino). Something about people taking a few simple chips and creating a "product" with a clever name out of them just makes me feel sick inside. A friend of mine who has used an Arduino (even though he feels similarly about them) never has anything good to say about it, e.g. usually he's annoyed by the development environment.

I typed a bunch of crap here, but I think I can delete it all and sum it up with "I just always find its easier to do stuff myself rather than use those sorts of things." That said, if an Arduino or a Bus Pirate or one of the many similar products works for you, then by all means go ahead and use it, but I prefer to just read the datasheets of the cheapest chips until I find one I like, then create my own design and my own software to utilize it.

Quote:
where MartinB covers some difficulties with parallel ports and USB/Serial adaptors in the course of eventually making a reliable bit-banged 115k serial connection

I didn't look at this link, but I want to mention that the FT240X and it's predecessor the FT245R are both capable of 1 MB/s parallel data transfer. (that's bytes, not bits) Even though it says "up to" in the datasheet, I've found it to just about be the rule rather than an "if you're lucky" sort of thing. I assume "up to" is in there just because it will be slowed down if the USB bus is already in heavy use.

I've also found the FT240X and the older FT245R to be the most reliable way to get data in and out of a PC to an electronics project. Whereas I had constant errors with a parallel port, and occasional errors with a serial port, the only time I see errors with those two chips is when there's a wiring fault in my circuit, or when I'm ignoring the pins that indicate when the buffers are full, which I do sometimes because the chip is still insanely reliable in that case despite the circuit being a faulty design. I have a "logic analyzer" I built which just clocks data into the chip at 1 MHz without regard to the "buffer full" signal. Despite that signal being active 50% of the time, 99.9% of the data gets to the PC without error. If I just slow it down to 500 kHz it seems like 100% of the data gets to the PC error-free.

Anyway, just to re-cap how to use the FT240X without any pre-programmed chips to connect it to:

My Z80-based EEPROM Programmer and my FT240X Break-Out Board.

Basically it's possible to wire the FT240X up to a Z80 that thinks the FT240X is its ROM, then you just send Z80 instructions through the FT240X and the Z80 executes them. The Z80 can even send data back to the PC by writing that data to the address range assigned to the FT240X. In this way, you can connect a bunch of 74HC537 as input ports and a bunch of 74HC574 as output ports to the Z80's I/O bus and be able to read and write these I/O ports from the PC. Also, if you include some SRAM in the circuit, you can send instructions that program some Z80 code into that SRAM which then allows you to do timing-sensitive operations on the Z80 where you can just use delay loops, or just use it to generally speed up large data transfers since, once you're executing the code you put into SRAM, you no longer have to send an instruction stream through the FT240X.

I took some pictures, since I always feel the need to say "it's not that hard" since I know people are put off by my many-tiny-pieces schematics and lack of step-by-step instructions.

My "Z80 EEPROM Programmer" sans the EEPROM and the "normal mode," instead built so that it only runs in "programming mode." In this way it is useful only as an I/O BUS interface. Note that it can be simplified even further by leaving out the SRAM.

A zoomed-out version showing the I/O bus and some other junk with some descriptive text.

...and, of course, its probably possible to do this with a 6502 instead, I just don't know enough about the 6502 to say for sure.

Also, the auto-logout time-out in this forum needs to be greatly extended. Every time I hit submit it's like "you need to log in again" and then its like "OK, here's a nice blank text area for you to re-type your post into." It's a good thing I learned to copy and paste into an external text editor years ago, otherwise this forum would have thrown away several hours of my efforts by now.


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 10, 2016 5:00 am 
Offline

Joined: Thu Mar 10, 2016 4:33 am
Posts: 181
I work on a Mac, but also have Windows and Linux in a VM. Quite often I'll need a serial port, sometimes to connect to a windows application or linux, so the extra layer of VMWare can make things more difficult. I've got a few USB to serial adapters that terminate in a 9-pin serial port that I use for firmware updates or logging, but for my 6502 breadboard I bought a cheap cable from China. At first I thought I might have gone too cheap (about $1.50), but it's actually worked remarkably well. The IC is built into the USB connector, the non-USB end has 4 wire connectors, so no flow control. It works with 5v levels, so I've been able to connect it directly to the TXD and RXD pins on my serial controller (I'm using a R65C52) and it works happily at 115,200, so perfectly OK for my uses.

I've seen other projects using the FTDI USB to FIFO chip to get functionality like a parallel port and that seems to work well too.

There have been some issues with drivers, so it pays to select a cable with a good chip in it. FTDI have managed to disable access to fake FTDI chips, which if you buy a cheap cable could be a problem. A few years ago I had a driver that would regularly crash my Mac, but that seems to be all sorted out now.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 71 posts ]  Go to page 1, 2, 3, 4, 5  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 21 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: