Ok.
One factor is missing: The timer's
"source clock".
The way the timer works is:
1. You select a source clock, which by its frequency defines the "source" frequency for the timer.
2. You select a "divider" (>=2). The timer "ticks" at a rate of (source frequency / divider).
3. You select an "alarm value" (Z) to specify when the timer's interrupt is to trigger.
Normally, the timer counts, at the rate determined by 1. and 2., from 0 up to the alarm count value and then triggers an interrupt. An "auto reload" timer automatically resets to (typically) 0 when the alarm count is reached and keeps counting up, repeating the process and giving a fixed rate of interrupts of ((source frequency / divider) / alarm value).
In most cases you won't care about setting a specific counter value but just let it run from 0.
The relation is thus: F[alarm] = F[src] / (divider * alarm value), or F[src] / F[alarm] = divider * alarm value
For 115200Hz, you could do:
1. source clock = GPTIMER_CLK_SRC_APB (which is 80 MHz)
2. 80'000'000Hz/115200Hz = 694.4444..., which should equal (divider * alarm value)
3. select any combination of divider (>=2 and <= 65536) and alarm value (>0) which (closest) satisfies (divider * alarm value) = 694.4444...; for example divider := 2 -> alarm value = ((80Mhz/2)/115200Hz) ~ 347, giving an interrupt frequency of 80MHz/(2*347) ~ 115273Hz.
If the frequency attainable by the hardware is not accurate enough, you can implement a form of dithering by varying the alarm value for the next interrupt by 0 or 1 in the ISR to "succesively approximate" the
average interrupt frequency to the exact required frequency.