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.

RTI interrupt

Other Parts Discussed in Thread: HALCOGEN, TMS570LS3137, TMS570LS1227

Create a project according the HALCoGen example. IAR and TMS570 development kit are used. The program can be download and run. But it seems that there is no RTI interruption occurs. Is there anything missing?

8032.RTI.zip

  • Jeffrey,

    Thanks for including your files. 
    I think the problem might be that you've got the RTI configured for FIQ not IRQ like the example says:

    This is what I see when I open the project in HalCoGen.  You might try changing this and seeing if it works for you.  It makes sense to me that FIQ setting here wouldn't work when everything else in the code expects it to be IRQ.

    FIQ may also not even be enabled when you run (I'd need to check this ... FIQ is non maskable, but it begins disabled and it's non-maskable only after you enable FIQ for the first time...)

     

  • Hi,

    You are right. It works if I change it to IRQ. But I checked the definition of _enable_interrupt_

    ;------------------------------------------------------------------------------- ; Enable interrupts - R4 IRQ & FIQ

           public _enable_interrupt_       

    _enable_interrupt_

            cpsie if         bx    lr                

            ;-------------------------------------------------------------------------------

    So from my opinion, FIQ is enabled in the code. Is it right?

     

  • Jeffery,

    Sorry I was just brainstorming reasons why you wouldn't expect that enabling the RTI but routing it to the wrong level (FIQ instead of IRQ) would not result in the code working.    The interrupt enable is just one reason why it might not work but if the code is doing a CPSIE IF then yes this would enable the FIQ and the IRQ interrupts.

    Anyway glad this change resolved the issue.

  • As you know, FIQ is enabled in the first attached zip file. But it does not work. Why?

  • This is strange.  I just loaded the executable that you sent me and it actually does work.
    But I ran it on a TMS570LS3137 HDK.  Which part are you trying to run it on?

  • I ran it on a TMS570LS1227 development kit.

  • Jeffery,

    Ok so it actually works with the FIQ because the FIQ is enabled AND you have the FIQ vector reading from the same table in VIM and dispatching rather than going to a specialized FIQ handler.

    But, it doesn't work the first time you load the program with CCS.  I don't know about IAR;  one of my colleagues tested in IAR and he may post some additional findings.

    There appears to be an issue with the linking of the project.  The entry point is not cint00 (there's an _ in there somewhere) which is where the reset vector points to.   The code at this cint00 is from HalCoGen and is used to initialize the part including the VIM.

    But you're not only linking in this code apparently you also have startup code from IAR and this is where the entry point is going to.  So if you load the program from an emulator / debugger and 'run' it will skip the device initializtion code of HalCoGen completely  (except for the code you are explicitly calling in main())  but the VIM initialization is skipped.

    And you can see that the RTI interrupt flag is not enabled in VIM when you take this path.  

    However, if you run from a RESET (starting at address 0x00000000) because the reset vector correctly points to c_int00 you will see the code work. 

    This was confusing so it took a while to figure out.    Try programming your code and then yanking the debugger & resetting your board.   you should see the code work and the LED blinking...   

    All this said, you probably should not use FIQ for interrupts except for the error interrupts that are hard-coded to request an FIQ in the VIM.  (Ch 0 and 1).

  • Jeffery,

    You have to change in your IAR project the Linker/Library/Option as following:

    By default, IAR is using the following symbol as entry point: __iar_program_start. Using this symbol, you are skipping all device specific initialization.
    The interesting point, if you flash the program in the device the way it was linked (using __iar_program_start as entry point), the code runs fine and the LED is blinking.
    Now when you debug your code, the debugger for the Program Counter to be set to the entry point (__iar_program_start) and then it is not working correctly.

    So to summarize, change the entry point from default to _c_int00 and re-link your application.

    Please let me know the result.