AN202
V1.0 | Page 12/73
www.cmostek.com
Among them, TWI_WRREG represents the write operation of the register; TWI_RDREG represents the read
operation of the register, detailed as follows:
Table 2-3. TWI_WRREG and TWI_RDREG
Command
Description
TWI_WRREG
TWI write operation, Pseudo instruction format: TWI_WRREG(XX
,
YY) represents a set
of 16 clock data streams
,
0b
’10xx xxxx yyyy yyyy
,
where 0b 'XX XXXX is the address
of the target operation register, the range is from 0x00 to 0x3F; 0b 'yyyy yyyy is the
value that needs to be written to the target register, and the range is from 0x00 to 0xFF.
For example, TWI_WRREG (0x12, 0xAA), the data stream is 0x92AA.
TWI_RDREG
TWI read operation, Pseudo instruction format: TWI_RDREG(XX, ZZ) represents a set
of 16 clock data streams
,
0b
’11xx xxxx zzzz zzzz
,
where 0b 'XX XXXX is the address
of the target operation register, and the range is from 0x00 to 0x3F; 0b 'Zzzz Zzzz is the
read value of the target register, and the range is from 0x00 to 0xFF.
For example: TWI_RDREG (0x2A, DAT), the high 8-bit data stream is 0xEA, and the
low 8-bit data stream is the actual read value.
2.5
TWI Timing Enter and Exit
In the TWI bus, RFDAT is the data line of the TWI, and it is also the data line of Tx. When the RFDAT edge
changes, in order to distinguish between entering the Tx status or the TWI configuration mode, users need to
access to the TWI configuration mode by a specific operation.
Here are three sets of special commands:
SOFT_RST
:
Reset command of RF part circuit
TWI_RST
:
TWI bus reset timing. Enter the TWI configuration mode after operation.
TWI_OFF
:
TWI bus closing timing. Exit the TWI configuration mode after operation.
Table 2-4. TWI Command Description
Command
Descriptions
TWI_RST
Hold RFDAT continuously to low level (Not allowed to be pulled up in the middle). RFCLK
sends 32 clock signals continuously, which is 4 bytes of 0x00, and then sends a set of 0x8D00
command. Thereafter RF enters the TWI configuration mode, the RFDAT change will no longer
trigger the Tx status.
TWI_OFF
In the TWI configuration mode, send a set of 0x8D02 command. Thereafter exit the TWI
configuration mode, the RFDAT change will trigger the Tx status.
SOFT_RST
At any time, when sending a set of 0xBD01 command, RF part executes reset. After reset, RF
part enters the SLEEP mode directly to wait for the RFDAT edge to trigger the Tx status.