Hello all,
I would like to propose the PWM upper-layer driver refactorization as a
possible GSoC topic for this year. The idea has already been discussed
in a GitHub issue <https://github.com/apache/nuttx/issues/12381> and
some solutions and steps have been proposed. The current PWM driver has
a bit messy pwm_info_s structure used for setting frequency, duty cycle
and other characteristics. It was initially designed for a single PWM
channel drivers, but the added support for multiple channels made it
more complicated. Now we basically have a different API based on
CONFIG_PWM_MULTICHAN option.
Additionally, it has some setbacks. One can't configure a different
frequency for different channels, which is a feature supported by some
MCUs, both duty cycle and frequency has to be recalculated to fit PWM
range (16 bit usually, but may be different), there is a big overhead if
just some characteristics are set and so on. The driver also combines
standard PWM and pulsecount ability, which have different purposes and
could be separated into two drivers, as Mateusz suggested.
The change to the driver will definitely be a breaking change API-wise,
but so far we agreed there are more benefits from simplifying it and
doing it right. The new structure proposed by Pavel Píša also has less
overhead if one PWM is configured as a multi-channel and other with just
one channel and some other benefits.
In general, this could be a nice GSoC project. The API redesign should
not require much coding, but has to be discussed thoroughly so we do it
right. The subsequent changes to low level drivers would probably take a
significant amount of time as well, because we would have to test these
drivers. I could help guiding the project if we find a student to apply
for it (I am not sure if we'll have someone from CTU this year) and
possibly provide tests on some hardware (samv7, imxrt, stm32...).
Best regards,
Michal
On 15. 01. 25 23:40, Tomek CEDRO wrote:
Google Summer of Code 2025 is coming, we already can and should
register ideas for NuttX :-)
https://community.apache.org/gsoc/