diff --git a/drivers/pwm/pwm_nrf5_sw.c b/drivers/pwm/pwm_nrf5_sw.c index ac7f593f4a9..51f8b9f2aac 100644 --- a/drivers/pwm/pwm_nrf5_sw.c +++ b/drivers/pwm/pwm_nrf5_sw.c @@ -8,6 +8,10 @@ #include "pwm.h" +#define SYS_LOG_DOMAIN "pwm/nrf5_sw" +#define SYS_LOG_LEVEL CONFIG_SYS_LOG_PWM_LEVEL +#include + struct pwm_config { NRF_TIMER_Type *timer; u8_t gpiote_base; @@ -92,15 +96,20 @@ static int pwm_nrf5_sw_pin_set(struct device *dev, u32_t pwm, ret = pwm_period_check(data, config->map_size, pwm, period_cycles, pulse_cycles); if (ret) { + SYS_LOG_ERR("Incompatible period"); return ret; } /* map pwm pin to GPIOTE config/channel */ channel = pwm_channel_map(data, config->map_size, pwm); if (channel >= config->map_size) { + SYS_LOG_ERR("No more channels available"); return -ENOMEM; } + SYS_LOG_DBG("PWM %d, period %u, pulse %u", pwm, + period_cycles, pulse_cycles); + /* stop timer, if already running */ timer->TASKS_STOP = 1;