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.

how to implement the timer in DSP BIOS



I'm developing a application with DSP/BIOS.

i want to implement the user timer but i don't know how to manage.

clearly, i do undestand the rule of Clock Manager. if i need to use another timer, should i use the header file. Or there is another way to do it by using the DSP/BIOS

i'm a new user of DSP/BIOS.

Is there a good tutorial i can use

thanks you

  • I have the same problem.

  • What version of BIOS are you using?

    On what chip/platform?

     

  • c6745 processor using  bios 5.41.02.14 .

    I am testing it with very simple code. I have a main function that just does some initialization, one task that flashes blue LED, and one periodic function that flashed red LED.

    Only the blue LED flashes and I can see that timer 0 is not enabled and does not increment after running and pausing the code. Here is basically what I'm running:

    void main()

    { inits(); 

       TMR0->TIM12 = 0x00000000;
       TMR0->PRD12 = 0x5DC0;
       TMR0->INTCTLSTAT = 0x2;

    }

    void task_flashblue()

    {  while(1) {   toggleblueled();

                              delay();

                              TSK_yield(); } 

    }

    void heartbeat_prd()

    {  toggleredled(); 

    }

     

    The .tcf file is below:

    utils.loadPlatform("ti.platforms.evm6747");

    /* The following DSP/BIOS Features are enabled.  */
    bios.enableRealTimeAnalysis(prog);
    bios.enableRtdx(prog);
    bios.enableTskManager(prog);

    bios.TSK.create("TSK0");
    bios.TSK.instance("TSK0").order = 2;
    //bios.PRD.instance("TSK0").period = 100;
    bios.TSK.instance("TSK0").fxn = prog.extern("vBluetoothConnected_PRD");

    bios.PRD.create("PRD1");
    bios.PRD.instance("PRD1").order = 2;
    bios.PRD.instance("PRD1").period = 1000;
    bios.PRD.instance("PRD1").fxn = prog.extern("vHeartbeat_PRD");

    //
    // New Stuff...
    //
    bios.MEM.instance("L3_CBA_RAM").destroy();

    bios.MEM.instance("SDRAM").len = 0x10000000;
    bios.MEM.instance("SDRAM").space = "data";

    bios.MEM.instance("IRAM").base = 0x11804000;
    bios.MEM.instance("IRAM").len = 0x0003c000;

    bios.MEM.create("BOOT");
    bios.MEM.instance("BOOT").base = 0x11800000;
    bios.MEM.instance("BOOT").len = 0x00004000;
    bios.MEM.instance("BOOT").space = "reserved";

    bios.MEM.FARSEG = prog.get("SDRAM");

    bios.CLK.TIMERSELECT = "Timer 0";
    // !GRAPHICAL_CONFIG_TOOL_SCRIPT_INSERT_POINT!

    prog.gen();

  • why are you reprogramming the TMR0 registers?   BIOS will internally initialize and set up timer0 to generate a periodic interrupt which will drive the PRD module.   Can you remove this code and see if things improve?  Are you touching the IER (interrupt enable) register?  Make sure that you are not clearing the bit associated with the timer interrupt (probably interrupt #14 if my memory serves me).

    -Karl- 

  • I had tried it without and it wasn't working, so I thought maybe I had to initialize it manually, but that didn't work either. I am not doing anything with any other timing register.

              john

  • Please try the clk example that is provided with the product.    That example requires the timer to work to wake up the task from the TSK_sleep() call.

    \packages\ti\bios\examples\basic\clk

    Let's make sure that works.   If it does, then you should be able to add PRD function to this app to blink LED.  And then compare the configuration for both these apps to see what is different.

  • I'm not finding a "basic" folder in my examples folder.

  • Sorry about that.  You must be using CCSv4.  We don't currently provide same examples in CCSv4 that we do for CCSv3.

    Attached is the clk example that you should be able to build for the evm6747.   If your memory map is similar, it should probably run on your 6745.

     

    1715.clk.zip

    Regards,
    -Karl-

  • Thanks.  It runs through the task once, but never comes back.   The LOG_printf() doesn't print to my console, so I have a breakpoint in the function. It hits it once only. It is running, but I don' t know what because it stops in various functions (when I pause) like  LNK_F_dataPump(), FXN_F_run(), IDL_F_loop(), etc., but never taskFxn() from the clk.c you sent.

  • Are you running on custom hardware?   Or an EVM board?

    Can you look at the timer registers (memory mapped, you can get their addresses from the data book) in a memory window and see what the counter and period register have in them?  The counter should change between run/halt commands.

    Can you put a breakpoint on "CLK_F_isr" and see if you ever hit it?   My guess is that the timer is not ticking for some reason.

  • Hi Jamp

    Since you are using c6745 , I assume it is on custom hardware? I hope you have other tests that prove that your device is operating reliably, please confirm?

    In addition to the suggestions from Karl, can you please also try the following

    1) Please run this gel file from the wiki: http://processors.wiki.ti.com/index.php/OMAP-L1x_Debug_Gel_Files , while it is listed as an OMAPL1x gel file,  it should hopefully work fine on the c6745 device also. Please list out the printout from running this gel file

    2) If you are running your tests from external memory (SDRAM), as a sanity test, can you try to first run everything from internal RAM to rule out any issues with SDRAM configuration on your board?

    Regards

    Mukul

  • Yes, I'm running custom hardware. We have developed separate projects to test a lot of the functionality of the chip, such as general I/O, writing to flash, bluetooth, uart.  All of these work fine. We also have SDram but are currently not using it so everything is internal.  I will try the gel file you suggest.

          thanks,

              jamp

  • I have loaded the GEL file that was suggested. When I run clk,  TIM12 is incrementing.  PRD12 is 5DC0. Is that what you mean by counter and period registers?  I searched for "CLK_F_isr" and can't find it. Is it part of the clk.c file? or something else I should have.  Is  taskFxn()  supposed to run multiple times?  I have a breakpoint there and it only hits it once.

  • Hi Jamp

    The gel file that I had recommended was a diagnostic gel file that would've given us some more information on the device you have on board. However, looking your last post it seems like the Timer is working correctly, as you are seeing the TIM12 register increment (this is the counter register). The PRD12 5DC0 implies a 24000 cycle period , which also looks correct to give a 1 ms tick for 24 MHz CLK input.

    Based on the information you provided it seems like your device and timer0 itself are working fine. If you wanted to be additionally sure you could try the non-bios Timer example that comes with the PSP package (CCSv4 example included) under

    pspdrivers_01_30_xx\packages\ti\pspiom\cslr\evm6747\examples\timer

    If you did not have the examples/drivers, you can download them from

    http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/omap_l138/1_00/latest/index_FDS.html

    The C6748 Product download would be sufficient, it also has examples for c6747 which is a superset for c6745.

    Regards

    Mukul

  • Go back to the clk example I sent last week.   Load it and run it.  Open a disassembly window in the debugger and search for "CLK_F_isr" in address window.  You might have to try adding leading _ (_CLK_F_isr).   Now put breakpoint here.  Run program and look at timer counter and period.    Do you hit breakpoint?

  • Okay, I do hit the breakpoint. So I agree that the timer is running afterall, but how do I get the "LOG_printf()"  to print so I can get feedback without the debugger?

  • Check the Instrumentation chapter (Ch 3) of the BIOS User's Guide (available in docs directory and from link in release notes).

    We update the LOG data in real time using RTA tools.   You can also see LOG data in the ROV (runtime object view) tool, but this tool only updates on halt.

    We added "stop-mode" support for the RTA tools in BIOS 5.41.04.  This will update the RTA windows when target is halted as well.  The RTA LOG windows have filtering and such that the ROV tools lack.

     

    http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/index.html