TeensyWolf
Well-known member
Teensy 4.1 driving a Newhaven SSD1322 256x64x4bit OLED takes about 24mS to update using U8G2 on SPI 4 wire. I maxed out the SPI rate to 10Mhz (max rate on SSD1322 spec, Tcycle = 100nSec).
OLED updates happen in main LOOP. Update rate is not critical, set to about 20 hz, works fine.
I have time sensitive serial communications on HW Serial that I need to receive and respond to. I'm polling serial.available in main LOOP, ~70 bytes hitting me at 230kbps at 72Hz
To keep in time with the incoming data, I'd like to setup interrupt on serial RX, but I believe there already exists a serial interrupt that is buffering the incoming data.
This is the list of solutions I dreamt up.
Looking for any examples of a serial interrupt on receive. I've studied void HardwareSerial::IRQHandler(), but it's a bit unclear how best to proceed. Best I could come up with is to add a if statement, checking (n == 0x0A) and I set pin 4 high, then setup interrupt on pin 5 (wired to 4)? How do I only do it for HW Serial 4?
Thanks
OLED updates happen in main LOOP. Update rate is not critical, set to about 20 hz, works fine.
I have time sensitive serial communications on HW Serial that I need to receive and respond to. I'm polling serial.available in main LOOP, ~70 bytes hitting me at 230kbps at 72Hz
To keep in time with the incoming data, I'd like to setup interrupt on serial RX, but I believe there already exists a serial interrupt that is buffering the incoming data.
This is the list of solutions I dreamt up.
- Trigger an interrupt when I receive the last 2 bytes (0x0D 0x0A), indicating end of packet.
- wait until the buffer fills to my expected value (less robust)
- Trigger on each incoming byte
- Redo OLED to use U8X8 instead of U8G2 - if I have to
- Use monochrome OLED - next version of hardware?
- offload OLED to 2nd micro - last resort
Looking for any examples of a serial interrupt on receive. I've studied void HardwareSerial::IRQHandler(), but it's a bit unclear how best to proceed. Best I could come up with is to add a if statement, checking (n == 0x0A) and I set pin 4 high, then setup interrupt on pin 5 (wired to 4)? How do I only do it for HW Serial 4?
Thanks