Skip to content

Why setPWM works and manual config doesn't work? #1922

Closed Answered by fpistm
SuppaTenko asked this question in Q&A
Discussion options

You must be logged in to vote

I've made some test with STM32G0316-DISCO and all configuration works as expected:

/* Comment to use all in one config */
#define FULL_CONFIG
#define pin  PB1_ALT2

void setup()
{
  Serial.begin(9600);
  // Automatically retrieve TIM instance and channel associated to pin
  // This is used to be compatible with all STM32 series automatically.
  TIM_TypeDef *Instance = (TIM_TypeDef *)pinmap_peripheral(digitalPinToPinName(pin), PinMap_PWM);
  uint32_t channel = STM_PIN_CHANNEL(pinmap_function(digitalPinToPinName(pin), PinMap_PWM));


  // Instantiate HardwareTimer object. Thanks to 'new' instantiation, HardwareTimer is not destructed when setup() function is finished.
  HardwareTimer *MyTim = 

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@fpistm
Comment options

Answer selected by fpistm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants