Interrupts with flymaple HAL

I am developing my own flight controller board using the STM32f103RE, the same CPU that the flymaple board uses.

However, I am using an MPU6000 on SPI so I am using the AP_InertialSensor_MPU6000.cpp file. Monitoring the output using UART, everything looks fine, but when I connect to mission planner I am unable to change any parameters. I get 3 retries and a fail.

I've determined that the GCS_MAVLink messages received by the flight controller are not passing a crc check because there are missing bytes in the messges.

I know the _poll_data() interrupt in the MPU6000.cpp file is the problem because if I instead just read the sensor from the main code and not an interrupt, I don't get the Mavlink issue.

My theory is that I am in the _poll_data() function and then I am unable to be interrupted away to put the uart byte in the buffer to be read later, causing me to then fail a crc check.

Does anyone know how to get around this issue? I would like to poll the sensor at 1kHz and it seems an interrupt is the only way to do it.

Thanks

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Activity

Neville Rodrigues liked Neville Rodrigues's profile
Jun 30
Santiago Perez liked Santiago Perez's profile
Jun 21
More…