cancel
Showing results for 
Search instead for 
Did you mean: 

NUCLEO-U083RC with X-NUCLEO-IKS5A1 fails to communicate to I2C sensors

suiunbek
Associate II

Hi,

I have NUCLEO-U083RC-B01. I attached X-NUCLEO-IKS5A1 to it. All jumpers are in default positions.

In STM32CubeMX I enabled I2C1 with default values. In the main program I am trying to check the device readiness for MEMS sensors on the X-NUCLEO-IKS5A1, e.g, ISM330IS. HAL_I2C_IsDeviceReady returns HAL_ERROR.

I tried to set the I2C1 GPIO configuration Pull-up but no success. The I2C Speed Mode is standard. I check the readiness by:

HAL_StatusTypeDef status = HAL_I2C_IsDeviceReady(&hi2c1, ISM330IS_I2C_ADD_H, 3, 100);

 

I am attaching my main file.

Thank you in advance.

4 REPLIES 4
Karl Yamashita
Principal

I don't see your define for ISM330IS_I2C_ADD_H. Did you left shift the slave address by 1? Did you check with oscilloscope to see if there is data activity?

If a reply has proven helpful, click on Accept as Solution so that it'll show at top of the post.
CAN Jammer an open source CAN bus hacking tool
CANableV3 Open Source

suiunbek
Associate II

The datasheet of the sensor says 0b1101010 and 0b1101011. On the X-NUCLEO-IKS5A1 the jumper setting is such that SA0=1. After the left shift and adding 1 bit for "read" i get 0xD7U which is ISM330IS_I2C_ADD_H.

I tried both ISM330IS_I2C_ADD_L and ISM330IS_I2C_ADD_H. None of them works.

I am an amateur engineer. I have never used oscilloscope before. I will try next week after familiarizing with the user manual.

Below is the extract from the datasheet and the header file with the macro definition.

image.pngimage.png

Karl Yamashita
Principal

You don't add the read bit after shifting. The HAL driver will add the read bit when needed. 

Your define values should be 0xD4 and 0xD6.

If that doesn't work, then you'll need an oscilloscope/logic analyzer to see what is happening on the bus

 

If a reply has proven helpful, click on Accept as Solution so that it'll show at top of the post.
CAN Jammer an open source CAN bus hacking tool
CANableV3 Open Source

The issue was the I2C1 wiring. STM32CubeMX sets PA8 and PA9. But according the Nucleo-U083RC it should be PB8 and PB9. After modification it works now.