Hi,
I am trying to periodically read sensor values from MPU-6050 rev c. I have setup a timer based interrupt that calls a function (ISR) every 10th millisec. I want the values to be precisely 10msec apart. Now my interrupt service routine doesn't work and hangs at the function umplOnTimer(). When i comment the umplOntimer() function, the interrupt starts working. What is wrong here? Thanks in advance.
- Log in to post comments
phpbb Topic ID
14508
Re: Re: Can't use umplOnTimer() function in an interrupt routine
@omer_qureshi wrote:
The umplOnTimer() function probably has code which requires its own interrupts to run properly. Can you set a flag inside your interrupt routine, then simply poll in an infinite main loop and call umplOnTimer() there whenever the flag is set? I believe this is the preferred way to deal with interrupt-driven events; there should be absolutely as little code as possible inside the actual interrupt routine, since it stops almost everything else from happening.
Also, can you set the output rate on the MPU to 100Hz and use the INT pin to trigger an external interrupt when FIFO data is ready, rather than relying on timer-based internal interrupt generation? This might be simpler...but maybe it isn't precise enough?
Re: Re: Can't use umplOnTimer() function in an interrupt routine
The MPU device can be set up to perform 100 Hz data collection accurately using either interrupt or enabling the FiFo to allow your device to collect data at a slower rate. For your own timing function, you should verify that you are not using the same device timer that is configured for your eMPL library.
Re: Re: Can't use umplOnTimer() function in an interrupt routine
Thanks for replying.
@sectionsbest wrote:
You mean configuring the FIFO rate to 100Hz and then using INT pin with Data ready DATA_RDY_EN interrupt?
@sectionsbest wrote:
Can u describe a quick way to find that?
Thanks
Re: Re: Can't use umplOnTimer() function in an interrupt routine
You could set up the Fifo rate at 100 Hz, then use DATA_RDY_EN, or have your device wait for a longer period of time, then wake up and empty the Fifo buffer. As long as the Fifo overflow interrupt hasn't been triggered, you won't lose any data. For device timer info, check out "msp430_timer.h" for detail on the timers used by eMPL.