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.

AM5728: DSP SYSBIOS clock issue

Other Parts Discussed in Thread: AM5728, SYSBIOS

Hi forum,

I am getting super frustrated by not being able to run the OS Clock module run properly on the DSP1 of a AM5728.

I am trying to use GPTimer14 (Id:13) that is configured in the Linux Device Tree as belonging to DSP1.

Therefore I made a simple project that replicates the problem which contains the .cfg, a makefile and one .c file.

Basically, I launch a task that should sleep for 1000ms and print something every time sleep expires.

Additionally, I defined the Clock as USER type and I am calling Clock_tick() myself from a custom function but this is never called because the Clock tick is stuck at zero.

static int n = 0;
Void myTimerTick(UArg arg)
{
	Clock_tick();
	n++;
	if(n%1000 == 0)
	{
    	Log_print1(Diags_INFO, "Clock_tick() %d\n", n);
	}
}

/*
 *  ======== main ========
 */
Int main(Int argc, Char* argv[])
{
    Error_Block     eb;
    Task_Params     taskParams;

    Log_print0(Diags_ENTRY, "--> main:");

    /* must initialize the error block before using it */
    Error_init(&eb);

    /* create main thread (interrupts not enabled in main on BIOS) */
    Task_Params_init(&taskParams);
    taskParams.instance->name = "task";
    taskParams.arg0 = (UArg)argc;
    taskParams.arg1 = (UArg)argv;
    taskParams.stackSize = 0x1000;
    Task_create(main_task, &taskParams, &eb);

    if (Error_check(&eb)) {
        System_abort("main: failed to create application startup thread");
    }

    /* start scheduler, this never returns */
    BIOS_start();

    /* should never get here */
    Log_print0(Diags_EXIT, "<-- main:");
    return (0);
}


/*
 *  ======== main_task ========
 */
Void main_task(UArg arg0, UArg arg1)
{
    Log_print0(Diags_ENTRY, "--> main_task:");

	while(1)
	{
		Task_sleep(1000);
    	Log_print0(Diags_INFO, "System_sleep() returned %d\n");
	}

    Log_print0(Diags_EXIT, "<-- main_task:");
}

I should add that I confirm that my GPTimer14 is properly working (base: 0x4882A000, TCLR=0x3, TCRR-increments when debugger stepping).

Please provide some RTOS or DRA7xx expert advice on this as I couldn't find any solution myself.

Best regards

0068.test.zip

  • The output that I get when launching the DSP from ARM console/remoteproc is:

    # cat /sys/kernel/debug/remoteproc/remoteproc2/trace0
    [      0.000] 18 Resource entries at 0x95000000
    [      0.000] [t=0x000440a4] xdc.runtime.Main: --> main:
    [      0.000] registering rpmsg-proto:rpmsg-proto service on 61 with HOST
    [      0.000] [t=0x0035fcf8] xdc.runtime.Main: NameMap_sendMessage: HOST 53, port=61
    [      0.000] [t=0x0037608d] xdc.runtime.Main: --> main_task:
    

  • Hi,

    Without Linux, are you able to run the DSP standalone? That is, use a makefile or CCS project to build the timer interrupt application, I thought rsc_table_dsp.c is not needed, then load it into DSP core with CCS/JTAG (without using Linux remoteproc). Is this working as expected? 

    This can separate the issue either pure timer configuration or integration with Linux?

    Regards, Eric

  • Hi Eric,

    Loading from CCS over JTAG never worked for me, and this thread has more info about this. I only load via remoteproc.

    Besides, the linux device tree simply says that my timer, GPTimer14 is handled by DSP. It is SYSBIOS configuration file that gets translated to C code which sets those Timer registers. I don't think Linux has any influence here.

    I also don't think the Timer itself is the culprit because I checked the registers, it counts to exactly 1ms (19200000 Hz, 19200 counts, from 0xffffb500 to 0xffffffff).

    I think the culprit is the BIOS Clock configuration or the interface between it and the working Timer.

    In the meantime, I did some more tweaks in BIOS .cfg and somehow the BIOS Clock started ticking and all Task_sleep() functions and trace timestamps were correct but after a reboot of the board nothing worked anymore with the exact same DSP1 image. This happened already twice. 

    /* --------------------------- TICK --------------------------------------*/
    var TimerSupport = xdc.useModule('ti.sysbios.family.shared.vayu.TimerSupport');
    TimerSupport.availMask = 0xFFFF;
    
    var Clock = xdc.useModule('ti.sysbios.knl.Clock');
    Clock.tickSource = Clock.TickSource_USER;
    Clock.timerId = 13;
    
    var Timer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
    
    Timer.timerSettings[13].intNum = 15;
    
    /* Skip the Timer frequency verification check. Need to remove this later */
    //Timer.checkFrequency = false;
    
    /* Match this to the SYS_CLK frequency sourcing the dmTimers.
     * Not needed once the SYS/BIOS family settings is updated. */
    Timer.intFreq.hi = 0;
    Timer.intFreq.lo = 19200000;
    
    var timerParams = new Timer.Params();
    timerParams.period = Clock.tickPeriod;
    timerParams.periodType = Timer.PeriodType_MICROSECS;
    /* Switch off Software Reset to make the below settings effective */
    timerParams.tiocpCfg.softreset = 0x0;
    /* Smart-idle wake-up-capable mode */
    timerParams.tiocpCfg.idlemode = 0x3;
    /* Wake-up generation for Overflow */
    timerParams.twer.ovf_wup_ena = 0x1;
    Timer.create(Clock.timerId, Clock.doTick, timerParams);

  • Hi,

    I attached a SYSBIOS C66x timer application. This is standalone which you can load with CCS/JTAG. If you look at the delta in the expression window, you will see that the timer ISR is entered every 600M cycles, that is 1 seconds for the 600MHz CPU. You may refer to this as a starting point for your timer (different instance, different interval, etc).

    For the Linux + Timer, I added my colleague for this support.

    Regards, Eric

    Timer_C66x_Sysbios.zip

      

  • Hi,

    Are you able to confirm that standalone SYSBIOS timer on C66x worked on your side (see my attached CCS project)? And the issue is only in Linux+DSP?

    Regards, Eric

  • Hi Eric,

    I assumed your project to be working as-is (using GPTimer6).

    I tried it onto my board and of course Linux started showing kernel dumps and access to L4_PER3, because DSP1 was accessing a Timer not marked as assigned to it in linux device tree.

    Then I simply changed the timer id to 13 (GPTimer14) in your project's .cfg. The dumps disapeared but for some reason the application wouldn't work as you described.

    I then recompiled the Linux device tree after instructing it to use GPTimer5 (traditionally used with DSP1).

    This worked, BIOS Clock is now counting normally.

    Thanks for the support !