Things went from bad to worse with the breadboard prototype of the SmartParallel serial to parallel printer interface.
All was fine for a while. Lines of text sent from my Mac via an FTDI cable were duly printed on the Epson MX-80 F/T III dot matrix printer. But then, every now and again, the printer would randomly reset. After a while, these resets got closer and closer together until they were practically continuous.
With the help of the oscilloscope I confirmed that the /INIT line was, indeed, pulsing low. Whether this was cause or effect was unclear.
I took out the 74HC541 buffer IC to test it, in case I’d accidentally damaged it. But no, it was fine. With the chip removed, the printer did not reset, so I assume there was nothing wrong in the wiring between the printer side of the chip and the printer itself. (The /INIT line is pulled high by the printer by default, so it needs some kind of positive action to take it low.)
With the IC back in place, the resets disappeared. But I started getting spurious signals of other kinds, such as the microcontroller believing the printer to be offline (ie, the SELECT line going low) when it wasn’t.
Breadboard circuits are not always the most reliable things. And the breadboard I’d used in this lash-up was not of the highest quality. Add to that many DuPont-headed jumper wires of unknown provenance and you have a recipe for hard-to-debug faults.
Time to get out the stripboard.
I’m still going to have to use a lot of jumper leads, but transferring the circuit from breadboard to stripboard will provide for some firmer connections via soldering. It doesn’t eliminate all possible points of failure, but a few of them at least.
The first version supplied just the basic functionality – no LEDs, no data blinkenlights. It consists of the 74HC595 serial-to-parallel shift register that controls the eight data lines and the 74HC541 buffer through which the other printer signals run (well, eight out of nine, anyway).
The one signal that isn’t accounted for here is /SELECT-IN. This is a signal that runs from host to printer and allows the host to take the printer offline. In practice, it was relatively little used. It’s active low, where a low level means that the printer is ‘selected’ by the host (ie, online). My tests showed that the Epson holds this line low by default so, for the time being, we can just ignore it.
After some thought, I’ve added six 10kΩ pullup resistors: three are on signals coming from the printer – /ERROR, /ACK and SELECT; and three are signals from the microcontroller – /STROBE, /INIT and /AUTOFEED. You’ll notice that most of those are active low.
The SELECT signal is active high, but is also normally held high. It’s been the subject of much soul-searching. For the time being, I’m pulling it high but may experiment with pulling it low.
The pullup resistors connect to a positive rail that itself is powered from the main +5V rail via a diode. This is to prevent the board being powered by the printer via signals that connect through the pullup resistors to the main power rail. Even with the diode in place, the pullup rail is seeing 4.7V, which is plenty high enough for logic purposes.
The BUSY and PE (paper end) signals are active high and, by default, are pulled low by the printer. For the time being, I’m happy to let the dice fall where they may on those signals.
Fire it up
Oh well, time to try it out.
And it works!
Well, why wouldn’t it? This is a pretty basic circuit – a shift register and a buffer chip. There’s really no excuse for it not working. It’s just that trying to execute the design on a crappy breadboard with all those flying wires was introducing issues.
The next steps will be to:
- Add the 74HC14 inverter IC and some status LEDs.
- Add the blinkenlights to the data lines (although I already have some dark suspicions about this idea).
- Perhaps try the SELECT line with a pulldown instead of a pullup resistor.
- Maybe add a pulldown to the /SELECT-IN line.
There is one other minor niggle. Although the random resets have disappeared when the SmartParallel board is in use, once it’s powered down, they return. Presumably this is because the /INIT line is no longer being held high by the board. The printer holds this line high by default, but it seems some current is being sunk somewhere along the way. I could search for where this is happening and maybe think about another diode. Or I can live with it – on the basis that why would you have the printer switched on but not the SmartParallel board?