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

No readings from LSM9DS1 using TWI example

Hi all,

Currently employing my custom board definition for Arduino Nano 33 BLE for use with the nRF5 SDK. So far I have gotten an array of examples working including the ANT+ Bike Power example. I am now porting LSM9DS1 drivers to use the Nano 33's built-in accelerometer.

I am using this repository as a guide: https://github.com/drvrh/nRF52-DK-and-LSM9DS1, but am using previous commits from 2018. I have attached the headers below. I have also attached my main file.

I added a few print functions to trace down the bug. Main function seems to pass through the error checks, twi initialization, and IMU/magnetic sensor initialization functions without issue as per my output in RTT Viewer (see below).

The code seems to get stuck here, where it gets the device ID's. It returns 0x0 for both the IMU and magnetic sensor so I am thinking that maybe the LSM9DS1 is not receiving power. The code seems to recognize that the LSM9DS1 exists because it does not return the "Cannot find the LSM9DS1." error message.

/* Check device ID */
    lsm9ds1_dev_id_get(&dev_ctx_mag, &dev_ctx_imu, &whoamI);
    if (whoamI.imu != LSM9DS1_IMU_ID || whoamI.mag != LSM9DS1_MAG_ID){
      while(1){
        /* manage here device not found */
        NRF_LOG_INFO("\r\nCannot find the LSM9DS1.********\r\n");
        //NRF_LOG_FLUSH();
        printf("\r\nCannot find the LSM9DS1.********\r\n");
      }
    }
   printf("Who am I register [IMU]: 0x%x [MAG]: 0x%x \r\n", whoamI.imu, whoamI.mag); 

As the Nano 33 becomes increasingly popular, it would be helpful to get this issue resolved for the developer seeking to employ the more powerful nRF5 SDK on his/her Nano 33 prototypes. I am asking for guidance on this issue to help me sniff out where the issue possibly could be.

Note: Also working with the TWI scanner example. Same issue here... getting stuck in the device id portion of the code.

Output:

Attachments:

/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-674ed7a0103a46929140932128e07649/lsm9ds1_5F00_reg.c

/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-674ed7a0103a46929140932128e07649/lsm9ds1_5F00_reg.h

Parents Reply Children
No Data
Related