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

Does the GPIOTE effect the GPIO pin configuration in particular the drive I need to keep it Disconnect 0

Hi

Using PCA 10040A , SDK 16.0.0 and Segger Studio.

I would like to generate a short accurate *** on a GPIO , probably 250 nano seconds duration. So I am looking at using the GPIOTE feature.

However I need to keep the GPIO drive configuration as 

"NRF_GPIO_PIN_D0S1 = GPIO_PIN_CNF_DRIVE_D0S1, ///< !< Disconnect '0' standard '1'." 

So that when its low there is no drive its effectively Open Collector

The GPIOTE doc says that it takes over the GPIO and it says "When the GPIOTE is disconnected from a pin, see MODE field in CONFIG[n] register, the associated pin will get the output and configuration values specified in the GPIO module."

This suggests that my drive configuration maybe changed by the GPIOTE module

Can someone confirm this please and if its correct can anyone suggest an alternative to using the GPIOTE/PPI feature

Robin

We need to generate a precise pulse on a GPIO in nanoseconds that is with 16MHZ clock 62.5ns resolution , will typically be multiples of this.

I was thinking of using the GPIOTE to get the precision, however the GPIO being used is configured as 

   

So effectively Open Collector when LOW we need the GPIO to be in this state when LOW. 

When you configure the GPIOTE it takes over the GPIO and the configuration no longer applies.

We need to take the HIGH GPIO for a precise period and then return to the LOW Disconnected state when finished.

Any ideas how we can do this, I did think of using a timer but reading other posts there is a lot of inaccuracy in doing it that way

Thanks

  • Hi Torbjorn

    Great this is what I need, i assume  I will need to set the interrupt enable parameter (the last param) in the 2nd call to  nrf_drv_timer_extended_compare()  so that the "timer_dummy_handler()" function is called when the 2nd event occurs and I will know the pulse has completed.

    Also I will want to change the period of the pulse, so once this is all setup can i simply call  nrf_drv_timer_extended_compare(&timer, (nrf_timer_cc_channel_t)1, 1 + LED_ON_TICKS,
    NRF_TIMER_SHORT_COMPARE1_CLEAR_MASK | NRF_TIMER_SHORT_COMPARE1_STOP_MASK, false);

    again but with a new time period ?

    And then use   nrf_drv_timer_resume()  to start it again with the new time period for the 2nd compare

    Thanks Robin

  • Hi Robin

    Yes, if you want a callback after the pulse is complete you should enable interrupts as you describe. This will happen more or less immediately if you set the pulse length to 250ns ;)

    robin said:

    Also I will want to change the period of the pulse, so once this is all setup can i simply call  nrf_drv_timer_extended_compare(&timer, (nrf_timer_cc_channel_t)1, 1 + LED_ON_TICKS,
    NRF_TIMER_SHORT_COMPARE1_CLEAR_MASK | NRF_TIMER_SHORT_COMPARE1_STOP_MASK, false);

    again but with a new time period ?

    Yes, this should work fine. 

    Best regards
    Torbjørn

Related