Skip to content

Calling analogWrite multiple times causes glitches in PWM signal #939

Closed
@ktand

Description

@ktand

Describe the bug
Calling analogWrite multiple times causes glitches in PWM signal

To Reproduce
#include <Arduino.h>

void setup() {
pinMode(PC_6, OUTPUT);
}

void loop() {
analogWrite(PC_6, 128);
delayMicroseconds(50);
}

Expected behavior
The PWM signal should be glitch-free if analogWrite is called repeatedly with the same value. When PWM has been set up for the selected pin the next call to analogWrite should just update the PWM duty cycle. Now it appears that it restarts the PWM signal.

Screenshots
If applicable, add screenshots to help explain your problem.
PWMGlitch

Desktop (please complete the following information):

  • OS: Windows 10
  • PlatformIO: ST STM32 6.0.0
  • STM32 core version: 1.7.0

Board (please complete the following information):

  • Name: armed_v1

Additional context
I'm using STM32 core version 1.7.0 as a part of PlatformIO-ststm32 6.0.0. I have checked the code and the behaviour should be the same in 1.8.0.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions