had a quick look.. didn't verify your bit/register assignments as don't have the datasheet handy here..
I'm guessing you've remembered to swap the input pin to one that timer 4 can use, and have looked up the timer input you have to set with the bits.. (I was using TI1 with timer 1/ch1) ..
also.. try the test without dma.. comment out the dma bits, dont set the dma enable bit, and busy poll on the timer capture
//If we weren't using DMA, we could busy wait on the CC1IF bit in SR
//
//when the timer captures, the CC1IF bit will be set on the timer SR register.
//CC1IF bit is bit 1 (page 332)
while(!bitRead(r.adv->SR, 1)){
}
SerialUSB.println("Timer triggered : ");
SerialUSB.println(r.adv->CCR1);
If it works with busy poll then its your dma setup that needs fixing, if not, then there's still something to fix with the timer.
I could never quite work out what actually started the transfers.. but I think the first few values I got were iffy.. but I always did the setup & start very close together..
I used internal pullups, (input_pullup), hopefully your circuit has externally sorted that as you just have input
Otherwise, nice to see the code was helpful to someone =)
When I get back to my board, I've got to make it DMA from the timer capture, across to the SPI TX.. =)