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

nrf52810 PWM issue

Hi All:

When I simulated PWM by GPIO, the output current noise was shown like the picture below (red circle area):

  

Cause it will lead to a loading issue in the backend, so I'm wondering the root cause and if there is any possible solution for this.

Any suggestion will be great. Thanks!!

Update working details: 

SDK: 14.2
52810: QFAAB0 - 1740AC
  
  
   
Update code of generating PWM :

We use GPIOTE to simulate the PWM.

 

    #define  IO_KEY_PAIRING     15

    #define  IO_ZERO_X               31

 

     APP_ERROR_CHECK(nrf_drv_gpiote_init());

    nrf_drv_gpiote_in_config_t gpiote_config =

    {

        .sense = NRF_GPIOTE_POLARITY_TOGGLE,

        .pull = NRF_GPIO_PIN_PULLUP,

        .is_watcher = false,

        .hi_accuracy = false

    };

    APP_ERROR_CHECK(nrf_drv_gpiote_in_init(IO_KEY_PAIRING, &gpiote_config, gpiote_event_handler));

    nrf_drv_gpiote_in_event_enable(IO_KEY_PAIRING, true);

    gpiote_config.pull = NRF_GPIO_PIN_NOPULL;

    APP_ERROR_CHECK(nrf_drv_gpiote_in_init(IO_ZERO_X, &gpiote_config, gpiote_event_handler));

    nrf_drv_gpiote_in_event_enable(IO_ZERO_X, true);

 

In  gpiote_event_handler(), we generate PWM pulse according to IO_ZERO_X.

  

    
  

Update code of generating PWM  --- gpiote_event_handler()- :

static void gpiote_event_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)

{

    NRF_LOG_INFO("gpiote_event_handler");

    if (pin == IO_KEY_PAIRING)

    {

        uint32_t read_value = nrf_gpio_pin_read(IO_KEY_PAIRING);

        if (!read_value)

        {

            nrf_delay_ms(1);

            if (read_value == nrf_gpio_pin_read(IO_KEY_PAIRING))

            {

                m_pairing_key_latch_for_on_off = 0x01;

                m_pairing_key_latch = 0x01;

            }

        }

    }

 

    if (pin == IO_ZERO_X)

    {

        controls_zero_x_trigger();//generate PWM

    }

}

Parents Reply
  • I don't think you'll have a problem with softdevice. You can see the softdevice documentation to see which peripherals are in use. As long as you use others (and there are plenty left) you should not have a problem.  


    "The Programmable peripheral interconnect (PPI) enables peripherals to interact autonomously with each other using tasks and events independent of the CPU."

    So this is designed exactly for what you're doing.  An external signal can control PWM with minimal CPU involvement.

Children
Related