So I have tried an SSD1331 OLED display with both a nano every/standard and I am getting display corruption only when using interrupts that trigger. I am very familiar with this display driver and have used it for countless things outside of using interrupts. With interrupts, It's like the display loses some kind of clock sync and starts writing gibberish, or random pixels or worse. This isn't a "how to fix my code" question. I am looking for general direction to try first to figure this out on my own, but here are my thoughts..
Here is what I have tried based on popular platforms like stackexchange, arduino, and other research:
These are 1ms - 2ms pulses from a signal generator.
PulseIn - Works for a while, but slows code down considerably, and eventually corrupts display.
Servo.h - also works for a while, doesn't slow code as much, but corrupts display pretty quickly.
Creating my own polling function - checking digital pin input every loop for a high or low signal, recording state and duration, and estimating the pwm width from that. This slows the program to a level I don't like, but doesn't corrupt the display (leading me to believe it's an interrupts-associated issue)
External Interrupts and Pin Change interrupts both tried.
Tried using attachinterrupt(digitalPinToInterrupt) and all associated code, still corrupts display when interrupt is enabled.
Tried using SPI.UsingInterrupt(); Doesn't seem to have an effect on spi display corruption, it's still corrupting when the interrupts is active.
(By active, I mean when the interrupt senses an event. I can let it sit for 20 min without doing the event and the display never corrupts, but the moment I do something to trigger an interrupt state, in any of the above code scenarios, the display will corrupt a bit (Random pixels, lines, etc) once the interrupts triggers)
What I would like direction on, is, does anyone know if, since interrupts stop the main code, is there a way to process signals from interrupts without interfering with SPI displays? (Keep in mind the above methods I have tried)
If yes, then I have more research to do. If no, then I can quit wasting my time trying to work around something that's not going to be possible.
If someone else has had success with the methods above using an SSD1331 driver on an Oled that displays complex graphics, then it must be my code causing issues.
None of the aforementioned methods work when timing SPI display events, I have to use internal registers - this is not desirable, but if that's the case, I can try to go down that rathole.
I'm missing something else.. could use a pointer in the right direction about using interrupts or measuring an external digital signal in a way that doesn't interfere with the display.
I would think an oscilloscope program would be a great example of interrupts vs real time display..
B: