+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13

Thread: Fire IRQ, triggered from Source Code...

  1. #1
    XMC-Chriss
    Guest

    Fire IRQ, triggered from Source Code...

    Is there any simple solution, (XMC, DaveApp,...) to generate call of IRQ-Function from Source Code?
    (I guess, I can use HW-Pheripheral... and set IRQ-Request Bits... but may, there is a more simple solution without pheripherals?)

    Backround... I need an additional IRQ/Level-Priority-task, between my SYSTIMER(IRQ)-task and Backround task.

    Best Thanks for help.

  2. #2
    Advanced Advanced chismo is on a distinguished road
    Join Date
    Apr 2013
    Posts
    267
    Points
    2456.25
    Hello,

    You can use directly the CMSIS set IRQn pending function to trigger the interrupt.

    For example to trigger SCU.SR0:
    Code:
    /*  CMSIS function void NVIC_SetPendingIRQ (IRQn_t IRQn)  */
     NVIC_SetPendingIRQ(SCU_0_IRQn);
    Hope this helps.

    Regards,
    Min Wei

  3. #3
    XMC-Chriss
    Guest
    Thanks...

    But,where and how I have to declare the IRQ(callback) function? And set IRQ priorities... ? Over DAVE App?

    Thanks for help...

  4. #4
    Advanced Advanced chismo is on a distinguished road
    Join Date
    Apr 2013
    Posts
    267
    Points
    2456.25
    I think the easiest is to simply add the NVIC node initialization codes and handler function directly to your existing program, without going through DAVE.

    For example:
    Code:
    /* Handler function */
    void SCU_0_IRQHandler(void)
     {
        /* Code */
     }
    
     int main(void)
     {
       DAVE_STATUS_t status;
       ...
        /* Initialize NVIC */
       NVIC_SetPriority(SCU_0_IRQn, 3U);
       NVIC_EnableIRQ(SCU_0_IRQn);
       ...   
       while(1U)
       {
       }
       return 1;
     }
    And as mentioned previously, the CMSIS set IRQn function can be used to trigger the interrupt.
    Or if this is not needed, the handler function can be also called directly in the program.

    Regards,
    Min Wei

  5. #5
    XMC-Chriss
    Guest
    Hi,

    In your solution... How I can Register the callback IRQ-function ???

    ----

    In the meantime...
    I try to use DAVE App INTERRUPT (4.0.8)
    Define, "Enable", Prio. and Interrupt handler in DAVE-APP...

    Use Method "SetEnable + SetPending" by SW...

    With Debugger, I can set a BP inside IRQ-Handle... it's called... OK...
    But after leaving IRQ-Handler, CPU/Debugger jumps to anyway??? And Stops ? Not back...

    What I am doing wrong?

  6. #6
    XMC-Chriss
    Guest
    Click image for larger version

Name:	IRQ_Break1.png
Views:	8
Size:	831.3 KB
ID:	2340

    Here a screenshoot...

  7. #7
    Advanced Advanced chismo is on a distinguished road
    Join Date
    Apr 2013
    Posts
    267
    Points
    2456.25
    Hello,

    Sorry, what do you mean by "register the callback IRQ-function"?

    The non-DAVE App code is doing the same thing as the DAVE app, i.e.:
    - enable and configure priority for interrupt node
    - define interrupt handler or call back function
    - trigger the interrupt

    In either case, the interrupt handler would exit to the point of the code execution before the interrupt occurrence.
    In your project, you are always getting the breakpoint trap as shown in your attached screenshot?

    Regards,
    Min Wei

  8. #8
    XMC-Chriss
    Guest
    "register the callback IRQ-function" means for me, to tell the Compiler the IRQ-function for a specific IRQ.
    But OK, that's made with the DAVe App...

    Yes, Debugger/CPU is always lost after exiting IRQ function...
    A BPoint inside IRQ function is working OK. IRQ fucnction is called...

  9. #9
    XMC-Chriss
    Guest
    How can I go on with Analyzing/Debugging that Problem?

  10. #10
    Advanced Advanced chismo is on a distinguished road
    Join Date
    Apr 2013
    Posts
    267
    Points
    2456.25
    Hello,

    For the non-APP case, the IRQ function "SCU_0_IRQHandler" is defined in the startup file and hence, the compiler will take care that when the IRQ is triggered, the function will be called.

    I am not sure what is causing the breakpoint trap.
    I have created a simple pin-toggling example with the XMC2GO kit where:
    - P1.0 is toggling always in the while loop of main function
    - In the while loop, IRQ0 is being triggered by SW
    - IRQ0 function toggles P1.1

    Can you try with this simple example to see if it works for you?
    XMC1100_Pin_Toggle_with_DAVEAPP.zip

    Regards,
    Min Wei

+ Reply to Thread

Tags for this Thread

Disclaimer

All content and materials on this site are provided “as is“. Infineon makes no warranties or representations with regard to this content and these materials of any kind, whether express or implied, including without limitation, warranties or representations of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. No license, whether express or implied, is granted by Infineon. Use of the information on this site may require a license from a third party, or a license from Infineon.


Infineon accepts no liability for the content and materials on this site being accurate, complete or up- to-date or for the contents of external links. Infineon distances itself expressly from the contents of the linked pages, over the structure of which Infineon has no control.


Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Usage Terms of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Usage Terms of this site. Infineon reserves the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.