PWM
-
I am attempting to access PWM for channels 1-4 using my own application. The defconfig file for the board doesn't include
CONFIG_PWM=y
CONFIG_PWM_MULTICHAN=y
CONFIG_PWM_NCHANNELS=8Is PWM configured elsewhere on the Flight Core?
-
I am able to use the PWM command line tool to change the parameters and enable the PWM on the board. I'm using the PWM example to try and do it programmatically.
-
The PWM outputs at the lower level are configured here via the timers, as far as pinmappings:
https://github.com/PX4/PX4-Autopilot/blob/master/boards/modalai/fc-v1/src/timer_config.cppThe actual outputs get heavily controlled via mixers, like this;
https://github.com/PX4/PX4-Autopilot/blob/master/src/drivers/pwm_out/PWMOut.cpp#L552Does you application get anything from PX4 (e.g. maybe you implement with the 'OutputModuleInterface' ) or is it totally a roll you own?
-
My plan was to use the pwm.cpp file as a reference, since I was previously able to use it to adjust the PWM output on a channel. See image.
However, now that I'm ready for the PWM development I can't seem to access the PWM channels as no PWM device shows up. I have tried this on two Flight Cores, both recently purchased. The Flight Core I used for the initial test shown in the image was put in the field but is being shipped back to me.
I ran my own firmware, I pulled fresh code from github, and for the second board I ran it without making any changes. None of these show a PWM device.
Is there some other configuration that is required to enable the PWM driver that I may be missing?
-
Hi @Andrew-Keefe ,
On the setup that doesn't have a PWM device, have you selected any airframe? I've seen this is the mixer isn't loaded, and the mixer not loading is normally from no airframe (although you are doing some custom stuff, so not positive).
This is where the output device gets selected:
https://github.com/PX4/PX4-Autopilot/blob/master/ROMFS/px4fmu_common/init.d/rc.interface#L157
-
I'm sure that's it. I remember now that I had selected a different airframe last time, though I'm not really using the airframe for my code.