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.

SECDEVTOOL-OMAPL138C6748: Invalid interrupt number from sysbios.family.c64p.Hwi

Part Number: SECDEVTOOL-OMAPL138C6748
Other Parts Discussed in Thread: SYSBIOS, OMAPL138

When the following line is executed in debug

GPIO_setConfig(0, GPIO_DEVICE_CONFIG(0, 5)|GPIO_CFG_IN_INT_RISING|GPIO_CFG_INPUT);

a console error is reported as;

[C674X_0] ti.sysbios.family.c64p.Hwi: line 189: E_invalidIntNum: Invalid interrupt number: intr# 0

The call back array is initialized as 

//// GPIO Driver call back functions
GPIO_CallbackFxn gpioCallbackFunctions[] =
{
NULL
};

SYS/BIOS is 6.76.3.01

omap138PDK is 1.0.10

NDK is 2.26.0.08

it will not compile with NDK 3.61.1.01

John

  • Hi John,

    Is this on an application that you are building or from GPIO examples from PDK?

    By the way, note that only interrupts 4-through-15 can be used with Hwi dispatcher.

    Can you please check if you are accidentally providing interrupt number 0 for the interrupt registration (Hwi)?

    Thanks

  • Thanks for your reply Aravind,

    I copied the GPIO example from the PDK, but cannot get it to link properly.

    However, I have successfully integrated the GPIO SDK into my app.

    Board_initCfg cfg = Board_init(BOARD_INIT_PINMUX_CONFIG | BOARD_INIT_MODULE_CLOCK | BOARD_INIT_UART_STDIO);  works correctly

    GPIO_init();  works correctly, picking up all the port and GPIO pin definitions.

    GPIO_write(LED0, 0); works correctly at each pin definition.

    statusSW = GPIO_read(SW1); works correctly at each pin definition.

    GPIO_setConfig(0, GPIO_DEVICE_CONFIG(0, 5)|GPIO_CFG_IN_INT_RISING|GPIO_CFG_INPUT); does not work 

    Where is the interrupt number set prior to calling GPIO_setConfig()?

    I don't see anything in the GPIO SDK documentation on how to choose the interrupt number.

    Thanks,

    John

  • Hi John,

    Is the example RTOS (SYS BIOS) based or Bare metal based?

    If RTOS based example, can you share the RTSC cfg file you are using for your application?

    In one of the example, I see GPIO_init() done after the Pin config is done. Can you change the sequence in your application and see if it helps?

    snippet from main_test.c (from spi example)

    /* Set GPIO pin configurations */
    GPIO_setConfig(ESPI_GPIO_PIN_RESET, GPIO_DEVICE_CONFIG(espi_cfg.resetPin.port,
    espi_cfg.resetPin.pinNum) |
    GPIO_CFG_IN_INT_RISING | GPIO_CFG_INPUT);

    /* Initialize GPIO */
    GPIO_init();

    Thanks

  • Aravind,

    the following code

    ******

    GPIO_setConfig(ADC_READY, GPIO_DEVICE_CONFIG(0, ADC_READY_PIN)|GPIO_CFG_IN_INT_RISING|GPIO_CFG_INPUT);

    // init gpio
    GPIO_init();

    ******

    gives the interrupt error below on the GPIO_SetConfig() call

    [C674X_0] ti.sysbios.family.c64p.Hwi: line 189: E_invalidIntNum: Invalid interrupt number: intr# 0

    here is the cfg file

    var BIOS = xdc.useModule('ti.sysbios.BIOS');

    var Task = xdc.useModule('ti.sysbios.knl.Task');

    var HeapBuf = xdc.useModule('ti.sysbios.heaps.HeapBuf');

    var Log = xdc.useModule('xdc.runtime.Log');
    var Hwi = xdc.useModule('ti.sysbios.hal.Hwi');
    var ti_sysbios_family_c64p_Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');

    /*
    ** Allow storing of task names. By default if you name a task with a friendly display name it will not be saved
    ** to conserve RAM. This must be set to true to allow it. We use friendly names on the Task List display.
    */
    Task.common$.namedInstance = true;

    var Clock = xdc.useModule ('ti.sysbios.knl.Clock');

    /* Use this for BIOS 6.30 plus to get the IPC module */
    var Sem = xdc.useModule ('ti.sysbios.knl.Semaphore');

    var Ecm = xdc.useModule ('ti.sysbios.family.c64p.EventCombiner');

    var Diags = xdc.useModule('xdc.runtime.Diags');

    var socType = "omapl138";

    /* Load the CSL package */
    var devType = "omapl138";
    var Csl = xdc.useModule('ti.csl.Settings');
    Csl.deviceType = devType;
    Csl.useCSLIntcLib = true;

    /* Load the OSAL package */
    var osType = "tirtos"
    var Osal = xdc.useModule('ti.osal.Settings');
    Osal.osType = osType;
    Osal.socType = devType;

    /* Load the Board package and set the board name */
    var Board = xdc.loadPackage('ti.board');
    Board.Settings.boardName = "lcdkOMAPL138";

    /* Load the uart package */
    var Uart = xdc.loadPackage('ti.drv.uart');
    Uart.Settings.socType = devType;

    /* Load the i2c package */
    var i2c = xdc.loadPackage('ti.drv.i2c');
    i2c.Settings.socType = devType;

    /* Load EMAC package */
    var EmacLLD = xdc.loadPackage('ti.drv.emac');
    EmacLLD.Settings.socType = devType;
    EmacLLD.Settings.enableProfiling = false;

    /* Load the gpio package */
    var Gpio = xdc.loadPackage('ti.drv.gpio');
    Gpio.Settings.enableProfiling = false;
    Gpio.Settings.socType = devType;

    var Nimu = xdc.loadPackage('ti.transport.ndk.nimu');
    Nimu.Settings.socType = socType;

    /*
    ** Sets up the exception log so you can read it with ROV in CCS
    */
    var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
    var Exc = xdc.useModule('ti.sysbios.family.c64p.Exception');
    Exc.common$.logger = LoggerBuf.create();
    Exc.enablePrint = true; /* prints exception details to the CCS console */

    /*
    ** Use this load to configure NDK 2.2 and above using RTSC. In previous versions of
    ** the NDK RTSC configuration was not supported and you should comment this out.
    */
    var Ndk = xdc.loadPackage('ti.ndk.config');
    var Global = xdc.useModule('ti.ndk.config.Global');

    /*
    ** This allows the heart beat (poll function) to be created but does not generate the stack threads
    **
    ** Look in the cdoc (help files) to see what CfgAddEntry items can be configured. We tell it NOT
    ** to create any stack threads (services) as we configure those ourselves in our Main Task
    ** thread hpdspuaStart.
    */
    Global.enableCodeGeneration = false;

    var Startup = xdc.useModule('xdc.runtime.Startup');

    var System = xdc.useModule('xdc.runtime.System');

    /*
    ** Create a Heap.
    */
    var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
    var heapMemParams = new HeapMem.Params();
    //heapMemParams.size = 0x8000;
    heapMemParams.size = 0x100000;
    heapMemParams.sectionName = "systemHeap";
    Program.global.heap0 = HeapMem.create(heapMemParams);

    /* This is the default memory heap. */
    Memory.defaultHeapInstance = Program.global.heap0;
    Program.sectMap["sharedL2"] = "DDR";
    Program.sectMap["systemHeap"] = "DDR";
    Program.sectMap[".sysmem"] = "DDR";
    Program.sectMap[".args"] = "DDR";
    Program.sectMap[".cio"] = "DDR";
    Program.sectMap[".far"] = "DDR";
    Program.sectMap[".rodata"] = "DDR";
    Program.sectMap[".neardata"] = "DDR";
    Program.sectMap[".cppi"] = "DDR";
    Program.sectMap[".init_array"] = "DDR";
    Program.sectMap[".qmss"] = "DDR";
    Program.sectMap[".cinit"] = "DDR";
    Program.sectMap[".bss"] = "DDR";
    Program.sectMap[".const"] = "DDR";
    Program.sectMap[".text"] = "DDR";
    Program.sectMap[".code"] = "DDR";
    Program.sectMap[".switch"] = "DDR";
    Program.sectMap[".data"] = "DDR";
    Program.sectMap[".fardata"] = "DDR";
    Program.sectMap[".args"] = "DDR";
    Program.sectMap[".cio"] = "DDR";
    Program.sectMap[".vecs"] = "DDR";

    Program.sectMap["emacComm"] = "DDR"


    Program.sectMap[".far:taskStackSection"] = "DDR";
    Program.sectMap[".stack"] = "DDR";
    Program.sectMap[".far:IMAGEDATA"] = {loadSegment: "DDR", loadAlign: 8};
    Program.sectMap[".far:NDK_OBJMEM"] = {loadSegment: "DDR", loadAlign: 8};
    Program.sectMap[".far:NDK_PACKETMEM"] = {loadSegment: "DDR", loadAlign: 128};

    /* Required if using System_printf to output on the console */
    SysStd = xdc.useModule('xdc.runtime.SysStd');
    System.SupportProxy = SysStd;

    /********************************************************************************************************************
    * Define hooks and static tasks that will always be running. *
    ********************************************************************************************************************/

    /*
    ** Create the stack Thread Task for our application.
    */
    //var tskNdkStackTest = Task.create("&StackTest");
    //tskNdkStackTest.stackSize = 0x3000;//0x1400;
    //tskNdkStackTest.priority = 0x5;

    /*
    ** If you are using RTSC configuration with NDK 2.2 and above, this is done by default, else
    ** register hooks so that the stack can track all Task creation
    Task.common$.namedInstance = true;
    Task.addHookSet ({ registerFxn: '&NDK_hookInit', createFxn: '&NDK_hookCreate', });

    /* Enable BIOS Task Scheduler */
    BIOS.taskEnabled = true;

  • Aravind,

    I decided to compile GPIO_test and managed to do this.  There is some code (see below) that I overlooked, in particular the call to GPIO_socSetBankInt().

    I'm not sure why the SPI word in in there - must be a carry over from another test app.

    Note that in the example code there are no mods to the struct gpio_cfg.  Also  GPIO_socSetBankInt(GPIO_LED0_PORT_NUM_A, GPIO_LED0_PIN_NUM, NULL); does no pass any interrupt numbers.

    For the following code console reports that int #4 is already in use.

    const GPIO_v0_HwAttrs gpio_cfg;

    // Get the default SPI init configurations
    GPIO_socGetInitCfg(ADC_READY, &gpio_cfg);
    // Set the default GPIO init configurations
    GPIO_socSetInitCfg(ADC_READY, &gpio_cfg);

    // Setup GPIO interrupt configurations
    GPIO_IntCfg gpio_CFG;
    gpio_CFG.intNum=4;
    gpio_CFG.eventId=65;
    GPIO_socSetBankInt(ADC_READY, ADC_READY_PIN, &gpio_CFG);
    // configure the interrupt on the ADC ready pin
    GPIO_setConfig(ADC_READY, GPIO_DEVICE_CONFIG(0, ADC_READY_PIN)|GPIO_CFG_IN_INT_RISING|GPIO_CFG_INPUT);
    // Set the callback function
    GPIO_setCallback(ADC_READY, ADC_0_IsrDSP_Ready);

    change GPIO_socSetBankInt(ADC_READY, ADC_READY_PIN, &gpio_CFG);

    to GPIO_socSetBankInt(ADC_READY, ADC_READY_PIN, NULL ); as per example and there is no console error but nothing happens.  there is no trigger for the interrupt callback function.

    Do9 you know what GPIO_socSetBankInt(ADC_READY, ADC_READY_PIN, NULL); actually sets?

    Thanks 

    John

    /*
    * ======== Board_initI2C ========
    */
    static void Board_initGPIO(void)
    {
    Board_initCfg boardCfg;

    GPIO_v0_HwAttrs gpio_cfg;

    /* Get the default SPI init configurations */
    GPIO_socGetInitCfg(GPIO_LED0_PORT_NUM, &gpio_cfg);

    /* Modify the default GPIO configurations if necessary */

    /* Set the default GPIO init configurations */
    GPIO_socSetInitCfg(GPIO_LED0_PORT_NUM, &gpio_cfg);

    /* Setup GPIO interrupt configurations */
    GPIO_socSetBankInt(GPIO_LED0_PORT_NUM, GPIO_LED0_PIN_NUM, NULL);

    boardCfg = BOARD_INIT_PINMUX_CONFIG | BOARD_INIT_MODULE_CLOCK | BOARD_INIT_UART_STDIO;

    Board_init(boardCfg);

    }

  • Aravind,

    a call to 

    // Setup GPIO interrupt configurations
    GPIO_socSetBankInt(ADC_READY, ADC_READY_PIN, NULL);

    sets up the interrupt correctly.

    It works correctly now.  Thanks for your help.

    John