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.

InstaSPIN Init Vector Table

Other Parts Discussed in Thread: TMS320F28069M, SYSBIOS

Dear TI team and TI users,

I'm trying to control a motor with instaSPIN-FOC and at the same time, handle the system with TI-RTOS.

The microcontroller I use is the TMS320F28069M. I took the lab3b from InstaSPIN, and inplementet this in a RTOS-typical project.

I find out that RTOS and instaSPIN do different things when they init their vector table, please correct me if not.

Witch init schould I go for "See CODE example at bottom"? RTOS or instaSPIN?

Are there any solutions for this issue?

I will be very grateful for your help.

Greetings Daniel


Code Example:
RTOS:
// Init PLL, watchdog, periph clocks - see F2806x_SysCtrl.c file
// Clock frequency set to 90 MHz - see F2806x_Examples.h
InitSysCtrl();

INSTA:
// initialize the interrupt vector table
HAL_initIntVectorTable(halHandle);

  • Hi Daniel,

    Do you want TI-RTOS to manage your interrupts for you or do you want it to exist outside of TI-RTOS? Either way, you probably don't want to call HAL_initIntVectorTable() as it is.

    If you DO want the RTOS to manage your interrupts for you, you'll want to set up a Hwi for ADCINT1 and tell it that mainISR is your handler.

    If you DO NOT want the RTOS to manage your interrupts for you (this is sometimes important for really time-critical code), there are ways to get around its dispatcher. The TI-RTOS Hwi_plug() API will directly plug your ISR into the vector table.

    Here's a pretty nice wiki page with info about using TI-RTOS with C2000.

    processors.wiki.ti.com/.../BIOS_for_the_28x

    Thanks,
    Whitney
  • Hi Whitney
    Thanks a lot for your answer.

    I'm really not sure which way I schould manage the interrupts.
    Perhaps I will try to not let the RTOS mange the interrupts, I assume the InstaSPIN application is a time-critical application. Is that correct? What would you recommend?

    Will this code intregrate the mainISR in the vector table? Did i forgot something?
    CODE:
    Hwi_plug(32, (Hwi_PlugFuncPtr)mainISR);
    Hwi_enableInterrupt(32);

    Are there modifications that i should do in the InstaSPIN initialisation?

    Thanks,
    Daniel
  • Daniel,

    I have not used TI-RTOS and InstaSPIN in the same application myself, but I suspect you are correct in thinking you'll want to use Hwi_plug() and keep the mainISR outside of RTOS control. Your code looks good.

    I can't think of any other modifications that need to be made to InstaSPIN code. Just be aware of what hardware resources some RTOS modules will consume that may conflict with InstaSPIN code. For example, TI-RTOS will use a couple of your timers--one for the Clock module and one for the Timestamp module, so if you enable those, make sure you are assigning them timers that are not being used by InstaSPIN code. Similarly, if you use the TI-RTOS Boot module to configure your PLL, you'd want to remove any PLL initialization code from InstaSPIN.

    - Whitney

  • Whitney,

    now I'm a few step forward. But still not reach my goal.

    I pluged the mainISR like mention before:
    Hwi_plug(104, (Hwi_PlugFuncPtr)mainISR);
    Hwi_enableInterrupt(104);

    I commented these functions:

    IN -> HAL_setParams(halHandle,&gUserParams);

    // HAL_setupPll(handle,PLL_ClkFreq_90_MHz);
    // HAL_setupPie(handle);

    // HAL_initIntVectorTable(halHandle);


    And still have this error:

    ti.sysbios.family.c28.Hwi: line 1013: E_unpluggedInterrupt: Unplugged interrupt flagged: intr# 19
    xdc.runtime.Error.raise: terminating execution

    What could it be?

  • Have you enabled the TI-RTOS Boot module to set up the PLL for you? If not, you can leave in the HAL_setupPll() code.

    The interrupt #19 that the error is referring to is the illegal instruction interrupt, so you've probably jumped to some invalid address. Since you haven't provided an ISR to handle the illegal instruction interrupt, you're getting a message saying "Unplugged interrupt." So you need to figure out why you're executing some invalid code. If you step through your code, when does the error occur?

    Make sure the interrupt is disabled until after you've called Hwi_plug(). If the interrupt is occurring before you've told it where the ISR is, that could be the problem.

    Whitney
  • Yes I have. But now I changed it, the PLL to be made by InstaSPIN.

    And I initialize the clock 0 for RTOS and the other two for InstaSPIN.

    But the error still occur:
    ADC_setSocFrcWord(obj->adcHandle, 0x00FF)
    called by:
    HAL_AdcOffsetSelfCal(HAL_Handle handle)
    called by:
    HAL_cal(HAL_Handle handle)
    called by:
    HAL_setParams(HAL_Handle handle,const USER_Params *pUserParams)

    Thanks a lot for you help!
  • Okay, it really sounds like it's trying to call the ADC ISR when it really should be disabled at that point. Before HAL_cal() gets called, do you call CPU_disableGlobalInts() and CPU_disableInts() like the original HAL code does?

    Also, where the original code was calling HAL_setupPie(), try calling Hwi_disableInterrupt(104).

    Whitney