I have recently migrated from SDK 15.0 to 15.2 and are experiencing problems with my code.
I have a nRF52840DK and have attached two accelerometers to this board. I am able to talk to the accelerometers, and initialize them. This is done by short 2-bytes writes.
After initialization I want to read out 6 bytes from the accelerometer. This was achieved by setting up a transfer where I transfer one register address to the accelerometer (1 byte) and read out 6 bytes (7 incl the first do-not-care byte). The code is as follows:
static const uint8_t tx_data[]= {0x86}; uint8_t rx_data[]= {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; static nrf_spi_mngr_transfer_t spitransfer; spitransfer.p_tx_data = tx_data; spitransfer.tx_length = sizeof(tx_data); spitransfer.p_rx_data = rx_data; spitransfer.rx_length = sizeof(rx_data); nrf_drv_gpiote_out_clear(cs_pin_number); APP_ERROR_CHECK(nrf_spi_mngr_perform(m_mngr_spi, m_spi_config, &spitransfer, 1 , NULL)); nrf_drv_gpiote_out_set(cs_pin_number);
This has worked with SDK 15.0. However, when migrating to 15.2 the transfer only generates 16 clock cycles. Hence, the transfer never completes. Is there an error in SDK15.2 or am I doing something wrong?
I have also tried to increase the transmit data, padding with zeros to have same length as rx_buffer, but this does not work either. Always stops after the first 16 clock cycles. Attached is scope plot of the transfer.