This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM263P4: PDI, Sync0 and Sync1 under interrupt instead of polling the flags

Part Number: AM263P4

Hello,

I'm running the beckoff based ethercat example for the AM263Px(ethercat_subdevice_beckhoff_ssc_demo_am263px-lp_r5fss0-0_freertos_ti-arm-clang). I see though that the HW_EcatIsr,  Sync0_Isr and Sync1_Isr all run under a dedicated task in polling. Is it possible to get an interrupt instead of using the polling method?

  • Hi James,

    Yes it is possible, the example is based on FreeRTOS, so moving from polling to interrupt-only requires creating tasks for these functions and setting task priority

  • Is there any example how to achieve this(interrupt only)?

  • No James,

     We do not have an example for this specifically.

    Also, please note that interrupts are supposed to be low code size so ISR latency is low.

    A better approach would be a task - use a FreeRTOS Task to read and write to PDI/PDO.

  • If I wanted to achieve this by interrupt, where can I get information on how to do it?

  • Hi James,

    I was able to check this example further:

    The PDI ISR in the EtherCAT example can be configured to operate in two different modes depending on the ENABLE_PDI_TASK compile-time define:

    1. Interrupt Mode (Default)
    When ENABLE_PDI_TASK is NOT defined:

    PDI_Isr() is registered as a true interrupt handler
    It executes in interrupt context with minimal latency
    Triggered directly by hardware events from the ESC (EtherCAT Slave Controller)
    tiescsoc.c:233 shows: bspInitParams->pdi_isr = PDI_Isr;
    2. Blocking Task Mode (Optional)
    When ENABLE_PDI_TASK IS defined:

    Creates a dedicated RTOS task called PDItask
    The task blocks on a PRU-ICSS event using PRUICSS_waitEvent()
    When the event occurs, it calls HW_EcatIsr() to process the interrupt
    This runs in task context rather than interrupt context
    tiescutils.c:296-310 shows the blocking task implementation
    Key Implementation Details
    The PDI_Isr() function (ecatappl.c:618) performs:

    Reading AL Event Register
    Processing SYNC0/SYNC1 events
    Handling process data output/input events
    Cycle time monitoring
    By default (without ENABLE_PDI_TASK), PDI ISR is a true interrupt handler, not a blocking task. However, it can be configured as a blocking RTOS task by defining ENABLE_PDI_TASK at compile time.

  • Thank you very much for your reply. So I undefined ENABLE_PDI_TASK and ENABLE_SYNC_TASK but now I don't see PDI_Isr being called. Do I have to setup the interrupt or perhaps enable the interrupts or it is done by the example?

  • Hi ,


    Yes you will need to enable interrupts.


    You can refer sdk for example (GPIO_INPUT_INTERRUPT) for setting up the interrupt. 

    {sdk Location}\examples\drivers\gpio\gpio_input_interrupt


    Regards

    Kunal

  • o setup the interrupt or perhaps enable the interrupts or it is done by the example?

    You will need to setup interrupt, refer to any existing example in sdk for interrupt setup