2020-03-29 02:09 PM
I started a new project using CubeMX for my STM32F303-Discovery board and try to get the Acceleration values but without success!
In my main.c, I do the following:
i2cBuf[0]=0x20;
//CTRL_REG1_A ODR = 1344HZ | Normal Mode | XZYen
i2cBuf[1]=0x97;
HAL_I2C_Master_Transmit(&hi2c1, 0x32, i2cBuf, 2, 1000);
i2cBuf[0]=0x23;
//CTRL_REG4_A Cont. BDU | Big End | 16g | High Res
i2cBuf[1]=0x38;
HAL_I2C_Master_Transmit(&hi2c1, 0x32, i2cBuf, 2, 1000);
while (1){
i2cBuf[0]=0x28; //Acc data Register
HAL_I2C_Master_Transmit(&hi2c1, 0x32, i2cBuf, 1, 1000);
HAL_I2C_Master_Receive(&hi2c1, 0x32,&i2cBuf[1],6,1000);
}
When I debug and watch the values of i2cBuf[1:6] I get only 0X00!
Any ideas please?