Hi
My SPI Master wraps SPI comms using a couple of additional logic lines nReadFromSlave (Master Output) and nSlaveReady (Master Input).
It treats an SPI transaction as a Write (of 8 bytes), followed by a read of the ACK/NAK response which is a single byte. The master takes the slave's CS line low at the start of the write, and high again once the read of the Ack/Nak response has been completed.
Nordic's default SPI-Slave behaviour in all the examples etc is that you ONLY get an event indicating SPI Write to Master complete when CS is Taken High. This wont work in my scenario - rather, I need an event when 8 bytes have been received (eg supplied buffer full), not when the state of CS changes.
How to achieve this. It looks from the Docs that this should be possible using the ENDRX register by configuring the following during SPIS setup:
NRF_SPIS1->INTENSET |= ((SPIS_INTENSET_ENDRX_Enabled << SPIS_INTENSET_ENDRX_Pos) | (SPIS_INTENSET_END_Enabled << SPIS_INTENSET_END_Pos) | (SPIS_INTENSET_ACQUIRED_Enabled << SPIS_INTENSET_ACQUIRED_Pos));
I would have thought that this should cause the SPIS to call the handler for all SPI conditions, but I note that in the upper levels, there is not even an enumerated type for the ENDRX event:
/** @brief SPI slave driver event types. */
typedef enum
{
NRFX_SPIS_BUFFERS_SET_DONE, //!< Memory buffer set event. Memory buffers have been set successfully to the SPI slave device, and SPI transaction can be done.
NRFX_SPIS_XFER_DONE, //!< SPI transaction event. SPI transaction has been completed.
NRFX_SPIS_EVT_TYPE_MAX //!< Enumeration upper bound.
} nrfx_spis_evt_type_t;
How do I manually attach the ENDRX event to a brand new callback in my code? How do I signal the SPIS CS line internally (eg eithout wiring an input to an output!) that the transaction is complete?
Am I just doing to have to write my own SPIS code using the HAL functions?
Nigel