And if that doesn't work, you should enable PWM debug output to see what is going on:
CONFIG_DEBUG=y
CONFIG_DEBUG_VERBOSE=y
CONFIG_DEBUG_PWM=y
---In ***@yahoogroups.com, <***@yahoo.com> wrote :
Hi, André,
Post by adias.isep-/***@public.gmane.org [nuttx]I'm working with STM32Discovery Board and I'd like to have access to more GPIO pins working as PWM channels. I have test the NuttX example for PWM and at this moment the pin PD13 is working correctly. It's possible to help me how to include more channels as PWM in the same procedure of /dev/pwm....
From your other email, I see that you are using apps/examples/pwm to open /dev/pwmN and it fails with errno == 2 meaning that /dev/pwmN. Did you do
nsh> ls /dev
to see if the PWM driver exists? If it does not exist, then certainly you cannot open it.
In order to create another PWM driver instance, you need to extend the logic in configs/stm32f4discovery/src/stm32_pwm.c. The steps to create an PWM driver instance are:
1. Call this function with the timer that you want to use:
struct pwm_lowerhalf_s *stm32_pwminitialize(int timer)
2. Call this function to create the timer driver instance:
int pwm_register(FAR const char *path, FAR struct pwm_lowerhalf_s *dev);
where:
- dev is the value returned by stm32_pwminitialize() and path is the full path to where the driver will reside, like:
pwm = stm32_pwminitialize(3);
ret = pwm_register("/dev/pwmN", pwm);
Greg