raiden00pl commented on issue #12381: URL: https://github.com/apache/nuttx/issues/12381#issuecomment-2599631426
@ppisa the question is whether it's even possible to create a general interface that can support all complex PWM cases? It seems to me that this is not possible without significantly complicating the entire interface. In addition, many of these use cases are highly architecture specific. Motor control is a perfect example here. In that case we have to control duty cycle (and ideally update all duty at once) and get ADC samples that are in sync with this PWM. Additionally, there are issues such as current sense path calibration or selecting appropriate PWM mode, which is highly architecture specific. I think in such cases using a general PWM and ADC drivers is a bad solution. That's why in the FOC implementation in NuttX, there is a separate upper-half driver for FOC that combines in a single driver PWM, ADC, and synchronization mechanism for user space (https://github.com/apache/nuttx/tree/master/include/nuttx/motor/foc). It should be possible to generalize this implementation even more and create a general "adcpwm.c" driver that implements in a single device n-channels PWM with m-channels ADC and synchronization for application. Two separate drivers in this case doesn't look good for me (`/dev/adcX` and `/dev/pwmX`), because the coupling between these two is too large and one is basically useless without the other. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org