Generating "bidirectional synchronous serial"
Hello,
I'm working through the PS/2 interface, and it requires a bidirectional synchronous serial protocol. My first thought (and supported by subsequent research) is that FullDuplexSerial.spin would work for this. However, the protocol requires a signal line and a clock line, while the FullDuplexSerial just takes a tx pin and a rx pin. What am I overlooking?
I'm working through the PS/2 interface, and it requires a bidirectional synchronous serial protocol. My first thought (and supported by subsequent research) is that FullDuplexSerial.spin would work for this. However, the protocol requires a signal line and a clock line, while the FullDuplexSerial just takes a tx pin and a rx pin. What am I overlooking?
Comments
http://www.computer-engineering.org/ps2protocol/
has the missing bits. One clock line driven by the device, one data line driven either by the device or the host. Both ends of the data line should be open-collector with input buffers. You just simulate this using a PIN as output only when needed (when sending a '0') and turning it into input when the line needs to be pulled high.
I hope it helps
Ale
FullDuplexSerial will not work for this because it's intended for asynchronous serial communications, not synchronous. The approximate clock is specified by the Baud and the synchronization is done using a start and stop bit with the leading edge of the start bit marking the start of a bit time. The stop bit will ensure that the start bit leading edge can be recognized.