Nano33 iot pwm frequency not correct?

Hi guys,

According to the Arduino docs, the PWM frequency of the Nano 33 IoT is 732 Hz.
(analogWrite() - Arduino Reference)

Everything works correctly when I power the board from the PC USB port.

However, if I power the board using the 3.3V pin from an external power supply,

the frequency drops to 712 Hz(see the pictures below).

My code :

#include "wiring_private.h"

#define PWM_PIN 2

void setup() {
pinMode(PWM_PIN, OUTPUT);
analogWrite(PWM_PIN, 127);
}


void loop() {
    delay(1);
}

Does anyone know how to solve this problem?

Thanks!

Adam Shiau

Since it is not crystal controlled I would expect that. If you look close you may even see some rounding of the corners.

Well you can get pretty much any frequency you want using the timers, or by bit banging.
However if the clock isnt stable you wont get a stable frequency.

I think the frequency is fairly stable but not accurate. It seems like the clock frequency used for millis() has some 'offset', and this offset is different for each Nano 33 IoT board.
I found a similar thread here:
Nano 33 IoT millis() rate varies with USB power source

I don't know if adding an external 32.768KHz crystal can fix this. Any suggestions?

Adam.S

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.