Other Parts Discussed in Thread: ENERGIA
Hello,
I started re-arranging the compdcm_mpu9150 example, commenting out part parts, and irrelevant parts of the code, in an attempt to change the sensor speed. I was measuring the sensor speed with the scope on pin PB_2.
One thing I noticed was the timing of those interrupts are not always same amount of time. some take longer, some take shorter with in a range of %1-%3. I am attaching a video of the scope output. I was able to change the sampling speed of the mpu9150, and I tried 500hz and 250hz, but all have the same problem. Interrupt times are not equal.
For the compdcm algorithm to work properly, the read times must be equal. This is the worst kind of error that you can introduce to a filtering system. Is this because of the mpu9150 or is it because the way the interrupts are handled in the example:
// Called by the NVIC as a result of GPIO port B interrupt event. For this // application GPIO port B pin 2 is the interrupt line for the MPU9150 void IntGPIOb(void) { unsigned long ulStatus = GPIOIntStatus(GPIO_PORTB_BASE, true); // Clear all the pin interrupts that are set GPIOIntClear(GPIO_PORTB_BASE, ulStatus); if(ulStatus & GPIO_PIN_2) { // MPU9150 Data is ready for retrieval and processing. MPU9150DataRead(&g_sMPU9150Inst, MPU9150AppCallback, &g_sMPU9150Inst); } }
I am thinking that this ISR is doing too much. I tried to set and use a boolean flag, and do the MPU9150DataRead within the while loop, but it did not work, because when I did that the interrupt failed to clear.
I am almost sure this timing irregularity is because of the ISR, but I could not pinpoint it.
Best Regards,
C.