143
MC95FG308 / MC95FG208
ABOV Semiconductor Co., Ltd.
11.8.3 Data Transmit / Receive Operation
User can use SPI for serial data communication by following step
1. Select SPI operation mode(master/slave, polarity, phase) by control register SPICR.
2. When the SPI is configured as a Master, it selects a Slave by SS signal (active low). When the SPI is configured
as a Slave, it is selected by SS signal incoming from Master
3. When the user writes a byte to the data register SPIDR, SPI will start an operation.
4. In this time, if the SPI is configured as a Master, serial clock will come out of SCK pin. And Master shifts the eight
bits into the Slave (transmit), Slave shifts the eight bits into the Master at the same time (receive). If the SPI is
configured as a Slave, serial clock will come into SCK pin. And Slave shifts the eight bits into the Master (transmit),
Master shifts the eight bits into the Slave at the same time (receive).
5. When transmit/receive is done, TCIR (Transmit Complete or Interrupt Request) bit will be set. If the SPI interrupt is
enabled, an interrupt is requested. And TCIR bit is cleared by hardware when executing the corresponding
interrupt. If SPI interrupt is disable, TCIR bit is cleared when user read the status register SPISR, and then access
(read/write) the data register SPIDR.
NOTE)
1. If you want to use both transmit and receive, set the TXENA, RXENA bit of SPISR, and if user want to use
only either transmit or receive, clear the TXENA or RXENA. In this case, user can use disabled pin by GPIO
freely.
11.8.4 SS pin function
1. When the SPI is configured as a Slave, the SS pin is always input. If LOW signal come into SS pin, the SPI logic
is active. And if ‘HIGH’ signal come into SS pin, the SPI logic is stop. In this time, SPI logic will be reset, and
invalidated any received data.
2. When the SPI is configured as a Master, the user can select the direction of the SS pin by port direction register
(PxIO[x]). If the SS pin is configured as an output, user can use general GPIO output mode. If the SS pin is
configured as an input, ‘HIGH
’
signal must come into SS pin to guarantee Master operation. If ‘LOW’ signal come
into SS pin, the SPI logic interprets this as another master selecting the SPI as a slave and starting to send data to
it. To avoid bus contention, MS bit of SPICR will be cleared and the SPI becomes a Slave and then, TCIR bit of
SPISR will be set, and if the SPI interrupt is enabled, an interrupt is requested.
NOTE)
1. - When the SS pin is configured as an output at Master mode, SS pin’s output value is defined by user’s
software (PxDA[x]). Before SPICR setting, the direction of SS pin must be defined
2. - If you don’t need to use SS pin, clear the SSENA bit of SPISR. So, you can use disabled pin by GPIO freely.
In this case, SS signal is driven by ‘HIGH’ or ‘LOW’ internally. In other words, master is ‘HIGH’, salve is ‘LOW’
3. - When SS pin is configured as input(master or slave), if ‘HIGH’ signal come into SS pin, this flag bit will be
set at the SS rising time. And you can clear it by writing ‘0’.
Содержание MC95FG208 Series
Страница 14: ...14 MC95FG308 MC95FG208 ABOV Semiconductor Co Ltd 4 Package Diagram Figure 4 1 32 Pin SOP Package...
Страница 15: ...15 MC95FG308 MC95FG208 ABOV Semiconductor Co Ltd Figure 4 2 32 Pin QFN Package...
Страница 16: ...16 MC95FG308 MC95FG208 ABOV Semiconductor Co Ltd Figure 4 3 32 Pin LQFP Package...
Страница 17: ...17 MC95FG308 MC95FG208 ABOV Semiconductor Co Ltd Figure 4 4 28 Pin SOP Package...
Страница 18: ...18 MC95FG308 MC95FG208 ABOV Semiconductor Co Ltd Figure 4 5 28 Pin SOP Package continue...
Страница 19: ...19 MC95FG308 MC95FG208 ABOV Semiconductor Co Ltd Figure 4 6 28 Pin SOP Package...
Страница 20: ...20 MC95FG308 MC95FG208 ABOV Semiconductor Co Ltd Figure 4 7 28 Pin TSSOP Package...
Страница 21: ...21 MC95FG308 MC95FG208 ABOV Semiconductor Co Ltd Figure 4 8 20 Pin SOP Package...
Страница 22: ...22 MC95FG308 MC95FG208 ABOV Semiconductor Co Ltd Figure 4 9 20 Pin TSSOP Package...
Страница 23: ...23 MC95FG308 MC95FG208 ABOV Semiconductor Co Ltd Figure 4 10 16 Pin SOP Package...
Страница 24: ...24 MC95FG308 MC95FG208 ABOV Semiconductor Co Ltd Figure 4 11 16 Pin TSSOP Package...