Open lorenzopeluso opened 2 years ago
Hi all.
I've soldered the LIS3DSH on my A9G device.
I'am trying to interact with accelerometer but without success.
First of all, which I2C interface (1, 2, 3) I should initialize in order to read from accelerometer?
My code (to read chipID):
I2C_Config_t i2cConfig1; i2cConfig1.freq = I2C_FREQ_100K;
if(!I2C_Init(I2C2, i2cConfig2)) Trace(1, "ERROR");
I2C_ReadMem(I2C1, 0x19, 0x02, 1, &accId1, 1, I2C_DEFAULT_TIME_OUT); Trace(1,"accelerator id shold be 0x19, read:0X%02x",accId1);
The result is:
"accelerator id shold be 0x19, read:0Xfd"
Thanks a lot for any suggestion or sample code.
Cheers, Lorenzo.
See the demo: https://github.com/Ai-Thinker-Open/GPRS_C_SDK/blob/master/demo/i2c/src/demo_i2c.c
Hi all.
I've soldered the LIS3DSH on my A9G device.
I'am trying to interact with accelerometer but without success.
First of all, which I2C interface (1, 2, 3) I should initialize in order to read from accelerometer?
My code (to read chipID):
I2C_Config_t i2cConfig1; i2cConfig1.freq = I2C_FREQ_100K;
if(!I2C_Init(I2C2, i2cConfig2)) Trace(1, "ERROR");
I2C_ReadMem(I2C1, 0x19, 0x02, 1, &accId1, 1, I2C_DEFAULT_TIME_OUT); Trace(1,"accelerator id shold be 0x19, read:0X%02x",accId1);
The result is:
"accelerator id shold be 0x19, read:0Xfd"
Thanks a lot for any suggestion or sample code.
Cheers, Lorenzo.