Thanks Theo, Giovanni.
I think I am starting to understand the external interrupt interface thanks to your help.
My learning application is a flight controller with an IMU (3 axis gyro plus 3 axis accelerometer) for stabilization and a serial interface RC receiver for command inputs from a pilot. The IMU (an Invensense MPU-6050 https://www.invensense.com/products/mot ... /mpu-6050/
or MPU-9250 https://www.invensense.com/products/mot ... /mpu-9250/
) is programmed for self-clocking, providing readings and an external data ready interrupt signal at between a planned programmable rate between 200 and 1000 Hz. The serial stream from the pilot comes via TTL serial input, at 115.2kbps with 16 byte data payload arriving every 22 msec assuming a good signal. The processor I'm starting with is an AVR ATMega644PA at 20 MHz, but I am also looking at moving up to an STM32F3 or F4 once the application is up and running. Ideally my same code base can support both AVR and STM32 targets but we shall see. I've included a simple block diagram showing interfaces.
I think I can get away with Serial interface module in Chibios, and use EXT to handle the IMU data ready interrupts. These data ready interrupts will be used to trigger a synchronous PID control loop. Serial input and IMU data timings are independent of each other.
My question is regarding external interrupts to sync the PID loop to the gyro data. If I only plan to set a semaphore that will trigger a synchronous PID calculation loop thread, can I get away with a faster 'bare metal' ISR or is a full context save Chibios ISR needed? I suspect the later but it would be good to understand why, and when it might be ok to 'cheat' and make do with a faster bare metal ISR?