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.

Set-up two ISR in one project

Other Parts Discussed in Thread: MOTORWARE, CONTROLSUITE

Hi,

I am using;

tms320f28027f, c2000 launchpad with a maxon bldc motor and drv8301 motor drive.

I would like to set-up an additional interrupt in the motorware project11a

This main interrupt and the new interrupt is to be determined by conditions already set in the main background loop.

i.e. if certain conditions are satisfied, then the main interrupt should be triggered, if not, then the new interrupt should be triggered

I have gone through the workshop document, however, I am not sure how to make the interrupts dependent on my conditions

can I have a link to any other additional resources concerning this?

Thank you

  • Morikeh,

    Which interrupts you plan to use? you can use USER1-USER12 in your SW and trigger the needed USERx interrupt using TRAP instruction. Please refer to TRAP in the CPU and the intruction set reference guide (http://www.ti.com/lit/ug/spru430f/spru430f.pdf

  • [for some reason, entire answer doesn;t show up in above post]

    Morikeh,

    Which interrupts you plan to use? you can use USER1-USER12 in your SW and trigger the needed USERx interrupt using TRAP instruction. Please refer to TRAP in the CPU and the instruction set reference guide (www.ti.com/.../spru430f.pdf) Software can trigger any enabled PIE interrupt using the Flag register as well but you might want to have a differentiation between a true peripheral interrupt trigger and SW trigger if you plan to use a PIE interrupt other than USER1-12 interrupts.



    Hope this helps.





    Best Regards

    Santosh Athuru
  • I am not completely sure which interrupt I need now that you ask, I am not sure of the difference between them?

    The purpose oof the second interrupt is to have an additional motor control implementation ISR.
    the two ISR's implement the foc in a different manner and are triggered by the conditions in the main background loop.
  • Hi;

    I have gone through the document, but it doesn't tell me where exactly in the project I can configure these interrupts.

    In which file should I be setting up the interrupt?

    Cheers
  • Morikeh,
    that is up to your design. Usually we install the ISR handlers in the main(), before we enable PIE.

    Maybe I'm understanding your question wrong. Which interrupt are you talking about below? You want to use the same interrupt line but have a different handler depending on how system got initialized?
    for ex: PIE INT 1.1 has main_ISR() as registered handler, but depending on some conditions you want new_isr() to be called when PIE INT1.1 is triggered?


    [ Quote - Morikeh
    This main interrupt and the new interrupt is to be determined by conditions already set in the main background loop.
    i.e. if certain conditions are satisfied, then the main interrupt should be triggered, if not, then the new interrupt should be triggered
    ]

    Best Regards
    Santosh Athuru
  • Indeed, you have understood me correctly!
    however, I am not so sure how to implement this in the project structure

    "that is up to your design. Usually we install the ISR handlers in the main(), before we enable PIE."

    what do you mean by this.?

    thanks
  • Morikeh,

    usually in your main() you will install an interrupt handler, the code would look like below for XINT1 interrupt.

    PieVectTable.XINT1_INT = & ISR_HANDLER;


    Now for your interrupt (lets say INT$)

    if(no conditions satisfied)
    {
    PieVectTable.INT$ = &Main_interrupt
    }
    else
    {
    PieVectTable.INT$ = &NEW_interrupt
    }

    Would above work?



    Best Regards
    Santosh Athuru
  • yes this would work!

    But can you briefly explain to me the process of modifying the source code in this manner (according to goal I want to achieve)?
    I am not sure which files to modify!

    I am also trying another method, which uses one ISR (mainISR) using if statements to run the appropriate ISR.
    I have modified the linker command file to such that THE PROJECT BUILDS WITHOUT ERRORS

    however I am unable to debug the program, I have posted this problem in another post

    Thank you
  • Morikeh,

    I'm not sure what you are asking. That is a simple if and else based on conditions you talked about at the beginning of the thread.

    Please refer to the device TRM for explanation of PIE and please browse through some controLSuite examples to understand how the device is initialized. I believe there are tutorials and training materials available for F2802x on the TI product page.

    As per which files to modify - please browse through your project sources and see where the device and PIE are initialized. It can be in the same file I believe.

    Best regards
    Santosh Athuru
  • I think I have created the new interrupt

    I am trying to test it by seeing if I can get my program to run the motorware through the new ISR instead of the default mainISR...

    Unfortunately I am getting 3 errors:
    #10010 encountered during linking
    #10234 Unresolved sybols remain
    unresolved symbol_mainISR

    My question is;

    Why is the program still referring to the main ISR?
    I do believe I have changed all references in the main source file, including the #pragma statement in the includes portion of code.
    I have enabled PIE and ADC interrupts for IntNumber_2 in the hal.c file
    And I have modified the "initialized interrupt vetor table" in hal.h to include a pie pointer to the interrupt vector ADCINT2 at the address of the new ISR.

    My first instinct is that, I need to allocate some memory in the linker command file for this new interrupt, if so, how do I go about doing this,
    If not, what else could be the reason for these errors

    Thank You
  • you can search the project for _mainISR and see where it is being used/referred to. I'm not sure why you are using #Pragma, but if you want to disable certain pieces of code shouldn't you use #ifdef...#else?

    By default all the code will go into .text segment unless you use a #pragma to direct the code/data placement to a named section and in such cases you would need to tell the linker where to put this named section in memory using the linker command file. I doubt that you would need this at this point.

    Hope this helps.

    Best Regards
    Santosh Athuru