Skip to content

Idle pin state in PWM #2446

@DonatelloX

Description

@DonatelloX

Arduino_Core_STM32 2.8.0 + Arduino IDE 2.3.2
STM32F303CC in custom board

I use this part of code to initialize a PWM:

  HardwareTimer *timerTreatment;
  [...]
  pinMode(pwmPinTreatment, OUTPUT);
  TIM_TypeDef *Instance = (TIM_TypeDef *)pinmap_peripheral(digitalPinToPinName(pwmPinTreatment), PinMap_PWM);
  uint32_t channel = STM_PIN_CHANNEL(pinmap_function(digitalPinToPinName(pwmPinTreatment), PinMap_PWM));
  timerTreatment = new HardwareTimer(Instance);
  timerTreatment->setPWM(channel, pwmPinTreatment, baseFrequencyTreatment, 53);
  timerTreatment->pause();
  [...]

PWM works well. But when I use it in my various parts of the code, doing:

[...]
timerTreatment->resume();
[...]
timerTreatment->pause();
[...]

after pause() the PWM signal in the idle state is sometimes at a logical high level (wrong) and sometimes correctly at a low (correct) level. It should always be low when pause().
I can't use it properly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions