Hello!
Iam trying to get the spi function to work properly on my thingy 52 device.
My problem is that the transfer wont stop when it should in my opinion, i have analyzed the MOSI and SCK (no slave connected yet) on a logic analyzer
and can see that the CLK continues for one extra byte and the data sent is hx00 or NULL. i have attached a picture of the result from the logic analyzer. The string iam trying to send is "Thingy"
This is some of the code related to the spi transfer i try to send data via spi at the end of a timer.#define SPI_INSTANCE 1 /**< 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. */ #define TEST_STRING "THINGY" static uint8_t m_tx_buf[] = TEST_STRING; /**< TX buffer. */ static uint8_t m_rx_buf[sizeof(TEST_STRING)]; /**< RX buffer. */ static const uint8_t m_length = sizeof(m_tx_buf); /**< Transfer length. */static void spitest_init(void) { uint32_t err_code; //nrf_delay_ms(5); //fungerande spi nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG; spi_config.ss_pin = NRF_DRV_SPI_PIN_NOT_USED; //SPI_SS_PIN . spi_config.miso_pin = 2; //SPI_MISO_PIN; spi_config.mosi_pin = 3; //SPI_MOSI_PIN; spi_config.sck_pin = 4; //SPI_SCK_PIN; nrf_delay_ms(5); drv_ext_gpio_cfg_output(SX_IOEXT_0); // EXT0 as SS nrf_delay_ms(5); drv_ext_gpio_pin_set(SX_IOEXT_0); nrf_delay_ms(1); nrf_drv_spi_init(&spi, &spi_config, spi_event_handler, NULL); }static void SEND_TIMEOUT_HANDLER(void * p_context){ uint32_t err_code; ble_ekg_test_t temp; drv_ext_gpio_pin_clear(SX_IOEXT_0); nrf_delay_ms(1); APP_ERROR_CHECK(nrf_drv_spi_transfer(&spi, m_tx_buf, m_length, m_rx_buf, m_length)); drv_ext_gpio_pin_set(SX_IOEXT_0); nrf_delay_ms(5); memcpy(temp.testdata,m_rx_buf,sizeof(m_rx_buf)); err_code = EKG_ble_set(&m_tes, &temp); APP_ERROR_CHECK(err_code); }