clock.fps() returning 0

I have an application that prints clock.fps() to UART. Usually the value hovers around 92 FPS which is great but once in a while, there is a sudden drop to 0 after which the value bounces back up.

Is this happening because of the garbage collector? I have tried declaring most variables as const or declaring them outside the main while loop. Are there any solutions other than calling gc.disable() ?

Hi, can I see your code?

Here’s the implementation of the code BTW:

It’s super easy to roll your own version of it.

I see. However, systick can wrap around right?
I could email you my code.

Yeah, it can.

I suggest just using pyb.millis() and make your own FPS counter.