This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
pinouts [2021/08/29 21:37]
– [V.Smile cartridges] pulkomandy
pinouts [2021/09/23 22:56] (current)
– [Flow control] Document it a bit more clearly pulkomandy
Line 80: Line 80:
 ===== Flow control ===== ===== Flow control =====
-When the console sends byte, first CTS goes high, then the console sends the bits on the Tx line. When done, CTS goes low again.+The CPU has single UART that is used to communicate with both controllers. This requires flow control to make sure the two controllers don't try to communicate at the same time.
-When the controller sends a byte, RTS goes low first, then it waits for CTS to be up. Then RTS goes up and sends its byte. Finally CTS goes low again.+controller is activated (both for transmission and reception) by setting its CTS pin high. Controllers can request attention from the console when they have data to send using their RTS line.
-If there are multiple bytes to send, RTS remains down until the start of the last byte.+The general way to handle this is as followsstarting from an idle state with all CTS low and no pending data transfers 
 +  * If a controller has its RTS pin low, select it by setting the corresponding CTS high 
 +  * The controller will start transmitting data, receive that from the Rx register until "Rx ready" is cleared 
 +  * If needed, send a reply to the controller 
 +  * Make sure the reply is completely sent ("Tx buffer empty" in status register) 
 +  * Wait until RTS goes high (the controller has nothing to send anymore) 
 +  * Put CTS low again 
 +  * Wait a little (in case the controller was sending something just as you set CTS low) and read a possible last byte from the UART 
 +  * You are back to idle state 
 +It is possible to send something to a controller even if it was not requesting RTS: 
 +  * Select the controller by setting the corresponding CTS high 
 +  * Send data to the controller 
 +  * Make sure the reply is completely sent ("Tx buffer empty" in status register) 
 +  * Check that RTS did not become low 
 +  * Put CTS high again 
 +  * Back to idle state 
 +The controller keeps RTS down as long as it has more bytes to send.
 ===== Messages from the controller ===== ===== Messages from the controller =====
pinouts.txt · Last modified: 2021/09/23 22:56 by pulkomandy
CC Attribution 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0