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

nRF52: "spike" after last period with inverted polarity PWM

Hi,

I use the a gpiote_in_event to trigger a number of PWM pulses which works fine so far. However, the exact behaviour of the generated signal is important so that the device interfaced to the signal line does also behave correctly.

I saw that if I use inverted polarity (what is what I want to do), i get a very short pulse at the end of the PWM (after the number of specified periods). It seems that after the number of specified repetitions, the HW is just about starting another PWM sequence which is then immediately aborted.

This spike is a problem in my system, how can i get rid of it?

/EDIT: see screenshot

Parents
  • We need more information on how exactly you've implemented "gpiote_in_event to trigger a number of PWM pulses".

    Are the IN_EVENT pin or PWM pin driven high or low? 

  • Hi haakonsh,

    See the code snippet below.

    A falling edge on the HELPER_PIN should start the PWM

     
     
     //configure gpiote
     nrfx_gpiote_in_config_t helper_pin_cfg = NRFX_GPIOTE_CONFIG_IN_SENSE_HITOLO(true);
     err = nrfx_gpiote_in_init(HELPER_PIN, &helper_pin_cfg, NULL);
     nrfx_gpiote_in_event_enable(HELPER_PIN, false);
     
     
     //configure ppi channel
     uint32_t start_task_addr = nrfx_pwm_simple_playback(&m_pwm0, &seq, NBR_ADC_SAMPLES_AO, NRFX_PWM_FLAG_START_VIA_TASK|NRFX_PWM_FLAG_STOP);
     
     nrfx_ppi_channel_alloc(&ppi_ch_start_clk);
     nrfx_ppi_channel_assign(ppi_ch_start_clk, nrfx_gpiote_in_event_addr_get(HELPER_PIN), start_task_addr);
     nrfx_ppi_channel_fork_assign(ppi_ch_start_clk, nrfx_timer_task_address_get(&m_tmr1, NRF_TIMER_TASK_START));
     nrfx_ppi_channel_enable(ppi_ch_start_clk);

Reply
  • Hi haakonsh,

    See the code snippet below.

    A falling edge on the HELPER_PIN should start the PWM

     
     
     //configure gpiote
     nrfx_gpiote_in_config_t helper_pin_cfg = NRFX_GPIOTE_CONFIG_IN_SENSE_HITOLO(true);
     err = nrfx_gpiote_in_init(HELPER_PIN, &helper_pin_cfg, NULL);
     nrfx_gpiote_in_event_enable(HELPER_PIN, false);
     
     
     //configure ppi channel
     uint32_t start_task_addr = nrfx_pwm_simple_playback(&m_pwm0, &seq, NBR_ADC_SAMPLES_AO, NRFX_PWM_FLAG_START_VIA_TASK|NRFX_PWM_FLAG_STOP);
     
     nrfx_ppi_channel_alloc(&ppi_ch_start_clk);
     nrfx_ppi_channel_assign(ppi_ch_start_clk, nrfx_gpiote_in_event_addr_get(HELPER_PIN), start_task_addr);
     nrfx_ppi_channel_fork_assign(ppi_ch_start_clk, nrfx_timer_task_address_get(&m_tmr1, NRF_TIMER_TASK_START));
     nrfx_ppi_channel_enable(ppi_ch_start_clk);

Children
Related