2023-10-17 10:35 PM
Hi,
I am using NUCLEO stm32f030r8 to communicate with LIS3DH accelerometer, connection is in such a way that
vcc - 3v3
GND - GND
SCL/D15 - SCL
SDA/D14 - SDA
I want to read from who iam i register 0x0F, we use sparkfun board hence we checked SDO pin is giving 3v3
so the dev_addr is given 0x19
it get stuck in the line HAL_I2C_Mem_Read(&hi2c1, dev_addr, reg_adr, I2C_MEMADD_SIZE_8BIT, &who_am_i, 1, HAL_MAX_DELAY); it means something is not correct kindly help me to solve the issue
code :
Solved! Go to Solution.
2023-10-18 04:33 AM
Hii,
Thank you for your support have solved the issue slight confusion between the pins had made the issue the software automatically selects PB7 and PB6 but the sda and scl pin in the board is PB8 and PB9
2023-10-18 02:52 AM
Hello @Midhun ,
Please make sure that you are using the correct address.
You can connect an oscilloscope to check SDA and SCL behavior .
Foued
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-10-18 03:06 AM
Can you please guide me to choose the correct i2c address, Im using LIS3DH sparkfun board SDO PIN is not connected (kept open) only VCC SDA SCL is connected. So i'm currently using (0x18<<1) as an i2c address for HAL_I2C_Mem_Read function.
2023-10-18 03:29 AM
I think you should check this table : ( DS : https://www.st.com/resource/en/datasheet/lis3dh.pdf )
Foued
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-10-18 04:33 AM
Hii,
Thank you for your support have solved the issue slight confusion between the pins had made the issue the software automatically selects PB7 and PB6 but the sda and scl pin in the board is PB8 and PB9