RL78/G13 Handshake-based SPI Master Transmission/Reception
R01AN6883EJ0100 Rev.1.00 Page 9 of 38
June.15.23
(4) After initialization is completed, the master performs communication with the slave as shown in the
following steps.
① The master waits in HALT mode for a 1-ms interval timer interrupt (INTTM03H).
②
When the master is released from HALT mode by an INTTM03 interrupt, it issues the CS signal to
select the slave that is specified in the g_slave_select_flag flag, and then waits for a response from
the slave.
③ When the BUSY signal goes low, the master proceeds to step 4. When a timeout is detected, the
master deselects the slave and proceeds to step 9.
④
The master transmits a status check command and receives the slave status. When a timeout is
detected, or the slave status cannot be received, the master deselects the slave and proceeds to step
9. When the slave status is received, the master deselects the CS
signal.
⑤ The master again waits in HALT mode for a 1-ms interval timer interrupt (INTTM03H).
⑥
When the master is released from HALT mode by an INTTM03 interrupt again, it issues the CS signal
to select the slave that is specified in the g_slave_select_flag flag, and then waits for a response from
the slave.
⑦ When the master detects that the BUSY signal goes low, it proceeds to step 8. When a timeout is
detected, the master deselects the slave and proceeds to step 9.
⑧ The master transmits and receives the number of data characters according to the status checked in
step 4. When a timeout is detected, the master deselects the slave.
⑨ The master changes the g_slave_select_flag flag to switch the target slave. These steps are
subsequently repeated from step 1.
(5) Commands
Each communication operation begins with the transmission of a 1-byte command. Table 1-4 lists the
command formats. The master transmits a status check command and receives the response from the slave
in the first slot of a communication sequence. The master Confirm that the number of data characters that
the target slave can transmit or receive is equal to or greater than the specified number of data characters to
be transmitted or received. Then, the master transmits/receives data for the specified number of data
characters to/from the slave.
Table 1-4 Command Formats
Checks the number of data characters that the slave can
transmit or receive. The following responses can be made by
the slave:
01xxxxxxB: The number of characters that the slave can
transmit is xxxxxxB.
00xxxxxxB: The number of characters that the slave can
The master receives xxxxxxB bytes of data.
The master transmits xxxxxxB bytes of data.
The master transmits and receives xxxxxxB bytes of data.