-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configuration of gyroscope and accelerometer sensitivity doesn't work #1
Comments
thanks for confirming my suspicions and thanks for the code. this applies to FS_SEL and AFS_SEL (acceleration stuck at 4G range for me), possibly more. it might be a good idea to fork this... the repo seems dead. I'm forking and working on this right now. |
besides this bug, it seems the data sheet is wrong. acceleration sensitivity is halved. maybe the chips received a bad factory calibration. this seems to agree: https://github.com/jrowberg/i2cdevlib/blob/master/Arduino/MPU6050/MPU6050_6Axis_MotionApps20.h |
don't see issue from the original code if you look at details of HAL_I2C_Master_Transmit. |
I made a mistake when i quoted the original code i have edited it so now you can see the address is not sent on the original |
When configuring the mpu for the desired sensitivity only the data byte is being sent. The register address is also required.
Starting from line 226 of sd_hal_mpu6050.c:
temp = (temp & 0xE7) | (uint8_t)GyroscopeSensitivity << 3;
while(HAL_I2C_Master_Transmit(Handle, (uint16_t)address, &temp, 1, 1000) != HAL_OK);
Should be:
temp = (temp & 0xE7) | (uint8_t)GyroscopeSensitivity << 3;
uint8_t send[2];
send[0] = regAdd;
send[1] = temp;
while(HAL_I2C_Master_Transmit(Handle, (uint16_t)address, send, 2, 1000) != HAL_OK);
and the same for the accelerometer function
The text was updated successfully, but these errors were encountered: