Skip to content
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

SPI NSS for gyro and accelerometer being pulled low at the same time. #8

Open
jisang1213 opened this issue Sep 26, 2024 · 0 comments
Open

Comments

@jisang1213
Copy link

I've faced an issue with gyro and accelerometer CS pins being pulled low simultaneously, making the retrieved data contain garbage values once a while (about every 1~2 seconds). There needs to be a mechanism to prevent this like using while() to wait for its turn to read.

void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
	if (GPIO_Pin == INT_ACC_Pin) {
                while(imu.readingGyr);
                BMI088_ReadAccelerometerDMA(&imu); 

	} else if (GPIO_Pin == INT_GYR_Pin) {
                while(imu.readingAcc);
                BMI088_ReadGyroscopeDMA(&imu);
	}
}

and in the BMI088.c file the imu.readingGyr and imu.readingAcc flags should be set before pulling the CS low (and unset after pulling CS to high) to prevent race condition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant