Hi!
I made same code for SDK15 and it works. Now I want to rebuild project on the new SDK17.0.2 and same part of code doesn't work with SPI master.
For notice- doesn't work native example
...examples\peripheral\spi\
And I made on the my project all settings like it was on SDK15 and can't call interrupt spi_event_handler.
my settings:
#define SPI_INSTANCE 0 /**< SPI instance index. */ static const nrf_drv_spi_t spi = NRF_DRV_SPI_INSTANCE(SPI_INSTANCE); /**< SPI instance. */ static volatile bool spi_xfer_done; /**< Flag used to indicate that SPI instance completed the transfer. */


void spi_event_handler(nrf_drv_spi_evt_t const * p_event,
void * p_context)
{
spi_xfer_done = true;
// NRF_LOG_INFO("Transfer completed.");
if (m_rx_buf[0] != 0)
{
NRF_LOG_INFO(" Received:");
// NRF_LOG_HEXDUMP_INFO(m_rx_buf, strlen((const char *)m_rx_buf));
}
}
static __INLINE uint8_t lis3dh_spi_read_write(const uint8_t reg, const uint8_t data)
{
// uint8_t rx_buffer[2], tx_buffer[] = { reg, data };
m_tx_buf [0] = reg;
m_tx_buf [1] = data;
spi_xfer_done = false;
APP_ERROR_CHECK(nrf_drv_spi_transfer(&spi, m_tx_buf, m_length, m_rx_buf, m_length));
while (!spi_xfer_done)
{
__WFE();
}
return m_rx_buf[1];
}
uint8_t lis3dh_read(const uint8_t reg)
{
return lis3dh_spi_read_write(reg | LIS3DH_READ_MSK, 0xAA);
}
void lis3dh_write(const uint8_t reg, const uint8_t data)
{
lis3dh_spi_read_write(reg | LIS3DH_WRITE_MSK, data);
}
void lis3dh_init(void)
{
nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG;
spi_config.ss_pin = 7;
spi_config.miso_pin = 8;
spi_config.mosi_pin = 9;
spi_config.sck_pin = 10;
APP_ERROR_CHECK(nrf_drv_spi_init(&spi, &spi_config, spi_event_handler, NULL));
lis3dh_write(CTRL_REG1, 0x2F);
}
What I make wrong?