I have created an experimental concept for a PWM fan control that requires the fan to be driven at 10Hz. Because the fan runs under 31Hz a special PWM.h library is required. As I see in my comments on the program I wrote only pins with 16 bit resolution can be used. I was testing this concept using a Yourdruino RoboRed, which allegedly has 16 bit resolution on pins 9 and 10 only. I have no idea where I found out that pins 9 and 10 had 16 bit resolution and consequently I don't know how to find out if the Nano 33 BLE has any pins with 16 bit resolution. If none of them have 16 bit resolution I will have to create my own code to run it. I have looked at the spec sheet and really don't know how to find this out or even what it is really called.
The library and my notes are presented below.
#include <PWM.h>
// Note for low frequency < 31Hz,the high resolution pwmWriteHR() must be used with 16 bit PWM Value
//For the RoboRed only pins 9 and 10 can be used with 16 bit resolution
after having initialized all the 4 pwm instances, the nordic_internal_pwm array will be full. At this point, when a pwm is deactivated, its entry in the array will not be cleared. This is a problem because in this way when a new pwm is initialized, here, no pwm instance will be found free and the default instance (the last one) will be returned. This means that no matter what pwm is deactivated, the new init pwm will try to use the default pwm instance even if it is not free. This results in a failure.
There is a mechanism for freeing up a channel you are no longer using by passing a negative value (e.g., analogWrite(LED_BUILTIN, -1)), so you can use analogWrite on more than 4 pins just as long as you don't ever go over 4 at one time: