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:
-
Hardware is OK: Using
digitalWrite(pwmPin, HIGH)on the exact same pin successfully lights up the LED. -
Not an Isolated Case: This issue is 100% reproducible on two different Uno Q boards.
-
"Software PWM" Works: I successfully implemented a manual "Software PWM" using
digitalWrite()anddelayMicroseconds(). 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:
-
Can anyone else reproduce this?
-
Is this a known bug?
-
Aside from my manual "Software PWM" workaround, are there any other solutions?
Thanks!