Treating parallel port as serial device
I'm looking to attach a serial device to my box that has only TTL level I/O. Since I'm more of a software than a hardware person making a circuit board up with a max232 in is a bit risky... I want to connect the I/O to the parallel port.
What I need now is a driver that can read the input from a pin on the parallel port and treat it as serial input. It sounds like the kind of project that would have been done before, but I can't find anything that even comes close. Userspace probably wouldn't cut it as I'm reading as 9600 baud and usleep doesn't have nearly enough resolution.
Tony
Signature · 4 lines
Microsoft - two out of three dead people who expressed a preference said their coffins preferred it. [email protected] http://www.nothing-on.tv
Quoted 2 lines
even comes close. Userspace probably wouldn't cut it as I'm reading as 9600 baud and usleep doesn't have nearly enough resolution.
9600 baud is only 1 bit every 100us or so. SCHED_FIFO and nanosleep should be perfectly adequate for timing. You can use ppdev or direct port I/O to get at the pins.
p.
Quoted 5 lines · Tony Hoyle
What I need now is a driver that can read the input from a pin on the parallel port and treat it as serial input. It sounds like the kind of project that would have been done before, but I can't find anything that even comes close. Userspace probably wouldn't cut it as I'm reading as 9600 baud and usleep doesn't have nearly enough resolution.
Unless you need to drive this based on interrupts or you need to do other stuff at the same time, you can use either SCHED_FIFO or SCHED_RR and nanosleep() from userspace.
According to the man page, nanosleep() will busywait for pauses under 2ms if you use one of the two realtime schedulers.
Chris
Signature · 4 lines
Chris Friesen | MailStop: 043/33/F10 Nortel Networks | work: (613) 765-0557 3500 Carling Avenue | fax: (613) 765-2986 Nepean, ON K2H 8E9 Canada | email: [email protected]
Take a look to the MAX3100 chip:
http://pdfserv.maxim-ic.com/arpdf/MAX3100.pdf
This solution highly reduce the CPU overhead needed to sample Rx line for each single bit. The chip have a FIFO, an interrupt and look like a standard UART. Only the bus transfert with the CPU is different.
I curently work on a driver for it.
Regards,
Quoted 14 lines · Tony Hoyle
I'm looking to attach a serial device to my box that has only TTL level I/O. Since I'm more of a software than a hardware person making a circuit board up with a max232 in is a bit risky... I want to connect the I/O to the parallel port.
What I need now is a driver that can read the input from a pin on the parallel port and treat it as serial input. It sounds like the kind of project that would have been done before, but I can't find anything that even comes close. Userspace probably wouldn't cut it as I'm reading as 9600 baud and usleep doesn't have nearly enough resolution.
Tony
Followup to: <[email protected]> By author: "Tony Hoyle" <[email protected]> In newsgroup: linux.dev.kernel
Quoted 6 lines
I'm looking to attach a serial device to my box that has only TTL level I/O. Since I'm more of a software than a hardware person making a circuit board up with a max232 in is a bit risky... I want to connect the I/O to the parallel port.
Most RS232 boards accept TTL level input, so your only problem is output. You may want to simply construct a level converter, such as a voltage divider or zener diode on your input.
-hpa
Signature · 3 lines
<[email protected]> at work, <[email protected]> in private! "Unix gives you enough rope to shoot yourself in the foot." http://www.zytor.com/~hpa/puzzle.txt <[email protected]>