2016-12-23 09:50 PM
Hello,
We are evaluating stm32f4 discovery board.we have connected the LSM9DS0 with stm32f4 via I2C communication.we are read the one default register from the LSM9DS0 accelerator,But we can not able to read this register.we are use the IAR IDE for the development.we generated the code using the STM32CubeMX software for I2c1.
We have below attached code for your reference.
We also not get kHz clock on scl line.We tried to see the scl clock on CRO.
Please help us to make I2c code work for me.
Please share us example code for stm32f4 discovery board for i2c read and write operation using the polling method.
Any help would be appreciated ?
Thanks,Parth Modi
#i2c #stm32f407vg #stm32f4-discovery #hal2016-12-23 11:56 PM
For simple I2C polling mode, until someone fix the source code, please try I2C generation by GPIO + SW,
Such sample code is available
https://community.st.com/0D50X00009XkW1mSAF
.This will make sure your HW is properly working and external pull-ups are present on both SDA and SCL and both lines are not grounded somewhere.
Reminder: This MEMs is like 2 in one package: Make sure both NSS are high level (I2C mode, not SPI mode), and that the SA0 pins are either tied high or low: This will tell which slave addresses are correctly responding.
Also remember that to activate read/write with subaddress autoincrement, bit 7 of sub-address should always be set to '1'
Good luck!