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/TDA3MA: Task_sleep() stuck at DSP1

Part Number: TDA3MA
Other Parts Discussed in Thread: SYSBIOS

Tool/software: TI-RTOS

Hi all.

I'm trying to run a very simple (sample) program on DSP1 processor of the TDA3xx device.

The code is: 

/*
* ======== main.c ========
*/

#include <xdc/std.h>

#include <xdc/runtime/Error.h>
#include <xdc/runtime/System.h>

#include <ti/sysbios/BIOS.h>

#include <ti/sysbios/knl/Task.h>
#include <ti/sysbios/knl/Clock.h>

/*
* ======== taskFxn ========
*/
Void taskFxn(UArg a0, UArg a1)
{
System_printf("DSP1: enter taskFxn()\n");
System_flush();

Task_sleep(10);

System_printf("DSP1: exit taskFxn()\n");

System_flush(); /* force SysMin output to console */
}

/*
* ======== main ========
*/
Int main()
{
Task_Handle task;
Error_Block eb;

System_printf("DSP1: enter main()\n");
System_flush();

Error_init(&eb);
task = Task_create(taskFxn, NULL, &eb);
if (task == NULL) {
System_printf("DSP1: Task_create() failed!\n");
BIOS_exit(0);
}

BIOS_start(); /* does not return */
return(0);
}

The problem happens when the program enters Task_sleep(10). The program enters this sleep and never leaves it.

I can see all prints till entering the sleep.

Following is the .CFG file:

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 Swi = xdc.useModule('ti.sysbios.knl.Swi');
var Task = xdc.useModule('ti.sysbios.knl.Task');
var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
var Hwi = xdc.useModule('ti.sysbios.hal.Hwi');
var Clock = xdc.useModule('ti.sysbios.knl.Clock');

/*
* 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;
*/

/*
* 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;
*/

/*
* 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;
*/

/*
* 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;
*/

/*
* 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 = 8192;

/*
* Build a custom SYS/BIOS library from sources.
*/
BIOS.libType = BIOS.LibType_Debug;

/* System stack size (used by ISRs and Swis) */
Program.stack = 65536;

/* Circular buffer size for System_printf() */
SysMin.bufSize = 0x200;

/*
* 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;

System.SupportProxy = SysMin;
Task.idleTaskStackSection = ".bss:taskStackSection";
Task.defaultStackSection = ".bss:taskStackSection";
Main.common$.diags_INTERNAL = Diags.ALWAYS_ON;
Defaults.common$.diags_INTERNAL = Diags.ALWAYS_ON;
BIOS.customCCOpts = "-mv6600 --abi=eabi -q -mi10 -mo -pdr -pden -pds=238 -pds=880 -pds1110 --program_level_compile -g";
BIOS.cpuFreq.lo = 500000000;

I'm using the following:

Compiler version: TI v8.2.3

XDCtools version: 3.50.5.12_core

Device endianness: little

Runtime support library: rts6600_elf.lib

Target: ti.targets.elf.C66

Platform: ti.platforms.simVayu

Sincerely

Alex

  • Hi Alex,

    Can you run the application for a bit (few seconds)? Then check the following:

    - Can you look at Tools->ROV->Clock->Module to make sure the clock tick is running? It should increment after a halt/run/halt.

    - Also, can you do a ROV->BIOS->Scan for errors... This will check stacks and other modules to make sure the kernel is in a good state.

    - Also look at ROV->BIOS->Task->Detailed to see the state of the task. Is it blocked or ready? If it is ready, that means something else is hogging the CPU.

    Todd
  • Hi Todd.

    Thanks for reply

    - The tick = 0 (not incremented) / timerId = 4 / swi Priority = 15 / nSkip = 1

    - There are no BIOS errors found

    - The task is blocked on Task_sleep(10)

    I suspect that the hardware timer used for ticks timer doesn't run.

    Do you know which timer is used for ticks? (does it come from external timer or some internal timer is used?) May be I should enable it manually.

    Best regards

    Alex

  • Hi Alex,

    Processor SDK Vision (www.ti.com/.../processor-sdk-vision) provides the reference configuration for BIOS tick timer.

    You can find the timer configurations at [SDK_install]\vision_sdk\links_fw\src\rtos\bios_app_common\tda3xx\dsp1\Dsp1.cfg.
    It configures GP Timer 7 to provide the 1ms BIOS system tick. Here is the config snippet.

    /***********************************************
    * CLOCK Module Configuration *
    ***********************************************/
    var Clock = xdc.useModule("ti.sysbios.knl.Clock");
    Clock.tickMode = Clock.TickMode_PERIODIC;
    Clock.tickSource = Clock.TickSource_USER;

    /* allocate timer 7 and 8 to DSP1 */
    var TimerSupport = xdc.useModule('ti.sysbios.family.shared.vayu.TimerSupport');
    TimerSupport.availMask = 0x00C0;

    /***********************************************
    * Timer Module Configuration *
    ***********************************************/
    var Timer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');

    Timer.intFreq.hi = 0;
    /* system clock runs at 20 MHz */
    Timer.intFreq.lo = 20000000;
    Timer.checkFrequency = false;

    var timerParams = new Timer.Params();
    timerParams.period = 1000;
    timerParams.twer.ovf_wup_ena = 1;
    timerParams.tiocpCfg.emufree = 1;
    timerParams.tsicr.posted = 0;
    Timer.create(6, '&mainDsp1TimerTick', timerParams);

    In addition, mainDsp1TimerTick() is defined in [SDK_install]/vision_sdk/links_fw/src/rtos/bios_app_common/tda3xx/dsp1/src/main_common_c6xdsp1.c

    Here is the code snippet.
    void mainDsp1TimerTick(UArg arg)
    {
    Clock_tick();
    }

    You also have to make sure the GP Timer 7 is enabled from PRCM module.
    If you are using default TDA3 GEL file from CCS, the GPT7 module should already be enabled.

    Regards,
    Stanley
  • Alex,

    Can I mark this as resolved?

    Todd
  • Hi, Todd.

    Sorry for the delay.

    I haven't forgot it, but I understand, I need to learn all this issue of XDCtools / SYS-BIOS / etc. in details.

    There are a lot of new stuffs for me.

    I'll mark this issue as "Resolved" and will continue to investigate it.

    Sincerely,

    Alex