GPRS_C_SDK icon indicating copy to clipboard operation
GPRS_C_SDK copied to clipboard

A9G GPRS_C_SDK with accelerometer LIS3DSH

Open lorenzopeluso opened this issue 3 years ago • 1 comments

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.

lorenzopeluso avatar Jan 23 '22 21:01 lorenzopeluso

See the demo: https://github.com/Ai-Thinker-Open/GPRS_C_SDK/blob/master/demo/i2c/src/demo_i2c.c

breadcrumb3000 avatar Mar 03 '22 12:03 breadcrumb3000