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.

RTOS/AM3354: Timer HWI question

Part Number: AM3354

Tool/software: TI-RTOS

Hi sir,

I confused the priority of Task/HWI.  I have do some test in my project, The results are shown below:

demo1:

TimerHwiFunc(){

printf("timer Hwi\n");

}

TaskFunc1(){

while();

}

demo2:

TimerHwiFunc(){

printf("timer Hwi\n");

}

TaskFunc1(){

while(){

Task_Sleep(1);

}

}

"Demo1"  is not able to access HWI.  but "Demo2" can enter HWI.  

Why can't the SP go into HWI after the task death loop?

 

 

  • The RTOS team have been notified. They will respond here.
  • Can you open Tools->ROV and see what the state of the system is? For example, is the Timer created properly.

    Todd
  • The timer state:

    -------------------------------------------------------------------------------------------------------------------------------------------

    app.cfg:

    var Defaults = xdc.useModule('xdc.runtime.Defaults');
    var Diags = xdc.useModule('xdc.runtime.Diags');
    var Error = xdc.useModule('xdc.runtime.Error');
    var Log = xdc.useModule('xdc.runtime.Log');
    var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
    var Main = xdc.useModule('xdc.runtime.Main');
    var Memory = xdc.useModule('xdc.runtime.Memory')
    var SysMin = xdc.useModule('xdc.runtime.SysMin');
    var System = xdc.useModule('xdc.runtime.System');
    var Text = xdc.useModule('xdc.runtime.Text');
     
    var BIOS = xdc.useModule('ti.sysbios.BIOS');
    var Clock = xdc.useModule('ti.sysbios.knl.Clock');
    var Swi = xdc.useModule('ti.sysbios.knl.Swi');
    var Task = xdc.useModule('ti.sysbios.knl.Task');
    var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
    Program.global.sem = Semaphore.create(0);
    //var Hwi = xdc.useModule('ti.sysbios.family.arm.a8.intcps.Hwi');
    var Hwi = xdc.useModule('ti.sysbios.hal.Hwi');
    //var Timer = xdc.useModule('ti.sysbios.hal.Timer');
    
    var Queue = xdc.useModule('ti.sysbios.knl.Queue');
    Program.global.msgQueue = Queue.create();
    Program.global.freeQueue = Queue.create();
    
    var DmtTimer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
    DmtTimer.intFreqs[1].lo = 24000000; // DMTimer 3 Timer.intFreqs[1].hi = 0;
    DmtTimer.intFreqs[1].hi = 0;        // DMTimer 3 Timer.intFreqs[1].hi = 0;
    
    //BIOS.clockEnabled = false;
    Clock.tickSource = Clock.TickSource_USER;
    
    var Timer = xdc.useModule('ti.sysbios.hal.Timer');
    var timerParams = new Timer.Params();
    timerParams.startMode = xdc.module("ti.sysbios.interfaces.ITimer").StartMode_USER;
    timerParams.runMode = Timer.RunMode_CONTINUOUS;
    timerParams.period = 1000000;
    Program.global.myTimer = Timer.create(-1, "&myTimerFunc", timerParams);
    
    var swiParams = new Swi.Params();
    swiParams.arg0 = 1;
    swiParams.arg1 = 0;
    swiParams.priority = 2;
    swiParams.trigger = 0;
    Program.global.swi0 = Swi.create('&swi0Fxn', swiParams);
    
    var hwi0Params = new Hwi.Params();
    hwi0Params.instance.name = "adcHwi";
    Program.global.adcHwi = Hwi.create(16, "&Hwi_adc", hwi0Params);
    //var gic_Hwi = xdc.useModule('ti.sysbios.family.arm.gic.Hwi'); 
    //var ti_sysbios_family_arm_a8_intcps_Hwi = xdc.useModule('ti.sysbios.family.arm.a8.intcps.Hwi');
    
    var Cache = xdc.useModule('ti.sysbios.family.arm.a8.Cache')
    
    var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
    //var Timestamp = xdc.useModule('xdc.runtime.Timestamp');  //Enable if Timestamp_get32 is used in application
    //var GateAll = xdc.useModule('ti.sysbios.gates.GateAll');
    var Mmu = xdc.useModule('ti.sysbios.family.arm.a8.Mmu');
    //var Mmu = xdc.useModule('ti.sysbios.family.a9.Mmu'); 
    //var Mmu = xdc.useModule('ti.sysbios.family.arm.arm9.Mmu');
    
    var SemihostSupport = xdc.useModule('ti.sysbios.rts.gnu.SemiHostSupport');
    /* 
     * Program.argSize sets the size of the .args section. 
     * The examples don't use command line args so argSize is set to 0.
     */
    Program.argSize = 0x0;
    
    var socType           = "am335x";
    var Csl = xdc.useModule('ti.csl.Settings');
    Csl.deviceType = socType;
    
    /* Load the OSAL package */
    var osType           = "tirtos";
    //var osType           = "nonos";
    var Osal             = xdc.loadPackage('ti.osal');
    Osal.Settings.osType = osType;
    Osal.Settings.socType= socType;
    Osal.Settings.libProfile = "debug";
    
    /* Load the uart package */
    var Uart              = xdc.loadPackage('ti.drv.uart');
    Uart.Settings.socType = socType;
    Uart.Settings.libProfile = "debug";
    
    /* Load the spi package */
    var socType          = "am335x";
    var I2C             = xdc.loadPackage('ti.drv.i2c');
    I2C.Settings.socType = socType;
    I2C.Settings.libProfile = "debug";
    /* Load the board package */
    var Board = xdc.loadPackage('ti.board');
    
    Board.Settings.boardName = "HSSAM335x";
    Board.Settings.libProfile = "debug";
    
    var Usb = xdc.loadPackage('ti.drv.usb');     
    //Usb.Settings.libProfile = "debug";
    
    var usbSettings = xdc.useModule('ti.drv.usb.Settings');
    usbSettings.socType = "am335x"; 
    
    /* fat file system */
    var Fatfs = xdc.loadPackage('ti.fs.fatfs');
    Fatfs.Settings.libProfile = "debug";
    /*
     * Uncomment this line to globally disable Asserts.
     * All modules inherit the default from the 'Defaults' module.  You
     * can override these defaults on a per-module basis using Module.common$. 
     * Disabling Asserts will save code space and improve runtime performance.
    Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF;
     */
    Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF;
    
    
    /*
     * Uncomment this line to keep module names from being loaded on the target.
     * The module name strings are placed in the .const section. Setting this
     * parameter to false will save space in the .const section.  Error and
     * Assert messages will contain an "unknown module" prefix instead
     * of the actual module name.
    Defaults.common$.namedModule = false;
     */
    Defaults.common$.namedModule = false;
    
    /*
     * Minimize exit handler array in System.  The System module includes
     * an array of functions that are registered with System_atexit() to be
     * called by System_exit().
     */
    System.maxAtexitHandlers = 4;
    
    /* 
     * Uncomment this line to disable the Error print function.  
     * We lose error information when this is disabled since the errors are
     * not printed.  Disabling the raiseHook will save some code space if
     * your app is not using System_printf() since the Error_print() function
     * calls System_printf().
    Error.raiseHook = null;
     */
    //Error.raiseHook = null;
    /* 
     * Uncomment this line to keep Error, Assert, and Log strings from being
     * loaded on the target.  These strings are placed in the .const section.
     * Setting this parameter to false will save space in the .const section.
     * Error, Assert and Log message will print raw ids and args instead of
     * a formatted message.
    Text.isLoaded = false;
     */
    Text.isLoaded = false;
    /*
     * Uncomment this line to disable the output of characters by SysMin
     * when the program exits.  SysMin writes characters to a circular buffer.
     * This buffer can be viewed using the SysMin Output view in ROV.
     */
    SysMin.flushAtExit = false;
    
    
    /*
     * The BIOS module will create the default heap for the system.
     * Specify the size of this default heap.
     */
    BIOS.heapSize = 32000;
    
    /* System stack size (used by ISRs and Swis) */
    Program.stack = 0x4000;
    
    
    /* 
     * Create and install logger for the whole system
     */
    //var loggerBufParams = new LoggerBuf.Params();
    //loggerBufParams.numEntries = 16;
    //var logger0 = LoggerBuf.create(loggerBufParams);
    //Defaults.common$.logger = logger0;
    //Main.common$.diags_INFO = Diags.ALWAYS_ON;
    
    
    Swi.common$.namedInstance = true;
    BIOS.libType = BIOS.LibType_Custom;
    BIOS.assertsEnabled = false;
    //Program.sectionsExclude = ".*";	// uncommended this line would disable ROV
    
    
    /*var Agent = xdc.useModule('ti.sysbios.rta.Agent');
    Agent.sysbiosHwiLogging = true;
    Agent.sysbiosSwiLogging = false;
    Agent.sysbiosTaskLoggingRuntimeControl = false;
    Agent.sysbiosLoggerSize = 35000;
    Agent.loadLogging = false;
    Agent.loadLoggingRuntimeControl = false;
    Agent.mainLogging = false;
    Agent.mainLoggingRuntimeControl = false;
    BIOS.logsEnabled = true;*/
    
    Clock.tickPeriod = 1000;
    Hwi.dispatcherSwiSupport = true;
    Hwi.dispatcherTaskSupport = true;
    Hwi.dispatcherAutoNestingSupport = true;
    //Hwi.initStackFlag = false;
    //Hwi.checkStackFlag = false;
    BIOS.logsEnabled = false;
    //BIOS.runtimeCreatesEnabled = false;
    BIOS.swiEnabled = true;
    Task.enableIdleTask = false;
    Task.initStackFlag = false;
    Task.checkStackFlag = false;
    //BIOS.cpuFreq.lo = 600000000;
    //Cache.configureL2Sram = false;//DDR build
    //Cache.enableCache = false;    // Need cache on for AM335 USB project to work
    
    
    Mmu.enableMMU = true;
    
    // Force peripheral section to be NON cacheable strongly-ordered memory
    var peripheralAttrs = {
        type : Mmu.FirstLevelDesc_SECTION, // SECTION descriptor
        tex: 0,
        bufferable : false,                // bufferable
        cacheable  : false,                // cacheable
        shareable  : false,                // shareable
        noexecute  : true,                 // not executable
    };
    
    // Define the base address of the 1 Meg page
    // the peripheral resides in.
    var peripheralBaseAddr = 0x44e00400;
    
    // Configure the corresponding MMU page descriptor accordingly
    Mmu.setFirstLevelDescMeta(peripheralBaseAddr,
                              peripheralBaseAddr,
                              peripheralAttrs);
    
                              
    // Define the base address of the 1 Meg page
    // the peripheral resides in.
    //var peripheralBaseAddr = 0x481a6000;	// UART3 and other
    
    // Configure the corresponding MMU page descriptor accordingly
    //Mmu.setFirstLevelDescMeta(peripheralBaseAddr,
    //                          peripheralBaseAddr,
     //                         peripheralAttrs);  
                              
    var peripheralBaseAddr = 0x44E09000;	// UART0 and other
    // Configure the corresponding MMU page descriptor accordingly
    Mmu.setFirstLevelDescMeta(peripheralBaseAddr,
                              peripheralBaseAddr,
                              peripheralAttrs);   
                                
    var peripheralBaseAddr = 0x48022000;	// UART1 and other
    // Configure the corresponding MMU page descriptor accordingly
    Mmu.setFirstLevelDescMeta(peripheralBaseAddr,
                              peripheralBaseAddr,
                              peripheralAttrs);    
    var peripheralBaseAddr = 0x48024000;	// UART2 and other
    // Configure the corresponding MMU page descriptor accordingly
    Mmu.setFirstLevelDescMeta(peripheralBaseAddr,
                              peripheralBaseAddr,
                              peripheralAttrs);                                                                     
    var peripheralBaseAddr = 0x481A8000;	// UART4 and other
    // Configure the corresponding MMU page descriptor accordingly
    Mmu.setFirstLevelDescMeta(peripheralBaseAddr,
                              peripheralBaseAddr,
                              peripheralAttrs);  
    
    var peripheralBaseAddr = 0x47400000;	// USBSS
    
    // Configure the corresponding MMU page descriptor accordingly
    Mmu.setFirstLevelDescMeta(peripheralBaseAddr,
                              peripheralBaseAddr,
                              peripheralAttrs);                          
    
    var peripheralBaseAddr = 0x48040000;	// DMTimer2-7
    
    // Configure the corresponding MMU page descriptor accordingly
    Mmu.setFirstLevelDescMeta(peripheralBaseAddr,
                              peripheralBaseAddr,
                              peripheralAttrs);                
    
    
    // Configure the MMU page at APP_UNCACHED_DATA_BLK3_MEM
    var peripheralBaseAddr = 0xA0000000;    // APP_UNCACHED_DATA_BLK3_MEM
    Mmu.setFirstLevelDescMeta(peripheralBaseAddr,
                              peripheralBaseAddr,
                              peripheralAttrs);
    
    
    Program.sectMap[".bss:extMemCache:ramdisk"]                 = new Program.SectionSpec();
    Program.sectMap[".bss:extMemCache:ramdisk"].loadSegment     = "APP_CACHED_DATA_BLK2_MEM";
    Program.sectMap[".bss:extMemCache:ramdisk"].type            = "NOLOAD";
    
    
    
    

    --------------------------------------------------------------------------------------------------------------------------------------------------

    Please help to check, and tell me if any Suggestions.  thanks very much!



  • Sorry for the delay. Did this get resolved?
  • yes, It's already solved.  because the HWI was disabled accidentally by other module

  • Thanks for the update.