Rev. 1.10
82
November 26, 2019
Rev. 1.10
83
November 26, 2019
HT68FB240
USB Low Speed Flash MCU
Slave Mode
• Step 1
Select the SPI Slave mode using the 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 device.
• 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 step5.
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 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 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. The overall function of the
WCOL bit can be disabled or enabled by the SIM_WCOL bit in the SBSC register.