cancel
Showing results for 
Search instead for 
Did you mean: 

ISM330DLC device ID

RJain.1
Associate II

Hi,

I have made a module using ISM330DLC IC. I made the schematic by taking reference from STEVAL-IDP005V1 schematic. PFA, both the schematics.

Now, I am using Nucleo -F44RE board to interface this module using SPI.

Also, using the libraries for the ISM330DLC.

When I am using the ism330dlc_device_id_get(&dev_ctx, &whoamI); API, the ID coming is 0x7F but in datasheet it is 0x6A.

But when I am using the STEVAL-BFA001v1b kit , I am getting the correct ID of the ISM330DLC which is there on the kit already.

Please, let me know the possible problem.

Thanks

6 REPLIES 6
Eleon BORLINI
ST Employee

Hi @RJain.1​ , are you sure you are correctly reading the WHO_AM_I (0Fh) register? It seems like "FFh" on 7-bit... Can you read another register to check if you get back the same value? And could you share the digital signal pattern? Just to check if you are receiving back the ack from the slave device. Regards

RJain.1
Associate II

Hi @Eleon BORLINI​ 

I am getting the same value i.e. 0xFF while reading other registers also.

Where is the problem?

Here is the SPI code, I am writing 0x11 at CTRL1_XL (10h)

//SPI transmit steps

 // 1. Bring slave select to low

HAL_GPIO_WritePin(GPIOA,GPIO_PIN_10,GPIO_PIN_RESET);

//2. Transmit registers + data

spi_txBuf[0] = 0x10;

spi_txBuf[1] = 0x11;

HAL_SPI_Transmit(&hspi3,spi_txBuf,2,50);

// 3. Bring slave select high

HAL_GPIO_WritePin(GPIOA,GPIO_PIN_10,GPIO_PIN_SET);

//SPI receive steps

 // 1. Bring slave select to low

HAL_GPIO_WritePin(GPIOA,GPIO_PIN_10,GPIO_PIN_RESET);

//2. Transmit registers + data

spi_txBuf[0] = 0x10|0x80;

HAL_SPI_Transmit(&hspi3,spi_txBuf,1,50);

//receive data

HAL_SPI_Receive(&hspi3,spi_rxBuf,1,50);

HAL_GPIO_WritePin(GPIOA,GPIO_PIN_5,GPIO_PIN_SET);

RJain.1
Associate II

Solved.

I used wrong GPIO_PIN in WritePin API (Last line).

HI @Eleon BORLINI​ , when I try to read any register of ISM330DLC, it is giving the same value i.e. 0xf. What can be the problem?

here is the code:

HAL_GPIO_WritePin(ISM_CS_GPIO_Port,ISM_CS_Pin,GPIO_PIN_RESET);

      //HAL_Delay(10);

      //2. Transmit registers + data

      spi_txBuf[0] = 0x0E|0x80;

      HAL_SPI_Transmit(&hspi3,spi_txBuf,1,50);

     //receive data

     HAL_SPI_Receive(&hspi3,spi_rxBuf,1,50);

    // HAL_Delay(10);

     HAL_GPIO_WritePin(ISM_CS_GPIO_Port,ISM_CS_Pin,GPIO_PIN_SET);

Hi @RJain.1​ ,

if you are receiving all 0xff there should be some issue on the line. Are the GPIO pins ok? Is the SPI correctly configured at application processor level?

-Eleon

Hi @Eleon BORLINI​ 

I have both the sensors with me i.e. ISM330DLC and ISM330DHCX. Here is the SPI configurations and WHOamI register read code for ISM330DHCX.

 hspi1.Instance = SPI1;

 hspi1.Init.Mode = SPI_MODE_MASTER;

 hspi1.Init.Direction = SPI_DIRECTION_2LINES;

 hspi1.Init.DataSize = SPI_DATASIZE_8BIT;

 hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;

 hspi1.Init.CLKPhase = SPI_PHASE_1EDGE;

 hspi1.Init.NSS = SPI_NSS_SOFT;

 hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_16; //5.25MBits/s

 hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;

 hspi1.Init.TIMode = SPI_TIMODE_DISABLE;

 hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;

 hspi1.Init.CRCPolynomial = 10;

 if (HAL_SPI_Init(&hspi1) != HAL_OK)

 {

  Error_Handler();

 }

HAL_GPIO_WritePin(ISM_CS_GPIO_Port,ISM_CS_Pin,GPIO_PIN_RESET);

  ///HAL_Delay(50);

  //2. Transmit registers + data

  spi_txBuf[0] = 0x0F|0x80;

  HAL_SPI_Transmit(&hspi1,spi_txBuf,1,50);

 //receive data

 HAL_SPI_Receive(&hspi1,spi_rxBuf,1,50);

 HAL_GPIO_WritePin(ISM_CS_GPIO_Port,ISM_CS_Pin,GPIO_PIN_SET);

In this case I am receiving 0x48 in spi_rxBuf. I have checked all the pins, they are connected correctly. I also tried using Adafruit ISM330DHCX library using Arduino IDE , it works fine with it. But stuck with STM32cube IDE.