2013-06-19 09:05 PM
I have an STM L3GD20 gyro which I am interfacing with an STM32F0. The gyro has two interrupt pins, and INT2 is specifically labeled ''DRDY.'' I'm under the impression that it can produce a pulse after each sample is captured. So if the gyro data rate is set to 95Hz, I should expect 95 pulses per second on the DRDY line, right?
My goal is use an external interrupt to read the gyro data registers after each sample is captured. I seem to get one (and only one) pulse AFTER I manually read the contents of the 6 data registers (XL, XH, YL, YH, ZL, ZH). If I manually read those registers ~5 times a second, I get ~5 pulses on DRDY per second, etc. I have tried bypass mode and FIFO mode. Shouldn't I see a pulse on DRDY every 1/95sec? I have verified that my I2C transaction is not taking too long: My EXTI ISR reads all six data registers ~1300 times per second (verified by toggling a GPIO and looking at the waveform on a scope.) To get the ISR to trigger I have to manually trigger the EXTI in an infinte loop in main(), or toggle the pin by touching it and letting the 60Hz mains AC couple through my body :) Has anyone used the L3GD20 gyro and got interrupts working? I suppose I can work around this problem by setting up a timer, and polling the gyro status register at >95Hz, but it seems like there should be a better way. Thanks, -Farrell2013-06-20 12:22 AM
So what happens when you start to read it manually and then read it again immediately after getting the pulse, no pulse after two reads or what?
Maybe you just need to start it by hand an then it will run with EXTI ISR.2013-06-21 03:21 PM
Figured it out. Two issues:
1. The EXTI does not seem to trigger if the rising edge occurs during an EXTI ISR call. 2. I thought DRDY would generate a pulse on each sample event, but it stays high if you don't read the previous sample. I worked around both by having my EXTI ISR check if the DRDY pin is high at the end of the ISR. If it's high, I trigger the EXTI manually. -Farrell