I expect you are talking about PWM generation.
1. the easiest solution is to use scope.
2. But in the SW solution is to calculate PWM period for 5Hz and set PWM modulo register to calculated value.
If you know that your modulo value is for example 0xFF88h then you can easily check the modulo register with SW checks and you will be sure that PWM on pin is expected 5Hz. On advance you also can monitor SIU module if the pin functionality hasn't change during device runtime.
3. Another HW solution is to connect ADC to the PWM pin and measure the frequency by ADC.