Re: GARTHWILSONRe: BigDumbDinosaurGARTHWILSON wrote:
I've used nearly all of the many different features of the '22, but automatic handshaking has not been one of them. The data sheet addresses it though, starting in section 2.2 on page 10. The way I'm thinking of doing it is, this. This is all with the FT245RL USB controller in mind.
READ FROM USBController's !RD is set low via PORTB line 0, by default. USB data is now shifting into controller and thus onto PORT A from the connected device.
Controller pulls !RXF low (it does this internally), connected to VIA's CA1 indicating that the data is ready, PORT A is latched onto DATA bus and IRQ is set.
WRITE TO USBController sets its !TXE low, indicating it is ready to receive data, connected to VIA's CA1.
When the VIA's both CS are active, i.e. it has been addressed and the CPU is writing (R!W is low), it latches DATA bus onto PORT A, since CA1 is low.
On the next clock edge, we set the controller's WR high (via PORTB line 1) and it starts transmitting the data on PORT A to the USB lines.
And on the next clock edge to that, we set the WR low again.
This scheme assumes it takes less time than one CPU clock cycle to transmit one byte over the USB lines.
Please let me know what you think. Have I misunderstood or made an error?