English
Language : 

HT68FB540 Datasheet, PDF (146/199 Pages) Holtek Semiconductor Inc – I/O Flash USB 8-Bit MCU with SPI
HT68FB540/HT68FB550/HT68FB560
I/O Flash USB 8-Bit MCU with SPI
SPIA Operation
All communication is carried out using the 4-line interface for either Master or Slave Mode.
The SACSEN bit in the SPIAC1 register controls the overall function of the SPIA interface. Setting
this bit high will enable the SPIA interface by allowing the SCSA line to be active, which can then
be used to control the SPIA interface. If the SACSEN bit is low, the SPIA interface will be disabled
and the SCSA line will be an I/O pin or the other functions and can therefore not be used for control
of the SPIA interface. If the SACSEN bit and the SPIAEN bit in the SPIAC0 register are set high,
this will place the SDIA line in a floating condition and the SDOA line high. If in Master Mode the
SCKA line will be either high or low depending upon the clock polarity selection bit SACKPOLB
in the SPIAC1 register. If in Slave Mode the SCKA line will be in a floating condition. If SPIAEN is
low then the bus will be disabled and SCSA, SDIA, SDOA and SCKA will all become I/O pins or the
other functions. In the Master Mode the Master will always generate the clock signal. The clock and
data transmission will be initiated after data has been written into the SPIAD register. In the Slave
Mode, the clock signal will be received from an external master device for both data transmission
and reception. The following sequences show the order to be followed for data transfer in both
Master and Slave Mode:
Master Mode
• Step 1
Select the clock source and Master mode using the SASPI2~SASPI0 bits in the SPIAC0 control
register
• Step 2
Setup the SACSEN bit and setup the SAMLS bit to choose if the data is MSB or LSB first, this
must be same as the Slave device.
• Step 3
Setup the SPIAEN bit in the SPIAC0 control register to enable the SPIA interface.
• Step 4
For write operations: write the data to the SPIAD register, which will actually place the data into
the TXRX buffer. Then use the SCKA and SCSA lines to output the data. After this go to step 5.
For read operations: the data transferred in on the SDIA line will be stored in the TXRX buffer
until all the data has been received at which point it will be latched into the SPIAD register.
• Step 5
Check the SAWCOL 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 SATRF bit or wait for a SPIA serial bus interrupt.
• Step 7
Read data from the SPIAD register.
• Step 8
Clear SATRF.
• Step 9
Go to step 4.
Rev. 1.10
146
June 10, 2013