Due to the U.S. Thanksgiving holiday, please expect delayed responses during the week of 11/22.

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.

[FAQ] Can I update the vector table with IntRegister when using TI-RTOS?

I'm moving an application over from a non-RTOS platform to TI-RTOS. My application is crashing or getting "E_unpluggedInterrupt: Unplugged interrupt flagged: intr# 19". I have the following code that plugs the vector table in the TI-RTOS application. Is this wrong?

	I2CIntRegister(I2C0_BASE, i2cCB);

This is for a CortexM device.

  • Short answer: Yes, that is wrong. The TI-RTOS Hwi module should be used to plug an interrupt instead of using IntRegister.

    Long answer...

    The TI-RTOS kernel (SYS/BIOS) manages a vector table. As part of the startup, it copies the vector table into RAM (so it can be modified) and sets Hwi_nvic.VTOR (0xE000ED08 Vector Table Offset Register) to this RAM location.

    Note the placement of the RAM vector table is determined by the below setting (the default for your device is 0x20000000). This is the ti_sysbios_family_arm_m3_Hwi_ramVectors symbol you see in the mapfile.

    So life is good and then along comes IntRegister (which I2CIntRegisters calls) and it does the following check (green comments added).

        //NVIC_VTABLE = 0xE000ED08 which value is now 0x20000000
        // g_pfnRAMVectors is determined by placement of .vtable_ram. Note: in a TI-RTOS based
        // application we don’t have this section
        if(HWREG(NVIC_VTABLE) != (uint32_t)g_pfnRAMVectors)
            // Copy the vector table from the beginning of FLASH to the RAM vector
            // table.
            ui32Value = HWREG(NVIC_VTABLE);
            for(ui32Idx = 0; ui32Idx < NUM_INTERRUPTS; ui32Idx++)
                g_pfnRAMVectors[ui32Idx] = (void (*)(void))HWREG((ui32Idx * 4) +

            // Point NVIC at the RAM vector table.
            HWREG(NVIC_VTABLE) = (uint32_t)g_pfnRAMVectors;

    Note: the exact driverlib function for your device may vary slightly.

    So the first time IntRegister is called, it copies the vector table from flash, changes the vector table offset register and then plugs in the new interrupt. This totally messed up the SYS/BIOS Hwi module since you essentially stole the vector table from it , added a vector whose signature and requirements (e.g. which registers to save) don’t match the Hwi module and, most importantly, wiped out any of the vectors the Hwi plugged during runtime.