Figure 6.13-13 Master Transmitter Mode Control Flow - Nuvoton ISD94124BYI Technical Reference Manual

Isd arm cortex-m4f soc
Table of Contents

Advertisement

6.13.5.2.2 Master Mode
Figure 6.13-13 and Figure 6.13-14 illustrates the work flow as a Master Transmitter and a Master
Receiver, respectively.
Writing 1 to STA bit (I2C_CTL[5]) enters Master mode. This operation generates a START condition
and therefore a new I2C session is started. An interrupt will be generated if I2C interrupt is enabled.
In ISR, software always checks the I2C_STATUS value first, then proceeds by manipulating
I2C_CTL control bits and I2C_DAT data registers, etc.
MT
STATUS=0x08
S
(STA,STO,SI,AA)=(1,0,1,x)
Master to Slave
Slave to Master
Arbitration Lost
Master Transmitter
MT

Figure 6.13-13 Master Transmitter Mode Control Flow

Sample code for Figure 6.13-13, master mode transmitter:
/* ------ in main routine ------ */
...
/* I2C interface initialization */
...
s_I2C0HandlerFn = (I2C_FUNC)I2C_MasterTx;
I2C_SET_CONTROL_REG(I2C0, I2C_STA);
...
/* ------- I2C interrupt service routine: I2C_MasterTx ------ */
u32Status = I2C_GET_STATUS(I2C0);
Sep 9, 2019
ISD94100 Series Technical Reference Manual
ACK STATUS=0x18
NAK STATUS=0x20
I2C_DAT
ACK/
I2C_DAT
(SLA+W)
NAK
(Data)
I2C_DAT=SLA+W
I2C_DAT=Data
(STA,STO,SI,AA)=(0,0,1,x)
(STA,STO,SI,AA)=(0,0,1,x)
I2C_DAT
(Data)
I2C_DAT=Data
(STA,STO,SI,AA)=(0,0,1,x)
Sr
(STA,STO,SI,AA)=(1,0,1,x)
STATUS=0xF8
P
(STA,STO,SI,AA)=(0,1,1,x)
STATUS=0x08
P
S
(STA,STO,SI,AA)=(1,1,1,x)
(Arbitration Lost) STATUS=0x38
I2C_DAT
ACK/
(SLA+W)
NAK
I2C_DAT=SLA+W
(Arbitration Lost) ACK
(STA,STO,SI,AA)=(0,0,1,x)
STATUS= 0x68, 0x78, 0xB0
I2C_DAT
ACK
(SLA+W)
To corresponding states in
slave mode
I2C_DAT=SLA+W
(STA,STO,SI,AA)=(0,0,1,1)
/* Setup I2C ISR callback function */
/* As an I2C master, generates START condition */
Page 627 of 928
ACK STATUS=0x28
NAK STATUS=0x30
ACK/
NAK
STATUS=0x38
ACK/
NAK
STATUS=0x10
MT
MR
2
I
C bus will be release;
Not addressed SLV mode will be enterd
...
Enter not addressed SLV mode
(STA,STO,SI,AA)=(0,0,1,X)
A START will be transmitted
when the bus becomes free
Send a START when bus
...
becomes free
(STA,STO,SI,AA)=(1,0,1,X)
Rev1.09

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents