MC96F6432
June 22, 2018 Ver. 2.9
251
2. Load SLA1+W into the USI1DR where SLA1 is address of slave device and W is transfer direction from
the viewpoint of the master. For master transmitter, W is
‘0’. Note that USI1DR is used for both address
and data.
3. Configure baud rate by writing desired value to both USI1SCLR and USI1SCHR for the Low and High
period of SCL1 line.
4. Configure the USI0SDHR to decide when SDA1 changes value from falling edge of SCL1. If SDA1
should change in the middle of SCL1 LOW period, load half the value of USI1SCLR to the USI1SDHR.
5. Set the STARTC1 bit in USI1CR4. This transmits a START condition. And also configure how to handle
interrupt and ACK signal. When the STARTC1 bit is set, 8-bit data in USI1DR is transmitted out
according to the baud-rate.
6. This is ACK signal processing stage for address packet transmitted by master. When 7-bit address and
1-bit transfer direction is transmitted to target slave device, the master can know whether the slave
acknowledged or not in the 9
th
high period of SCL1. If the master gains bus mastership, I2C generates
GCALL interrupt regardless of the reception of ACK from the slave device. When I2C loses bus
mastership during arbitration process, the MLOST1 bit in USI1ST2 is set, and I2C waits in idle state or
can be operate as an addressed slave. To operate as a slave when the MLOST1 bit in USI1ST2 is set,
the ACK1EN bit in USI1CR4 must be set and the received 7-bit address must equal to the USI1SLA[6:0]
bits in USI1SAR. In this case I2C operates as a slave transmitter or a slave receiver (go to appropriate
section). In this stage, I2C holds the SCL1 LOW. This is because to decide whether I2C continues serial
transfer or stops communication. The following steps continue assuming that I2C does not lose
mastership during first data transfer.
I2C (Master) can choose one of the following cases regardless of the reception of ACK signal from slave.
1) Master receives ACK signal from slave, so continues data transfer because slave can receive more
data from master. In this case, load data to transmit to USI1DR.
2) Master stops data transfer even if it receives ACK signal from slave. In this case, set the STOPC1 bit
in USI1CR4.
3) Master transmits repeated START condition with not checking ACK signal. In this case, load
SLA1+R/W into the USI1DR and set STARTC1 bit in USI1CR4.
After doing one of the actions above, clear to
“0b” all interrupt source bits in USI1ST2 to release SCL1
line. In case of 1), move to step 7. In case of 2), move to step 9 to handle STOP interrupt. In case of 3),
move to step 6 after transmitting the data in USI1DR and if transfer direction bit is
‘1’ go to master
receiver section.
7. 1-Byte of data is being transmitted. During data transfer, bus arbitration continues.
8. This is ACK signal processing stage for data packet transmitted by master. I2C holds the SCL1 LOW.
When I2C loses bus mastership while transmitting data arbitrating other masters, the MLOST1 bit in
USI1ST2 is set. If then, I2C waits in idle state. When the data in USI1DR is transmitted completely, I2C
generates TEND1 interrupt.
I2C can choose one of the following cases regardless of the reception of ACK signal from slave.
1) Master receives ACK signal from slave, so continues data transfer because slave can receive more
data from master. In this case, load data to transmit to USI1DR.
2) Master stops data transfer even if it receives ACK signal from slave. In this case, set the STOPC1 bit
in USI1CR4.
3) Master transmits repeated START condition with not checking ACK signal. In this case, load
SLA1+R/W into the USI1DR and set the STARTC1 bit in USI1CR4.
After doing one of the actions above, clear to
“0b” all interrupt source bits in USI1ST2 to release SCL1
line. In case of 1), move to step 7. In case of 2), move to step 9 to handle STOP interrupt. In case of 3),
move to step 6 after transmitting the data in USI1DR, and if transfer direction bit is
‘1’ go to master
receiver section.
9. This is the final step for master transmitter function of I2C, handling STOP interrupt. The STOP bit
indicates that data transfer between master and slave is over. To clear USI1ST2, write
“0” to USI1ST2.
After this, I2C enters idle state.
The next figure depicts above process for master transmitter operation of I2C.
Содержание MC96F6332D
Страница 24: ...MC96F6432 24 June 22 2018 Ver 2 9 4 Package Diagram Figure 4 1 48 Pin LQFP 0707 Package...
Страница 25: ...MC96F6432 June 22 2018 Ver 2 9 25 Figure 4 2 44 Pin MQFP Package...
Страница 26: ...MC96F6432 26 June 22 2018 Ver 2 9 Figure 4 3 32 Pin LQFP Package...
Страница 27: ...MC96F6432 June 22 2018 Ver 2 9 27 Figure 4 4 32 Pin SOP Package...
Страница 28: ...MC96F6432 28 June 22 2018 Ver 2 9 Figure 4 5 28 Pin SOP Package...