vindar
Well-known member
Hello,
I have been a long time lurker of this (great) forum and I have usually found answers by searching old posts but I must admit I am stuck on this one... If anyone can point me in the right direction, I would be very grateful
I am using a teensy 3.2 to generate a 40khz signal using the IntervalTimer class. I need a very precise timing: each interrupt should not be delayed by more than a few cycles.
What the interrupt routine does is mostly switching the state of 4 digital pins simultaneously to create 4 similar waves. Yet, I cannot use PWN to do that because I do not generate a perfectly periodical signal: sometime, a given pin may is not be switched depending on other external variables.
If the teensy do only that, all is fine..
But then, at the same time, I am driving a SSD1306 screen via I2C (for monitoring). As you have probably guessed, its messes with my interrupt routine and, when communicating with the I2C device, the timer becomes irregular.
I did set the priority of the IntervalTimer routine to 0 using the setPriority() method and I thought that this would enable my interrupt (it is very short) to get called even during an I2C interrupt. I guess I do not understand how interrupt nesting works !
I also tried to use the i2c_t3 library instead of Wire and I tried the IRQ and DMA modes. Still no luck... The immediate transfer mode of i2c_t3 does not seem to be working with the adafruit library for SSD1306.
Does anyone know how I could fix my problem. I do not mind if a i2c transfer sometimes fails.. but I need the timer interrupt to stay fairly regular.
Thank you !
I have been a long time lurker of this (great) forum and I have usually found answers by searching old posts but I must admit I am stuck on this one... If anyone can point me in the right direction, I would be very grateful
I am using a teensy 3.2 to generate a 40khz signal using the IntervalTimer class. I need a very precise timing: each interrupt should not be delayed by more than a few cycles.
What the interrupt routine does is mostly switching the state of 4 digital pins simultaneously to create 4 similar waves. Yet, I cannot use PWN to do that because I do not generate a perfectly periodical signal: sometime, a given pin may is not be switched depending on other external variables.
If the teensy do only that, all is fine..
But then, at the same time, I am driving a SSD1306 screen via I2C (for monitoring). As you have probably guessed, its messes with my interrupt routine and, when communicating with the I2C device, the timer becomes irregular.
I did set the priority of the IntervalTimer routine to 0 using the setPriority() method and I thought that this would enable my interrupt (it is very short) to get called even during an I2C interrupt. I guess I do not understand how interrupt nesting works !
I also tried to use the i2c_t3 library instead of Wire and I tried the IRQ and DMA modes. Still no luck... The immediate transfer mode of i2c_t3 does not seem to be working with the adafruit library for SSD1306.
Does anyone know how I could fix my problem. I do not mind if a i2c transfer sometimes fails.. but I need the timer interrupt to stay fairly regular.
Thank you !