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

PWM PHASE 120 degrees

Hi, i am using the nRF52dk would and im using the pwm driver example and im trying to understand the way the seq_values void works when it comes to phase or sequence would it be possible to to get some explaining and how it works please.

thanks for your help 

best regards 

nikolai

Parents Reply Children
  • So with 120 degrees, you are trying to generate the signal shown here?

        nrf_drv_pwm_config_t const config0 =
        {
            .output_pins =
            {
                BSP_LED_0 | NRF_DRV_PWM_PIN_INVERTED, // channel 0
                BSP_LED_1 | NRF_DRV_PWM_PIN_INVERTED, // 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_125kHz,
            .count_mode   = NRF_PWM_MODE_UP,
            .top_value    = 15625,
            .load_mode    = NRF_PWM_LOAD_INDIVIDUAL,
            .step_mode    = NRF_PWM_STEP_AUTO
        };
        APP_ERROR_CHECK(nrf_drv_pwm_init(&m_pwm0, &config0, 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 /*const*/ seq_values[] =
        {
            { 0x8000,      0,      0,      0 },
            {      0, 0x8000,      0,      0 },
            {      0,      0,      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
        };
    
        (void)nrf_drv_pwm_simple_playback(&m_pwm0, &seq, 1, NRF_DRV_PWM_FLAG_LOOP);

  • YES! thank you very much for your help, the scope for this is i need to move a bldc also is there some advice you can give me with regards to how i should attempt to go about with the 6 step commutation sequences of a bldc 3 phase bridge 

  • Hi,

    I have not worked with BLDC before, but you could try to create a update function that changes the seq_values

Related