When SPI is to be used within a transceiver setting with strict timing requirements in peripheral mode response, the software overhead associated with loading/transmitting data can, in some cases, be limiting.
To ensure that the latest data (for example FIFO level, RSSI value, event flags, and so on) is contained in the peripheral header, a mechanism to atomically update the FIFO with header data several times before the external controller starts an SPI transmission is included.
SPI.TXFHDR32, SPI.TXFHDR24, SPI.TXFHDR16, and SPI.TXFHDR8 registers are included within the SPI module. When any of these registers are written:
- The write is ignored if the external controller has already started transmission by pulling the CS low.
- If no active SPI transmission is ongoing, the RXFIFO and TXFIFO pointers are reset.
- The TX CRC engine is reset to a value of all ones.
- Depending on whether TXFHDR8, TXFHDR16, TXFHDR24, TXFHDR32 registers are written – 1, 2, 3, or 4 bytes of data are written into the TXFIFO in consecutive CLKSVT cycles.
- µDMA and CPU interrupts are blocked until the written header is committed on the POCI, after the controller starts SPI transmissions so that no active CPU or µDMA jobs fill up the TXFIFO at the same time as the header gets updated by this feature.
The SPI.TXFHDRC register is included to control this feature. The SPI.TXFHDRC register contains these fields:
- HDREN – This bit has to be set to enable the atomic header feature when CSGATE is set to BLK. Otherwise, any write to TXFHDR registers sets this bit automatically.
- HDRCMT – This bit is set when the external controller pulls the CS low and the peripheral commits the header written into the FIFO on the POCI. This bit continues to be set until the software clears it. The hold on CPU or µDMA interrupt lines is released when this bit is set.
- HDRIGN – This bit is set when a write to header registers occurs after the HDRCMT is set. This bit can be polled by software to figure out whether the last payload was written to the TXFIFO or not.
- CSGATE – This is set to UNBLK by default. The first header write can occur even when CS is low (active). When CSGATE is set to BLK, the header writes must occur only when CS is inactive.
SPI.CTL0[17] IDLEPOCI register bit is included to drive a configurable high/low value of the POCI pin to ease signaling to the controller about a change in the peripheral readiness. If the MSB of header data written into the FIFO is opposite to the IDLEPOCI, the external controller can detect the same by polling the POCI pin.