[Solved] T3 hangs with SD & interrupts
Hello,
I have a fairly complex (for me) project : make a fully automated astronomy photo mount.
This means :
- A teensy (3.0, may be upgraded to a 3.1 if needed - I already have them)
- A Sparkfun LSM9DS0 IMU Breakout - 9DoF wired in I2C mode (official library)
- An Adafruit Graphic ST7565 Negative LCD (128x64) with RGB backlight bit-banged (official library)
- An Adafruit MicroSD card breakout board+ accessed though SPI (Teensyduino SD library)
- A Rotary Encoder - Illuminated (RGB) replaced by a simple push button for my tests
- A 32Khz crystal & 3V battery for the RTC
Everything works fine together until I try to access the SD after an interrupt (needed by the rotary encoder). The teensy locks up and I need to reset it to reboot it or upload a new sketch.
Everything works fine if I remove the interrupt (not an option for my project) or remove the file write (not an option during development, maybe in the final project).
I tried the "alternative" SDFat library, but with the same result.
Here is my sketch
If I remove the comment at line 143, I can triger the bug at will by a press on the button.
I tried everything I could think of. I found some mention of hangs with SD and interrups, but no solution so far.
Any idea would be welcome.
Hello,
I have a fairly complex (for me) project : make a fully automated astronomy photo mount.
This means :
- A teensy (3.0, may be upgraded to a 3.1 if needed - I already have them)
- A Sparkfun LSM9DS0 IMU Breakout - 9DoF wired in I2C mode (official library)
- An Adafruit Graphic ST7565 Negative LCD (128x64) with RGB backlight bit-banged (official library)
- An Adafruit MicroSD card breakout board+ accessed though SPI (Teensyduino SD library)
- A Rotary Encoder - Illuminated (RGB) replaced by a simple push button for my tests
- A 32Khz crystal & 3V battery for the RTC
Everything works fine together until I try to access the SD after an interrupt (needed by the rotary encoder). The teensy locks up and I need to reset it to reboot it or upload a new sketch.
Everything works fine if I remove the interrupt (not an option for my project) or remove the file write (not an option during development, maybe in the final project).
I tried the "alternative" SDFat library, but with the same result.
Here is my sketch
If I remove the comment at line 143, I can triger the bug at will by a press on the button.
I tried everything I could think of. I found some mention of hangs with SD and interrups, but no solution so far.
Any idea would be welcome.
Last edited: