Xenon ethernet featherwing, PWM problem

I 've been trying to use the PWM (analogWrite) capabilities of my Xenon (firmware v0.9.0) + Ethernet FeatherWing but none of the available ports from the documentation (not only the ones used by FeatherWing) seems to work. I have tried a completely new set of Xenon + Ethernet FeatherWing and still this issue occurs. Finally, I had configured an Argon to use the Ethernet FeatherWing, and the Argon works as expected.

I would appreciate the community’s input.

@ParticleD, or @mstanley are you able to assist?

It would be helpful to know how you are using analogWrite. Show your exact code to duplicate the issue. Also, how is your circuit wired and what are you trying to accomplish?

Hello there, cannot provide the complete code, but the results are the same with this bare minimum example. Doing some more digging around, I realized that the PWM does not work for frequencies less than 5 Hz. The circuit is a simple led connected to the A0 (tried various pins with the same result) pin. I would expect with a frequency of 1 Hz the led to blink but it doesn’t. Raising the frequency to 10Hz and higher I can observe the led to strobe. This might not be a problem with the led because I verified it with an Argon. In firmware 1.1.0-rc.1 release still does not work for Xenon.

#include "application.h"
#include "stdarg.h"

void setup() {
    pinMode(A0, OUTPUT);
    // doesn't work for frequencies < 5 Hz
    analogWrite(A0, 200, 1);	// this should blink a led with 1Hz

void loop() {

I looked through this nRF52840 datasheet but could not find any limitations to minimum frequency for the PWM peripherial. Perhaps @rickkas7 can verify that the 1Hz PWM frequency is valid and works as you intend. The Xenon docs do state that 1Hz PWM is valid. By the way, if I understand the PWM module correctly, at a fequency of 1Hz you will get one pulse every second and with a duty cycle of 200 you would only get an on time of about 784ms and an off time of about 216ms. Is that what you were going for?

perhaps the analogWrite moved to the loop?

The minimum frequency is actually 5 Hz, not 1 Hz. I updated the documentation. Sorry for the confusion.

1 Like