I'm intending to set up a digital delay using a circular buffer (in SRAM) with an Arduino Due (@84MHz). The lenth of the buffer determines the delay. I need about 1us resolution and the delay needs to be dynamically settable between 0 - 500us. I'll probably use most of the memory just for the buffer.
I've got a very basic setup going (with a fixed delay, no buffer), that just updates a temporary variable with the current state of the input signal and then writes the whole word to another port in order to set the state.
Next up is designing the buffer so I can add some delay to the output of the signal.
Filling the buffer using interrupts watching signals on the same port shouldn't be too difficult but I am wondering:
a) taking speed in consideration, which buffer method will have the least processing overhead? Memory stack or an array, or someting else?
b) is there a way to read a port and set an output port in one clock cycle? I am now using
REG_PIOD_ODSR=outbyte; but ideally it needs to point to a memory address directly.