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.