SPI Configuration Issues for ICM42670P and nrf52832

ICM42670P and nrf52832 were tested in examples such as spi and spis to configure them as SPIs, but data could not be received.
Can someone help me?
configured with sdk 17.1 s132


Even if I try to check the register for WHOAMI, I'm only getting an empty value.

This is part of the circuit diagram.

I set the "ss" pin to 20, the "miso" pin to 29, the "mosi" pin to 28, and the "sck" pin to 27.

  • I will ask my colleague to look at your schematics on Monday, but before that, can you please show some code snippets and the pins output when you send the command to the sensor to know the status of the WHOAMI register?

    What is expected on pins and what do you see?

  • This is My Code

    #define SPIS_INSTANCE 1 /**< SPIS instance index. */
    static const nrf_drv_spis_t spis = NRF_DRV_SPIS_INSTANCE(SPIS_INSTANCE);/**< SPIS instance. */
    static volatile bool spis_xfer_done; /**< Flag used to indicate that SPIS instance completed the transfer. */
    
    static uint8_t tx_buf[] = {0x80 | 0x75, 0x00};
    static uint8_t rx_buf[2];
    
    void spis_event_handler(nrf_drv_spis_event_t event)
    {		
    		if (event.evt_type == NRF_DRV_SPIS_XFER_DONE)
        {
            spis_xfer_done = true;
    				SEGGER_RTT_printf(0, "\r\nReceived: %s\r\n", rx_buf);
            NRF_LOG_INFO(" Transfer completed. Received: %s",(uint32_t)rx_buf);
        }else if(event.evt_type == NRF_DRV_SPIS_BUFFERS_SET_DONE) {
    			SEGGER_RTT_printf(0, "\r\nNRF_DRV_SPIS_BUFFERS_SET_DONE: %x%x\r\n", rx_buf[0], rx_buf[1]);
    		}
    		SEGGER_RTT_printf(0, "\r\nTransfer completed.\r\n");
    }
    
    void icm42670p_read_whoami(void) {
    	ret_code_t err_code;
    	
    	APP_ERROR_CHECK(nrf_drv_spis_buffers_set(&spis, tx_buf, sizeof(tx_buf), rx_buf, sizeof(rx_buf)));
    }
    
    void spi_init(void)
    {
        nrf_drv_spis_config_t spis_config = NRF_DRV_SPIS_DEFAULT_CONFIG;
        spis_config.csn_pin               = 20;
        spis_config.miso_pin              = 29;
        spis_config.mosi_pin              = 28;
        spis_config.sck_pin               = 27;
    
        APP_ERROR_CHECK(nrf_drv_spis_init(&spis, &spis_config, spis_event_handler));
    	
        NRF_LOG_INFO("SPI example started.");
    		SEGGER_RTT_printf(0, "\r\nSPI example started\r\n");
    }
    
    int main(void)
    {
        bool erase_bonds;
    
        // Initialize.
        timers_init();
        buttons_leds_init(&erase_bonds);
        ble_stack_init();
        gap_params_init();
        gatt_init();
        services_init();
        advertising_init();
        conn_params_init();
    
    	SEGGER_RTT_printf(0, "\r\nUART started.\r\n");
        advertising_start();
    	
    	spi_init();
    	nrf_delay_ms(1000);
        for (;;)
        {
    				spis_xfer_done = false;
    				icm42670p_read_whoami();
    				while (!spis_xfer_done)
            {
                __WFE();
            }
    				nrf_delay_ms(3000);
    		}
    }

    This is Seggar RTT Logs

    Thanks!!

  • There is a ready made driver for this sensor in our newer nRF Connect SDK, zephyr based solution. I do not see that this new version of motion sensor has no support on our older SDK (at least no one verified that the SPI drivers work with this sensor on the older SDK)

    If you cannot use the latest nRF Connect SDK, then you can take the configurations and initialization snippets from the link and try to port it to the older SDK.

  • Hi, Have you received any data on the sdk17.1? I am also working on it and getting the same issue.

Related