Hi
I generate a pwm signal via changing the state of one characteristic. In general, the pwm works fine. But the problem occurs when I add the timer which is responsible to switch on and off the pwm signal for 500ms interval. In this case, the timer starts working occasionally and consequently the pwm signal is also generated occasionally. I spent plenty of time for finding the solution to my problem but I did not make it. According to my problem, I think that the issue is located in app_timer library module. I found the following tread: devzone.nordicsemi.com/.../ which can be related to my problem, I hope so. Is it possible that I have the same type of the problem? It is worth mentioning that I am using the SDK 10 together with the corresponding softdevice S110. Here is the code which is executed when the user changes the state of the actual characteristic:
app_pwm_enable(&PWM1);
while(app_pwm_channel_duty_set(&PWM1, 0, 50) == NRF_ERROR_BUSY);
err_code = app_timer_start(m_buzzer_lpg_timer_id, BUZZER_START_200MS, NULL);
APP_ERROR_CHECK(err_code);
Here is the corresponding handler
static void buzzer_lpg_timer_handler(void *p_context)
{
static bool pwm_count = false;
static uint8_t test_buzzer_counter = 0;
if (test_buzzer_counter == 6)
{
app_pwm_disable(&PWM1);
pwm_count = false;
test_buzzer_counter = 0;
ble_is_Buzzer_Busy_update(&m_lpgs,0);
nrf_gpio_pin_set(BUZZER_BOOSTER);
nrf_gpio_pin_clear(BUZZER_PIN);
}
pwm_count = !pwm_count;
if(pwm_count)
nrf_gpio_pin_clear(BUZZER_BOOSTER);
else
nrf_gpio_pin_set(BUZZER_BOOSTER);
test_buzzer_counter++;
app_timer_start(m_buzzer_lpg_timer_id, BUZZER_INTERVAL,NULL);
}
I will be pleased with any kind of advice.