AMIS−30521, NCV70521
http://onsemi.com
22
Examples of Combined READ and WRITE Operations
In the following examples successive READ and WRITE
operations are combined. In Figure 19 the Master first reads
the status from Register at ADDR4 and at ADDR5 followed
by writing a control byte in Control Register at ADDR2.
Note that during the write command (in Figures 18 and 19)
the old data of the pointed register is returned at the moment
the new data is shifted in.
Figure 19. Two Successive READ Commands Followed by a WRITE Command
COMMAND COMMAND COMMAND COMMAND
DATA DATA DATA DATA
DO
DI
CS
DATA from previous
command or NOT VALID
after POR or RESET
READ DATA
from ADDR4
READ DATA
from ADDR5
WRITE DATA
to ADDR2
NEW DATA
for ADDR2
OLD DATA
or NOT VALID
DATA
from ADDR4
DATA
from ADDR5
OLD DATA
from ADDR2
The NEW DATA is written into the corresponding
internal register at the rising edge of CS
Registers are updated with the internal status at the
rising edge of the internal AMIS−30521/NCV70521
clock when CS = 1
After the write operation the Master could initiate a read
back command in order to verify if the data is correctly
written, as illustrated in Figure 20. During reception of the
READ command the old data is returned for a second time.
Only after receiving the READ command the new data is
transmitted. This rule also applies when the master device
wants to initiate an SPI transfer to read the Status Registers.
Because the internal system clock updates the Status
Registers only when CS
line is high, the first read out byte
might represent old status information.
COMMAND
DATA DATA DATA DATA
OLD DATA
or NOT VALID
OLD DATA
from ADDR2
OLD DATA
from ADDR2
NEW DATA
from ADDR2
DO
DI
CS
Figure 20. A WRITE Operation Where DATA From the Master is Written in SPI Register with Address 2 Followed
by a READ Back Operation to Verify a Correct WRITE Operation
DATA COMMAND
WRITE DATA
to ADDR2
NEW DATA
for ADDR2
READ DATA
from ADDR2
COMMAND or
DUMMY
Registers are Updated with the Internal Status at the
Rising Edge of CS
Registers are Updated with the Internal Status at the
Rising Edge of the Internal 521 Clock when CS
= 1
NOTE: The internal data−out shift buffer of the AMIS−30521/NCV70521 is updated with the content of the selected SPI register only at
the last (every eighth) falling edge of the CLK signal (see SPI Transfer Format and Pin Signals). As a result, new data for
transmission cannot be written to the shift buffer at the beginning of the transfer packet and the first byte shifted out might
represent old data.
Table 11. SPI CONTROL REGISTERS (All SPI Control Registers have Read/Write Access and default to ”0” after Power−on or
hard reset)
Address
Content
Structure
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Access R/W R/W R/W R/W R/W R/W R/W R/W
Reset 0 0 0 0 0 0 0 0
CR0 (01h) Data SM[2:0] CUR[4:0]
CR1 (02h) Data DIRCTRL NXTP − − PWMF PWMJ EMC[1:0]
CR2 (03h) Data MOTEN SLP SLAG SLAT − − − −
Where:
R/W: Read and Write access
Reset: Status after Power−On or hard reset