I would like to communicate with an old electronic device which offers a bidirectional digital data interchange interface based on asynchronous serial protocol (8251A IC on the device): LSB first, 8 data bits, 2 stop bits, odd parity, and a Baud rate of 31.25 kHz .
The physical connection consists on 7 wires (3 wires in each direction plus a shared ground):
- Rx Busy [out]
- Rx Data [in]
- Rx Clock [in]
- Ground
- Tx Busy [in]
- Tx Data [out]
- Tx Clock [out]
Signals are standard TTL 0-5V, except the Rx Busy output, which is an open collector pulldown.
[EDIT] Communication is full duplex.
Despite the communication being asynchronous, Rx clock is actually being generated by the transmitter, so that the receiver's UART samples the incoming signal at a pace imposed by the transmitter.
While writing this post, I was temped to write "strobe" instead of "clock"; but observing the circuit of the old electronic device, I found that the outbound clock signal is actually generated by a ceramic resonator running at 4 MHz; this is then divided:
- by 2 => 2 MHz: is the input main clock of the 8251A
- by 128 => 31.25 kHz: is the transmission clock that is fed into the 8251A [TxC] AND output to the [Tx Clock] wire
I suppose that the Serial library is noway useful to handle such a communication; moreover I suspect that builtin USART of the AVR is not able to natively accomplish the task (I've read the datasheet and I didn't find anything regarding external clock for USART operations)
One option could be:
- For transmission: setup a timer-based interrupt (at the 31.25 * 2 = 62.50 kHz frequency) and generate the outbound clock signal [Tx Clock] and, in the same time, send data [Tx Data] together with start/stop/parity bits
- For reception: attach an interrupt routine to the digital pin bound to the [Rx Clock] signal: the routine should then handle the [Rx Data] pin; once again, framing logic has to be handled in software..
1st question: could this be a feasible approach? I'm somewhat concerned about CPU time spent in interrupt handling; second, protocol handling logic (especially for reception) could not be so easy..
Another solution could be: use an external USART ![]()
2nd question: could be this a better approach? Using USART chips is a completely new territory for me, so suggestions are welcome on which IC to consider in order to integrate with an Arduino board... [P.S: the IC on the old electronic device is a PD8251AC or a MSL8251AP]
Sorry for the long post, but I hope that I was clear enough.
Thank you in advance.
Ale



