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.

PDK settings for EventCombiner versus NIMU

I've just been chasing an odd bug, where I was trying to map Host Interrupt 42 (event 31) via the EventCombiner module.  This worked just fine standalone but seemed to get crossed over with the PA interrupt when I enabled networking, ie. after NIMU startup I only seemed to get an interrupt when a packet arrived.  (eg. ping worked just fine...)

I then found this, which I didn't understand.  Perhaps someone can explain it for me.

C:\ti\pdk_C6678_1_1_0_3\packages\ti\platform\resource_mgr.h

/** @defgroup  Platform_interrupts  Interrupts
 *  Interrupt and event IDs. Only those which are assigned appear here.
 *
 * We are currently combining all interrupts for the switch and they are set by the demo
 * applications in their .cfg files:
 * Ecm.eventGroupHwiNum[0] = 7;
 * Ecm.eventGroupHwiNum[1] = 8;
 * Ecm.eventGroupHwiNum[2] = 9;
 * Ecm.eventGroupHwiNum[3] = 10;
 */
/*@{*/
#define PLATFORM_ETH_EVENTID        48        /**< Ethernet Switch event - Used by NIMU library */
#define PLATFORM_ETH_INTERRUPT        7        /**< Ethernet Switch Interrupt - Used by NIMU library */
/*@}*/  /* defgroup */

The ECM setup in the comment is the same that I have in my .cfg file, copied from the PDK demos.

BUT in the default NIMU driver, we have:

C:\ti\pdk_C6678_1_1_0_3\packages\ti\transport\ndk\nimu\src\nimu_eth.c

    /* Register interrupts for the system event corresponding to the
     * accumulator channel we are using.
     */
    /* System event n - Accumulator Channel 0 */
    eventId         =   PLATFORM_ETH_EVENTID;

    /* Pick a interrupt vector id to use */
    vectId          =   PLATFORM_ETH_INTERRUPT;

    platform_write ("Ethernet eventId : %d and vectId (Interrupt) : %d \n", eventId, vectId);

    /* Register our ISR handle for this event */
    EventCombiner_dispatchPlug (eventId, (EventCombiner_FuncPtr)EmacRxPktISR, (UArg)ptr_net_device, TRUE);
    EventCombiner_enableEvent(eventId);

    /* Map the event id to hardware interrupt 7. */
    Hwi_eventMap(vectId, eventId >> 5);

    /* Enable interrupt */
    Hwi_enableInterrupt(vectId);

This appears to be mapping event *1* to interrupt 7, which would explain why my event 0 via interrupt 7 mapping was being clobbered.

Anyway, I've solved the immediate issue by using event 92 via interrupt 9, which was unused, and that seems to work.  I'd just like to know for curiosity's sake (and in case I need to add more events later) why my first effort didn't work.

Cheers,

Gordon

  • Gordon,

    I'm not sure what specifically the question was here.  What you described is true though.  Is there a specific concern or question about this?

    Best Regards,

    Chad

  • Well...  I did things "by the book" using the documentation available to me, and it didn't work.

    It's true that I now have an alternate working version.  So no, there isn't a support query here.

    It does seem to me one of two things are happening here:

    (a) I've misunderstoon how interrupt handling works, in which case I'd like to be corrected for future reference; or

    (b) There is effectively a bug in the PDK, albeit one which doesn't affect any of the actual PDK examples.  It did seem to me that this was worth a forum post, not least because somebody else might trip over it.  Any time things don't work as adverised, it causes wasted time and frustration.

  • I'm not sure that it true didn't work.  It simply did not work as you expected it to.  Both Events were then being mapped to the same Interrupt.  This is quiet common and the ISR (Interrupt Service Routine) you have would need to be modified to handle the processing depending upon which event triggered the interrupt.

    Best Regards,
    Chad

  • OK, I'm going to mark this as closed since I'll accept that you're technically right.

    I still don't accept that it "worked", since I didn't get "my" interrupt from EVT0 through the "default" BIOS ECM dispatcher.  From what you're saying, I could modify that dispatcher, which sounds like hard work.

    Essentially, the PDK samples have what seems at first like a "magic incantation":

    Ecm.eventGroupHwiNum[0] = 7;
    Ecm.eventGroupHwiNum[1] = 8;
    Ecm.eventGroupHwiNum[2] = 9;
    Ecm.eventGroupHwiNum[3] = 10;

    which sets up some HWIs and dispatchers.  Except if you use the NIMU driver, without telling you, it essentially clobbers the first and redirects the second to a different interrupt.  I still maintain that's a bit unhelpful.  Given the PDK library and without wanting to rebuild the NIMU driver, would it make more sense to rewrite the above config as below?

    Ecm.eventGroupHwiNum[0] = 6;
    Ecm.eventGroupHwiNum[1] = 7;
    Ecm.eventGroupHwiNum[2] = 8;
    Ecm.eventGroupHwiNum[3] = 9;

    Gordon