I started implementing a PWM driver for the STM32 processors a few days ago and ran into an issue I need clarification. According to the doc the duty cycle should be absolutely defined between 0 (no output) and 65535 (full output).
However, pwm_test and pwm_nrf52 require the application code to get the base frequency, calculate the top value from that and then scale the duty cycle accordingly. Just to be clear, the way I understand the interface a call like pwm_enable_duty_cycle(pwm, 0, 0x7FFF); should always lead to a 50% duty cycle, regardless of what the pwm frequency was set to and regardless of what counter frequency is internally used by the pwm driver. I would appreciate any clarifying comments as to what's going on here - or where I'm going wrong. The second question has to do with the sequence of api calls and at what point the PWM is actually started (which is an explicit step for STM32s). - Is it a safe assumption that an application must call pwm_chan_config for a channel before it can call pwm_enable_duty_cycle? - Is there support for kicking off a PWM channel without configuring an output pin? Lastly, in some email archive about the original PWM driver thread I found a reference to 'hal_pwm' - which I can't even find a header for. Did this get removed from the repo? Thanks a lot, Markus