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.

LAUNCHXL2-570LC43: How to use SWI(Software Interrupt)?

Part Number: LAUNCHXL2-570LC43

Hi team,

Here's an issue from the customer may need your help:

It is clear how soft interrupts are triggered, but the customer don't know how to register the soft interrupt exception handling function.

Could you help check this case? Thanks.

Best Regards,

Cherry

  • Hi Cherry,

    Please take a look at section 5.1 of SPNA218. and let me know if that helps or not.

  • Hi QJ,

    Thanks for your help.

    The customer has checked the file you given and currently they want to actively trigger a software interrupt.

    They tried to trigger a software interrupt by writing 75h to SSKEY1 in the SSIR1 register (defined on page 188 of spnu563a), but the program jumped to dataEntry instead of _Svc. 

    If they want to actively trigger a software interrupt at some point, can it be done so by writing the correct key to the SSIR1 register? And why is dataEnrty triggered? 

    Thanks and regards,

    Cherry

  • Hi,

    May I know is there any updates?

    Thanks and regards,

    Cherry

  • Hi Cherry,

    The system module of the Hercules devices supports the generation of four software interrupts (IRQ or FIQ) using the SSIR1, SSIR2, SSIR3, SSIR4 registers. In addition the ARM core has a built in software interrupt which will generate a CPU abort (SWI/SVC).  

    All four SSI interrupts are combined into a single request line to the VIM. You can activate all 4 SSI at the same time. The SSIVEC register will show the highest pending SSI interrupt. Similar to the vector register in other peripherals, the corresponding flag will be cleared when the vector register is read in SSI ISR.

    The SSI will generate IRQ or FIQ interrupt rather than SVC.

  • Please see my example below. After the SSIR is programmed (key 0x75 is written), the system hardware generates an IRQ interrupt to the CPU. The CPU stops executing code in main() and jumps to the interrupt service routine identified by the name you put in the VIMRAM (ssiInterrupt() in my example). At the end of the interrupt routine, the CPU returns to where it left off and resumes executing the original code.

    No data abort is generated.

     

    #pragma CODE_STATE(ssiInterrupt, 32)

    #pragma INTERRUPT(ssiInterrupt, IRQ)

    void ssiInterrupt(void)

    {

        uint32 vec = systemREG1->SSIVEC;

        if ((vec & 0xFF) == 0x1){

            asm("  nop");

            printf("SSI Interrupt 1 \n\r");

        }

    }

    /* USER CODE END */

     int main(void)

    {

         _enable_IRQ();

         systemREG1->SSIR1 = 0x7500 | (0xff & 0x2);

    }