kingforger
Active member
I'm using analogWrite to use the PWM functionality on a Teensy 4.0. I'm using 10 bits resolution. When I do analogWrite(PIN, 1023) I would expect the pin to be on 100% of the time without any dips or 'blips'.
However, there's a little 'blip' where the voltage goes down to zero for a very short time at the frequency that I specified earlier via analogWriteFrequency. My 350MHz BW scope sees this clearly. If I tell it to limit BW to 20MHz, you cannot see this any more. So for example, if I do:
analogWriteFrequency(PIN, 50000);
analogWrite(PIN, 1023);
then you will see a little 'blip' or dip down to 0V (and then ringing back up) every 20 microseconds (50kHz rate). As shown below:
HOWEVER, if I instead change the order and do:
analogWrite(PIN, 1023);
analogWriteFrequency(PIN, 50000);
Then there are no blips at all even at 350MHz BW! It's perfectly on all the time as I expect. As shown below:
This seems to be a bug to me. FYI you see 5V above because it's gone through a digital isolator with 5V output to interface to other things.
However, there's a little 'blip' where the voltage goes down to zero for a very short time at the frequency that I specified earlier via analogWriteFrequency. My 350MHz BW scope sees this clearly. If I tell it to limit BW to 20MHz, you cannot see this any more. So for example, if I do:
analogWriteFrequency(PIN, 50000);
analogWrite(PIN, 1023);
then you will see a little 'blip' or dip down to 0V (and then ringing back up) every 20 microseconds (50kHz rate). As shown below:
HOWEVER, if I instead change the order and do:
analogWrite(PIN, 1023);
analogWriteFrequency(PIN, 50000);
Then there are no blips at all even at 350MHz BW! It's perfectly on all the time as I expect. As shown below:
This seems to be a bug to me. FYI you see 5V above because it's gone through a digital isolator with 5V output to interface to other things.
Last edited: