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

PWM drive: how to generate PWM signals that are phase shifted 90 degree

Hi

I want to generate two PWM signals that are phase shifted with 90 degree, with similar duty cycle. I have the following pwm configuration, but I don't know how to proceed further. I would be more than happy if someone could give me some help. I would appreciate if someone could send me a link to an example, if exists.

nrf_drv_pwm_config_t const pwm_cfg =
	{
		.output_pins =
        {
            9,		 																// channel 0
            10, 	 							             			// channel 1
            NRF_DRV_PWM_PIN_NOT_USED,             // channel 2
            NRF_DRV_PWM_PIN_NOT_USED,             // channel 3
        },
        .irq_priority = APP_IRQ_PRIORITY_LOWEST,
        .base_clock   = NRF_PWM_CLK_1MHz,
        .count_mode   = NRF_PWM_MODE_UP,
        .top_value    = 100,
        .load_mode    = NRF_PWM_LOAD_INDIVIDUAL,
        .step_mode    = NRF_PWM_STEP_AUTO
		
	};
	APP_ERROR_CHECK(nrf_drv_pwm_init(&m_pwm0, &pwm_cfg, NULL));
	// This array cannot be allocated on stack (hence "static") and it must
    // be in RAM (hence no "const", though its content is not changed).
   static nrf_pwm_values_individual_t seq_values[] = {25, 25, 0, 0};
		
		nrf_pwm_sequence_t const seq =
    {
        .values.p_individual = seq_values,
        .length          = NRF_PWM_VALUES_LENGTH(seq_values),
        .repeats         = 0,
        .end_delay       = 0
    };

		 nrf_drv_pwm_simple_playback(&m_pwm0, &seq, 5, NRF_DRV_PWM_FLAG_STOP);
 

p.s I am using sdk.v14

Thanks in advance

Related