Skip to main content
Visitor II
April 11, 2019
Question

[LSM6DSL] I2C Mode replying NACK to all data transfers.

  • April 11, 2019
  • 5 replies
  • 1124 views

Hi,

We are using the LSM6DSL sensor in a custom PCB, we are also using the X-CUBE-MEMS extension drivers to communicate with the MEMS sensor. The image below is the schematic part of the LSM6DSL. VCC_IMU being 3v3, W1 is closed with a solder jumper to VCC_IMU, the microcontroller is also powered at 3v3 and the I2C logic signals are 3v3, the Pull-Up resistors are 4k7 each one, the bus is running at 100000.

0690X000008AQYnQAO.png

The configuration of the IMU using the X-CUBE-MEMS API is:

static LSM6DSL_Object_t   lsm;

static LSM6DSL_IO_t      io_ctx = {

   .Address = LSM6DSL_I2C_ADD_H,

   .BusType = LSM6DSL_I2C_BUS,

   .Init = BSP_I2C1_Init,

   .DeInit = BSP_I2C1_DeInit,

   .GetTick = BSP_GetTick,

   .ReadReg = BSP_I2C1_ReadReg,

   .WriteReg = BSP_I2C1_WriteReg

};

When trying to use LSM6DSL_Init, LSM6DSL_ACC_Enable or LSM6DSL_GYRO_Enable the IMU replies with an NACK. Here is the logic analyzer capture of the microcontroller trying to communicate with the IMU.

So my questions are:

  • Besides of wiring CS to logic high, do i need to do anything else to configure the LSM6DSL to use the I2C bus?

Regards,

Carlos

    This topic has been closed for replies.

    5 replies

    Visitor II
    April 15, 2019

    I just realized that the MEMS sensor isn't replying at all.

    ST Employee
    April 16, 2019

    hi carlos, could you share the logic analyze capture? please consider that the CS, and not the CS* as in your schematic, should be high, so CS* should be low to activate I2C... regards

    Visitor II
    April 16, 2019

    Sure, i will upload the logic analyzer capture later today.

    Which CS you mean? As far as i know the /CS of my schematic should be high to be in I2C or low to be SPI mode.

    EDIT:

    Here's the logic analyzer capture:

    0690X000008AcLZQA0.png

    The SDO/MISO line is set to logic 1, /CS is also set to logic 1.

    Here's a capture of the I2C bus of the x-nucleo-iks01a2 dev board, which have the same settings:

    0690X000008AcLeQAK.png

    My custom PCB have external pull up resistors of 4k7 ohms, i had also tried using the microcontroller internal pull up resistors but the problem remains.

    ST Employee
    April 17, 2019

    hi carlos, thank you for the sharing.  Yes, I was wondering why you put CS* in inverse logic instead of CS only, as in X-nucleo-iks01a2.

    0690X000008AcuUQAS.png

    Btw, did you try any other parts? You should also check if the customer I2C master is able to read at 3.3V or if there are any restriction for I2C communication. regards

    Visitor II
    April 17, 2019

    Hi, it's just the symbol graphic.

    Btw, did you try any other parts? You should also check if the customer I2C master is able to read at 3.3V or if there are any restriction for I2C communication. regards

    Yes, actually i plugged the I2C bus of the X-NUCLEO-IKS01A2 to my custom board and i'm able to identify and get data from that IMU, and also i can identify and read the sensor data from my custom board IMU (now SDO is set to logic low to don't collide with the X-NUCLEO-IKS01A2 IMU address), so i think is matter of coupling.