Rev. 1.10
108
November 04, 2019
Rev. 1.10
109
November 04, 2019
HT45F5Q-3
Battery Charger Flash MCU
HT45F5Q-3
Battery Charger Flash MCU
• Step 8
Clear TRF.
• Step 9
Go to step 4.
Slave Mode
•
Step 1
Select the SPI Slave mode using the UMD and SIM2~SIM0 bits in the SIMC0 control register
• Step 2
Setup the CSEN bit and setup the MLS bit to choose if the data is MSB or LSB first, this setting
must be the same with the Master devices.
•
Step 3
Setup the SIMEN bit in the SIMC0 control register to enable the SPI interface.
•
Step 4
For write operations: write the data to the SIMD register, which will actually place the data into
the TXRX buffer. Then wait for the master clock SCK and SCS signal. After this, go to step 5.
For read operations: the data transferred in on the SDI line will be stored in the TXRX buffer
until all the data has been received at which point it will be latched into the SIMD register.
• Step 5
Check the WCOL bit if set high then a collision error has occurred so return to step 4. If equal to
zero then go to the following step.
• Step 6
Check the TRF bit or wait for a USIM SPI serial bus interrupt.
•
Step 7
Read data from the SIMD register.
• Step 8
Clear TRF.
• Step 9
Go to step 4.
Error Detection
The WCOL bit in the SIMC2 register is provided to indicate errors during data transfer. The bit is
set by the SPI serial Interface but must be cleared by the application program. This bit indicates that
a data collision has occurred which happens if a write to the SIMD register takes place during a data
transfer operation and will prevent the write operation from continuing.
I
2
C Interface
The I
2
C interface is used to communicate with external peripheral devices such as sensors,
EEPROM memory etc. Originally developed by Philips, it is a two line low speed serial interface
for synchronous serial data transfer. The advantage of only two lines for communication, relatively
simple communication protocol and the ability to accommodate multiple devices on the same bus
has made it an extremely popular interface type for many applications.
Device
Slave
Device
Master
Device
Slave
VDD
SDA
SCL
I
2
C Master Slave Bus Connection