This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Is there any example on interfacing nrf52840 with icm 20601 using spim?

Hi guys, I just want to know if there's a way for the above and how if yes.

Parents Reply Children
  • Hello Jerry,

    Jerryxu said:
    I had some trouble, it seemed that code can't read the right data from the sensor, such as sensor's default device ID(0x12). I'm confused about it. If you have some suggentions? Or do you have any examples?

    What do you mean that it cant read the right data? Are you able to read anything at all from the sensor, or do you mean that whatever you are able to read is not as expected?
    Do you notice any other unexpected behavior when you attempt this; does the device suddenly reset, or stop advertising, for example?

    Could you also describe how you have connected the sensor to your device, and do you have access to a logical analyzer so we could take a closer look at exactly what is happening on the lines?

    Best regards,
    Karl

  • Hi Jerry,

    That could be a problem with SPI PHASE and POLARITY. 

    Kindly check all the 4 cases with those.

    Warm Regards,

    Kumar

  • Hi,Kumar

    I had think about that and I've tried to check all the 4 cases. But, strangely, the device ID returned was always 0x00 in the 4 cases.....

    nrf_drv_spi_transfer() returned NRF_SUCCESS, seemed that there's no problem in transmission.  But the returned value 0x00 showed that read_data function wasn't work.......

    Have you read and write icm successfully by spi?Can you show me your code for a example?

    thanks a lot.

    Jerry 

  • Hi Jerry, 

    Should there be a command delay between the write, read functions?

    Or try a different function for reading from SPI DRIVER instead of spi_transfer one. HAL_SPI DRIVER functions are better if we have.

    Also, make sure that MISO and MOSI are properly connected, just in case.

    No, I couldn't work on that sensor as I moved to a ST one

Related