ZHCSTD7A December 2021 – November 2023 BQ79631-Q1
PRODUCTION DATA
The GPIO4 thru GPIO7 are configurable as a SPI master interface when GPIO_CONF1[SPI_EN] = 1. The SPI master includes four I/Os:
The SPI_CONF[CPOL] (clock polarity) and [CPHA] (clock phase) define the SPI clock format. The [CPOL] is defined if the SPI clock is inverted or non-inverted. The [CPHA] is defined if the MISO and MOSI are sampled on the leading (first) clock edge or on the trailing (second) clock edge, regardless of whether that clock edge is rising or falling. The SPI_CONF[NUMBIT4:0] defines how many bits the transaction is (1-bit to 24-bit transaction).
Step | Description |
---|---|
1 | Configure the SPI clock polarity, clock phase, number of bit transactions: a. Write to SPI_CONF register to configure SPI communication |
2 | Write the data (from 1 to 24 bits, specified in the SPI_CONF[NUMBIT4:0] setting): a. Set up the data to send to SPI slave to the SPI_TX1 to SPI_TX3 registers b. SPI_TX1 is the LSByte and SPI_TX3 is MSByte |
3 | Select the slave (assuming active low) and execute the SPI write action: a. Send SPI_EXE register = 0x01 (that is, [SS_CTRL] = 0 and [SPI_GO] = 1) |
4 | Wait for the SPI communication to complete |
5 | Deselect the SS port (assuming active low, so deselecting means pull the SS pin high): a. Send SPI_EXE register = 0x02 (that is, [SS_CTRL] = 1 and [SPI_GO] = 0) |
Step | Description |
---|---|
1 | Configure the SPI clock polarity, clock phase, number of bit transactions: a. Write to SPI_CONF register to configure SPI communication |
2 | Select the slave and execute the SPI communication: a. Send SPI_EXE register = 0x01 (that is, [SS_CTRL] = 0 and [SPI_GO] = 1) |
3 | Wait for the data transaction to complete |
4 | Read the data (from 1 to 24 bits, specified in the SPI_CONF[NUMBIT4:0] setting): a. Read data from SPI slave from the SPI_RX1 to SPI_RX3 registers b. SPI_TX1 is the LSByte and SPI_TX3 is MSByte |
5 | Deselect the SS port (assuming active low, so deselecting means pull the SS pin high): a. Send SPI_EXE register = 0x02 (that is, [SS_CTRL] = 1 and [SPI_GO] = 0) |