Analog (PWM) output failure

I've encountered a critical issue on two brand-new Arduino Uno Q boards: the analogWrite() function appears to be completely non-functional.

I am using the arduino:zephyr:unoq core, version 0.51.0(If I remember correctly, I update when entering the Arduino lab app).

I'm using a minimal "Fade" example (code below) that runs 100% on the MCU (STM32). The LED shows no activity on any of the documented PWM pins (D3, D5, D9, etc.).

// sketch.ino - Minimal Reproducible Code
#include "Arduino_RouterBridge.h"

const int pwmPin = 5; // Tried D5, D9, D3
int brightness = 0;
int fadeAmount = 5;

void setup() {
    pinMode(pwmPin, OUTPUT);
    Bridge.begin();
}

void loop() {
    // This line appears to have no effect
    analogWrite(pwmPin, brightness);

    brightness = brightness + fadeAmount;
    if (brightness <= 0 || brightness >= 255) {
        fadeAmount = -fadeAmount;
    }
    delay(30);
}

# main.py - Just to keep the app alive
from arduino.app_utils import *
import time
def loop(): time.sleep(1)
App.run(user_loop=loop)

My Troubleshooting Steps:

  1. Hardware is OK: Using digitalWrite(pwmPin, HIGH) on the exact same pin successfully lights up the LED.

  2. Not an Isolated Case: This issue is 100% reproducible on two different Uno Q boards.

  3. "Software PWM" Works: I successfully implemented a manual "Software PWM" using digitalWrite() and delayMicroseconds(). This workaround does control the LED brightness correctly.

Conclusion:
This strongly suggests a software bug in the arduino:zephyr:unoq core package, where the analogWrite() API is likely not implemented or is broken.

My Questions:

  1. Can anyone else reproduce this?

  2. Is this a known bug?

  3. Aside from my manual "Software PWM" workaround, are there any other solutions?

Thanks!

Hey @mzengai,

just remove pinMode(pwmPin, OUTPUT); from the setup() and you should be fine.

It is a known issue, or, better, a new feature that will be documented soon.

Enjoy!

Thank you! That works!

It's not a bug, it's a feature

XD

1.

Does your UNO Q produce PWM signal on DPin-11?

2.

The above library is only needed if there is something to print in the Console>>Pythone and Console>>Serial Monitor or data exchange between MPU/MCU.

3.

Please re-post the above script in syntactically correct form.

It would be a feature of the UNO Q Board if there was something otherwise in the hardware circuitry that could not be corrected anymore. I agree with @mzengai that this is a software bug and fixable.