Page 53 of 90
CCT24
the end of each received message. Figure 4.2.4.1 shows a typical relation ship between the /SS line (red
trace) and the SCLK line (blue trace).
Figure 4.2.4.1
When periodic I/O reporting is enabled on a CCT24 remote configured as an SPI Master, the remote will
clock out a stored command string,
SPI_MasterCmdStr
, to collect data from a Slave peripheral each time
the I/O report timer fires. The collected data is then transmitted to the base as a
TXData
message.
Alternatively, a host connected to the base can transmit an SPI command as a
TXData
message to the
remote. The remote will clock the command into its Slave peripheral and transmit back the Slave’s re-
sponse. In either case, the command string and response string are limited to 32 bytes. Only data mes-
sages are routed through the CCT24’s SPI port in Master mode. Command packets and command re-
plies are routed through the primary serial port.
When configured as an SPI Master, the CCT24 sets /SS low one SPI bit period before the start of mes-
sage clocking and sets /SS high after clocking the last message bit. When the CCT24 is operating in SPI
Slave mode, the Master (host) must set /SS low at least one SPI bit period before clocking data in/out of
the CCT24. See the
SPI_Divisor
description below.
Changes to the
SPI_Mode
setting must be saved and the CCT24 reset to take effect. This avoids the
possibility of setting SPI mode inadvertently and being unable to communicate with the CCT24 to switch it
back to serial mode. If the /CFG pin is grounded at power up, the
SPI_Mode
setting is overridden and the
CCT24 will start up in serial (UART) mode.
SPI_Divisor
- this parameter sets the clock rate in SPI Master mode and clock rate related timing, such as
/SS sampling, in Slave mode. The SPI rate is set according to the following formula:
SPI rate in b/s = 806400/SPI_Divisor
The valid range for
SPI_Divisor
is 1 to 127, providing SPI rates from 6.35 to 80.64 kb/s. For best data
transfer efficiency in Slave mode, the Master (host) clock rate should closely match the CCT24 SPI data
rate setting.
SPI_Options
- this parameter sets the clock options for the SPI modes:
Setting
Clock Option
0x00
Normal operation
0x01
Second clock edge
0x02
High idle clock polarity
0x03
Second clock edge with high idle clock polarity