Timer register definition doesn't match datasheet?

I meant that timer was working, but the prescaler was wrong. Writing to the register does change the prescale, but everything is off by one bit position.

There’s very little to the sketch outside of setting up the timer. I poll a flag to see if an input capture happened, and read the count out of the timer.

I played with the FSP tool inside of e2, but it started pulling in HAL stuff and it didn’t seem like it would generate something I could easily paste back into an Arduino environment.

Anyway, here’s the full setup code:

  R_MSTP->MSTPCRD_b.MSTPD5 = 0; //enable GPT0 module clock (General PWM Timer 321 to 320 Module Stop)
  delayMicroseconds(10);
  
  R_GPT0->GTCR_b.CST = 0; //stop timer
  R_GPT0->GTCR_b.MD = 0; //saw-wave PWM (000b)
  
  R_GPT0->GTUDDTYC = 0b11; //set 11b first (?)
  R_GPT0->GTUDDTYC = 0b01; //01b for up-counting
  
  R_GPT0->GTCR_b.TPCS = 0b011; //PCLKD/64 prescale
  R_GPT0->GTPR = 0xFFFFFFFF; //max cycle
  R_GPT0->GTCNT = 0; //0 initial count

  //GTCCRA input capture enabled on the...
  R_GPT0->GTICASR_b.ASCARBL = 1; //rising edge of GTIOCA input when GTIOCB input is 0
  R_GPT0->GTICASR_b.ASCARBH = 1; //rising edge of GTIOCA input when GTIOCB input is 1
  
  //set up Pin D6 (P106)
  R_PFS->PORT[1].PIN[6].PmnPFS_b.PMR = 1; //Used as an I/O port for peripheral functions
  R_PFS->PORT[1].PIN[6].PmnPFS_b.PSEL = 0b11; //GTIOC0B (GPT peripheral function)