This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Should PWM end_delay be honoured or ignored if playback_count is 1 ?

I've modified the simple_pwm example from : devzone.nordicsemi.com/.../

I've either misunderstood or have found a bug where by the 'end_delay' value is ignored if the 'playback_count' prameter is set to 1 when calling 'nrf_drv_pwm_simple_playback'.

I wondered if someone could clarify this for me please?

Thanks Wayne

The code:

static void pwm_simple(void)
{
	uint32_t err_code;
	nrf_drv_pwm_config_t const config0 =
	{
			.output_pins =
			{
					BSP_LED_1 | NRF_DRV_PWM_PIN_INVERTED, // channel 0
					NRF_DRV_PWM_PIN_NOT_USED,             // channel 1
					NRF_DRV_PWM_PIN_NOT_USED,             // channel 2
					NRF_DRV_PWM_PIN_NOT_USED,             // channel 3
			},
			.irq_priority = APP_IRQ_PRIORITY_LOW,
			.base_clock   = NRF_PWM_CLK_1MHz,
			.count_mode   = NRF_PWM_MODE_UP,
			.top_value    = 10,
			.load_mode    = NRF_PWM_LOAD_COMMON,
			.step_mode    = NRF_PWM_STEP_AUTO
	};

	err_code = nrf_drv_pwm_init(&m_pwm0, &config0, NULL);
	APP_ERROR_CHECK(err_code);

	static nrf_pwm_values_common_t seq_values[] =
	{
			10, 0
	};

	nrf_pwm_sequence_t const seq =
	{
			.values.p_common = seq_values,
			.length          = NRF_PWM_VALUES_LENGTH(seq_values),
			.repeats         = 0,
			.end_delay       = 5        // Has no effect unless the '1' below is >1
	};

	nrf_drv_pwm_simple_playback(&m_pwm0, &seq, 1, NRF_DRV_PWM_FLAG_LOOP);

}
Parents Reply Children
No Data
Related