I'm trying to trigger a single-byte SPI transaction (reading parallel lines via a shift register, the 74HC165), with the rising edge only of a 1.25MHz square wave signal (DS1077 programmable clock), and at present, the first digital write (pull the shift register load low) transaction only starts 110nsec after the rising edge. Then there is an intentional 50nsec delay for the shift register, then two digital writes - the shift register load high, then the chip select for the SPI transaction, which starts 250nsec after the rising edge. The problem is I wish to run with a higher clock rate (4MHz), and the interrupts stack up/fail if I run any faster than 1.25MHz.
I've tried to reduce timing to complete the SPI transaction as much as possible and have tried 1) polling (variable and often slower), 2) attachInterrupt and 3) attachInterruptVector (#define in the attached example sketch). However, I am very unsure whether I'm using attachInterruptVector correctly or not.
With attachInterruptVector, I can get slightly faster times, but its a wash and worse, it misses some of the clocks.
I've used a teensy 4.0 and 4.1 (wasn't expecting any changes, but considered perhaps I'd damaged one of them) with no changes in observed behavior.
I had thought the Teensy 4 would be able to complete its transaction somewhat faster, its possible I've just got inflated expectations (since the teensy is so darn capable). I've seen others toggling gpios faster than this, is there a reason why there's a long delay between the ISR getting triggered (or polling) and being able to do a digitalWriteFast or SPI transaction?
I've tried to reduce timing to complete the SPI transaction as much as possible and have tried 1) polling (variable and often slower), 2) attachInterrupt and 3) attachInterruptVector (#define in the attached example sketch). However, I am very unsure whether I'm using attachInterruptVector correctly or not.
With attachInterruptVector, I can get slightly faster times, but its a wash and worse, it misses some of the clocks.
I've used a teensy 4.0 and 4.1 (wasn't expecting any changes, but considered perhaps I'd damaged one of them) with no changes in observed behavior.
I had thought the Teensy 4 would be able to complete its transaction somewhat faster, its possible I've just got inflated expectations (since the teensy is so darn capable). I've seen others toggling gpios faster than this, is there a reason why there's a long delay between the ISR getting triggered (or polling) and being able to do a digitalWriteFast or SPI transaction?