Disabling IRQ for better performance - Teensy 4.1

Status
Not open for further replies.

roni.fli

New member
We'r sampling two pins (A,B Encoder) at frequency upto 10mhz.
When the code was simple read/count the readings matched the input pulse.
once we extended the project , added Ethernet communication with PC & Debug printing to Serial
we began to see inconsistent readings.
At the code that does the reading & calculation
i disabled those interrupt: (tried also putting priority to 255 , didn't help)
NVIC_DISABLE_IRQ(IRQ_USB1);
NVIC_DISABLE_IRQ(IRQ_ENET);
NVIC_DISABLE_IRQ(IRQ_PIT);
And reenabled them once the counting ended.
And performance is back on track , But from this moment
no response from Serial Or Ethernet
How do i "Revive" back the Irq for those ?

Our project is quite simple , replacing encoder counters with the Teensy on our machines
The test is also simple , pulse generator on the input pin ,
counting for 1000msec , and expecting to get the same result on each trial
 
You know the T4 has hardware quadrature decoders built in and there's a library to use them?
https://forum.pjrc.com/threads/58478-Teensy-4-x-H-W-Quadrature-Encoder-Library

Unfortunately it's not good for us since it's slow (relative)
using an Interrupt as the encoder source is slower then poling IO
we use Linear Encoder (0.1u) at a rate of 600mm/sec (6mhz) at a range of 600mm !
using IO poling i manage to keep up with the rate , but as an example:
Tic -> 0.25usec , every 20 ticks i send a Peg (set IO) so every 5usec a peg is sent
during this session (3000msec) i get one peg which lasts 52usec ,
after disabling
NVIC_DISABLE_IRQ(IRQ_USB1),NVIC_DISABLE_IRQ(IRQ_ENET),NVIC_DISABLE_IRQ(IRQ_PIT);
all the pegs comes out correctly.
But then i reenable the IRQ , but my network & Serial are not working anymore !
so my problem is how to "Revive" back those IRQ
 
Status
Not open for further replies.
Back
Top