Hello!
Does anyone know how can we send the multiple uint8_t MOSI signal to SPI and received the result on m_rx_buf?
Trying to send multiple bytes to "m_tx_buf":
#define SPI_INSTANCE 0 /**< SPI instance index. */ //line 24
static const nrf_drv_spi_t spi = NRF_DRV_SPI_INSTANCE(SPI_INSTANCE); /**< SPI instance. */ //line 25
static volatile bool spi_xfer_done; /**< Flag used to indicate that SPI instance completed the transfer. */
static uint8_t m_tx_buf[] = {0x18,0x00}; /**< TX buffer. */ //line 29
static uint8_t m_rx_buf[sizeof(m_tx_buf) + 1]; /**< RX buffer. */ //line 30
static const uint8_t m_length = sizeof(m_tx_buf); /**< Transfer length. */ //line 31
The main code in While(1):
// Reset rx buffer and transfer done flag
memset(m_rx_buf, 0, m_length);
spi_xfer_done = false;
// APP_ERROR_CHECK(nrf_drv_spi_transfer(&spi, m_tx_buf, m_length, m_rx_buf, m_length));
APP_ERROR_CHECK(nrf_drv_spi_transfer(&spi, m_tx_buf, m_length, m_rx_buf, m_length)); //line 69
while (!spi_xfer_done)
{
__WFE();
}
NRF_LOG_FLUSH();
LEDS_INVERT(BSP_LED_0_MASK);
nrf_delay_ms(200);