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.

RTOS/MSP432P401R: Issue with Hwi interrupt service routine. MSP432P401R TI RTOS version 2.20. E_alreadyDefined: Hwi already defined: intr# 45

Part Number: MSP432P401R

Tool/software: TI-RTOS

Hi,

I am waking up an RTC after certain time period from low power mode. To generate the interrupt, I am using a Hardware interrupt as shown below, which is being called from a Task. 

But the problem is any interrupt number I use, I keep getting error: 

E_alreadyDefined: Hwi already defined: intr#...

 Kindly let me know, what is that I am doing wrong. I searched in the forum and tried different suggestions, but nothing worked. Please help.   

(Code below)

void RTCFun(void)
{
    while(1)
    {
        //Task_sleep(1000);
        Hwi_Handle myHwi;
        Hwi_Params hwiParams;
        Hwi_Params_init(&hwiParams);
        hwiParams.arg = 45;
        /* Setup RTC */
        //RTC_C_initCalendar(&myCalendarTime, RTC_C_FORMAT_BINARY);

        /* Setup Hwi */


             RTCFun_init();

        
        RTC_C_setCalendarAlarm(2,16,3,20); //(minutes, hour, day of week, day of month)

        //creating Interrupt
        MAP_RTC_C_enableInterrupt(RTC_C_CLOCK_ALARM_INTERRUPT);
        MAP_Interrupt_enableInterrupt(INT_RTC_C);
        MAP_Interrupt_enableMaster();
        MAP_RTC_C_startClock();



        myHwi = Hwi_create(INT_RTC_C, RTCIsrFun, &hwiParams, NULL);

        //Send device into LPM3.5
        MAP_PCM_shutdownDevice(PCM_LPM35_VCORE0);

        System_printf("Back in active mode\n");
                //SysMin will only print to the console when you call flush or exit
               System_flush();
    }

}


/* RTC ISR */
void RTCIsrFun(uintptr_t arg)
{
   RTC_C_clearInterruptFlag(RTC_C_getInterruptStatus());
   
      GPIO_write(Board_LED1, Board_LED_ON);

} 

  • Hello,

    Which version of the Launchpad are you using (RED or BLACK)??

    Best regards,

    David
  • HI David,

    It is red.

    Regards
    Suraj
  • Hi David,

    I created a new Hwi interrupt  in sysbios > scheduling from .cfg file. And defined my  ISR function and RTC_c interrupt number (45) over there.  Hwi started working.

    Below is the working code for Hwi added in cfg file. But I didn't get, why the above dynamic Hwi from my application file was not working, whereas both the static and dynamic Hwi are calling the same function?

    /* Use UARTMon with TI and GCC toolchains only */
    if (!Program.build.target.$name.match(/iar/)) {
        var UARTMon = xdc.useModule('ti.tirtos.utils.UARTMon');
        UARTMon.stackSize = 1024;
    }
    var halHwi0Params = new halHwi.Params();
    halHwi0Params.instance.name = "halHwi0";
    halHwi0Params.maskSetting = xdc.module("ti.sysbios.interfaces.IHwi").MaskingOption_SELF;
    Program.global.halHwi0 = halHwi.create(45, "&RTCIsrFun", halHwi0Params);

    - Regards

    Suraj

  • If you have created the Hwi in the .cfg file. you cannot create it again during runtime. You can look in Tools->ROV->Hwi to what interrupts are created.

    Todd
  • Hi Suraj,

    I'm glad that you got it work. Not really sure why the dynamic HWi creation was not working for you I checked your code and that's how I do it with the new SimpleLink MSP432 SDK. Maybe it was already created in the .cfg as Todd mentioned already.

    Anyway I would like to recommend you to start using new SimpleLink MSP432 SDK www.ti.com/.../simplelink-msp432-sdk.

    Best regards,

    David

**Attention** This is a public forum