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.

HWI usage in NDK

Other Parts Discussed in Thread: SYSBIOS

I am just trying to porting the NDK  2.22.3.20 by using the sample code in am335x_sysbios_ind_sdk_1.1.0.3.

The hardware initial code porting is smoothly, but when the sys bios is starting the console giveout this information and stopped.

ti.sysbios.family.arm.a8.intcps.Hwi: line 149: E_alreadyDefined: Hwi already defined, intnum: 41
ti.sysbios.family.arm.a8.intcps.Hwi: line 224: E_handleNotFound: Hwi handle not found: 0x80087c30
xdc.runtime.Error.raise: terminating execution

By the way,I dont use the HWI:41 in other code.

Can someone give some suggestion? Thanks a lot!

  • Hi,

    If you are using the CPSW based implementation, HWI 41 is the Rx interrupt. Are you sure you are not re-initializing this in the application? The driver already takes care of the HWI initializations.

    Regards,
    Vinesh

  • Thank you . 

    After I checked,THe only place that initial the HWI for No.41 that I can find is in file :cpse_ethdriver.c and inside the function CpswHwPktOpen() -> Interrupt_init().

    Am I right?

  • Hi,

    Yes, Interrupt_init() initializes the interrupts required for CPSW.

    Regards,
    Vinesh

  • Problem Solved.

    After I trace the problem some time and found out there maybe a bug inside the Interrupt_init() function.The original function use one single structure " cpsw_hwi_intSetup" to transfer initial data into Interrupt_add()

    original code:

    mmZeroInit(&cpsw_hwi_intSetup, sizeof(IntSetup));

    cpsw_hwi_intSetup.intVectId = CPSW_RX_PULSE_INTNUM;
    cpsw_hwi_intSetup.sysEvtCount = 1;
    cpsw_hwi_intSetup.sysEvtId[0] = 0;

    cpsw_hwi_intSetup.pCallbackFxn = &Cpsw_HwIntRx;
    cpsw_hwi_intSetup.pCallbackArg = 0;
    cpsw_hwi_intSetup.bEnable = 0;

    retVal = Interrupt_add(&cpsw_hwi_intSetup);
    if(retVal != 0)
    // info_printf("Error setting up Rx Interrupts \n");

    cpsw_hwi_intSetup.intVectId = CPSW_TX_PULSE_INTNUM;
    cpsw_hwi_intSetup.sysEvtCount = 1;
    cpsw_hwi_intSetup.sysEvtId[0] = 0;

    cpsw_hwi_intSetup.pCallbackFxn = &Cpsw_HwIntTx;
    cpsw_hwi_intSetup.pCallbackArg = 0;
    cpsw_hwi_intSetup.bEnable = 0;

    retVal = Interrupt_add(&cpsw_hwi_intSetup);
    if(retVal != 0)
    // info_printf("Error setting up Tx Interrupts \n");

    This code always cause fault when call the Interrupt_add the second time to add the TX HWI.

    So to avoid the data transfer error, I re-initial the structure cpsw_hwi_intSetup after the first time RX HWI init.Change the code to :

    mmZeroInit(&cpsw_hwi_intSetup, sizeof(IntSetup));

    cpsw_hwi_intSetup.intVectId = CPSW_RX_PULSE_INTNUM;
    cpsw_hwi_intSetup.sysEvtCount = 1;
    cpsw_hwi_intSetup.sysEvtId[0] = 0;

    cpsw_hwi_intSetup.pCallbackFxn = &Cpsw_HwIntRx;
    cpsw_hwi_intSetup.pCallbackArg = 0;
    cpsw_hwi_intSetup.bEnable = 0;

    retVal = Interrupt_add(&cpsw_hwi_intSetup);
    if(retVal != 0)
    // info_printf("Error setting up Rx Interrupts \n");

    mmZeroInit(&cpsw_hwi_intSetup, sizeof(IntSetup));

    cpsw_hwi_intSetup.intVectId = CPSW_TX_PULSE_INTNUM;
    cpsw_hwi_intSetup.sysEvtCount = 1;
    cpsw_hwi_intSetup.sysEvtId[0] = 0;

    cpsw_hwi_intSetup.pCallbackFxn = &Cpsw_HwIntTx;
    cpsw_hwi_intSetup.pCallbackArg = 0;
    cpsw_hwi_intSetup.bEnable = 0;

    retVal = Interrupt_add(&cpsw_hwi_intSetup);
    if(retVal != 0)
    // info_printf("Error setting up Tx Interrupts \n");

    Now it can finish its initialization.

  • Hi,

    We have not come across this issue using the CPSW driver. However, it's a good practice to clear the structure before reusing for TX. 

    Thanks for the inputs.

    Regards,
    Vinesh