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

nRF52840 - giving userdefined function at PPI task end

Hello,

We were just wondering if it is possible to give user-defined function at the PPI TEP instead of starting timer or generating some GPIOTE task.

Is it possible to configure a PPI channel where there is a GPIOTE event and as per the occurrence of that event, some userdefined function executes?

nrf_drv_ppi_channel_assign(m_ppi_channel1,
                           gpiote_event_addr,
                           &user_defined_function);

I tried above way, it compiled but the function is not getting executed on GPIOTE event.

I can't use the timer interrupt for this as the frequency of GPIOTE event is really high (around 3MHz). And I want to capture 8-bit parallel port data in 'user_defined_function'

So, Can I make above logic work anyhow? Is it possible in PPI? Any suggestions how can I achieve this one?

Thanks in advance.

  • Hello,

    Sorry. I should have noticed.

    In your egu event handler you should use:

    NRF_EGU1->EVENTS_TRIGGERED[0] = 0;

    not

    NRF_EGU1->TASKS_TRIGGER[0] = 0;

    I also see that something triggered NRF_EGU1->EVENTS_TRIGGERED[1]. Not sure exactly what that is. I didn't get the time to look properly at it, but maybe you figure it out before tomorrow (Not sure where you are situated). 

    So I added:

    NRF_EGU1->EVENTS_TRIGGERED[0] = 0;
    NRF_EGU1->EVENTS_TRIGGERED[1] = 0;

    And then it stopped calling the EGU event handler. Maybe some other library is using EGU1, and you can try another EGU (to prevent EVENTS_TRIGGERED[1] from triggereng the event handler.

    Best regards,

    Edvin

  • Hello,

    Thanks for your suggestion. Now there is no unnecessary interrupts when the pulse is removed from the GPIO.

    As we have a very narrow timeline for capturing the image, we want to calculate the machine cycle of the subroutine and total available machine cycles for the controller. Is there any document/reference from where we can get this information?

    Also, we are capturing parallel port data. Is there any better way for storing the image on device? I have gone through the demo of flash data storage. Will it be appropriate to use flash storage considering very tight timeline (high rate of input data)?

    Can we write subroutine for EGU in assembly? Will it reduce number of machine cycles it takes to execute the subroutine?

    Thanks.

Related