Hello there,
I'm trying to interface msp430 (master) with nrf51882 (slave) through SPI. I'm running soft device 110 to broadcast the received data from SPI through BLE. if I send any sequence of bytes not ending with Zero value, SPI and BLE work as I expected, but if the sequence of bytes ends with zero value the following if condition did not fulfill which indicating SPI transmission is not successfully completed.
if (event.evt_type == NRF_DRV_SPIS_XFER_DONE)
Here is my SPI config for nrf51822:
#define DEF_CHARACTER 0xAAu /**< SPI default character. Character clocked out in case of an ignored transaction. */
#define ORC_CHARACTER 0x55u /**< SPI over-read character. Character clocked out after an over-read of the transmit buffer. */
uint32_t spi_peripheral_init(void)
{
nrf_drv_spis_config_t spis_config = NRF_DRV_SPIS_DEFAULT_CONFIG(SPIS_INSTANCE_NUMBER);
spis_config.miso_pin = SPIS_MISO_PIN;
spis_config.mosi_pin = SPIS_MOSI_PIN;
spis_config.sck_pin = SPIS_SCLK_PIN;
spis_config.csn_pin = SPIS_CS_PIN;
spis_config.mode = NRF_DRV_SPIS_MODE_0;
/*
NRF_DRV_SPIS_MODE_0 -----> (CPOL = 0, CPHA = 0)
NRF_DRV_SPIS_MODE_1 -----> (CPOL = 0, CPHA = 1)
NRF_DRV_SPIS_MODE_2 -----> (CPOL = 1, CPHA = 0)
NRF_DRV_SPIS_MODE_3 -----> (CPOL = 1, CPHA = 1)
*/
spis_config.bit_order = NRF_DRV_SPIS_BIT_ORDER_MSB_FIRST;
spis_config.def = DEF_CHARACTER;
spis_config.orc = ORC_CHARACTER;
APP_ERROR_CHECK(nrf_drv_spis_init(&m_spis, &spis_config, spi_peripheral_event_handle));
return NRF_SUCCESS;
}
can you help me in resolving this issue and explain why the last byte in multi bit should be non zero for successful SPI transmission ?