analogWrite inside an interrupt

You should set compiler warnings on. This should be 1000UL * 1000UL, otherwise it truncates, which is probably what @Grumpy_Mike was referring to. I make it 16.96 seconds.

This is from one of the examples in that library;

// In Portenta_H7, avoid doing something fancy in ISR, for example Serial.print
// Or you can get this run-time error / crash

You could open an incident on Github: Issues · khoih-prog/Portenta_H7_TimerInterrupt · GitHub