• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Embedded Software » BIOS » BIOS forum » Task_sleep(1000) is not 1 second delay on the new version BIOS/SYS
Share
BIOS
  • Forum
  • Announcements
Options
  • Subscribe via RSS

Forums

Task_sleep(1000) is not 1 second delay on the new version BIOS/SYS

This question is answered
jeffery wang
Posted by jeffery wang
on Jul 28 2012 03:50 AM
Prodigy145 points

Hi all:
      I met a very stange thing to build my c674 core project(dm8148 PG2.1 evm) in the ccs4.2.4.000033.
      
         bios/sys:6.32.2.39
         ipc: 1.23.2.37
         xdc_tools:3.22.1.21
      If i uesd the above versions of RTSC,the task_sleep(1000) is not 1 second delay,and more fast.

      But if i used the older versions of RTSC without change the .cfg and any routine or configuration,
      the task_sleep(1000) is ok ,just 1  second delay. The old version RTSC below:
         bios/sys:6.31.0.18
         ipc: 1.22.0.19
         xdc_tools:3.20.5.76

I used the ROV to debug the two situation,here are some log of clock and timer.

  (1)the older version:

     

   

(2)The newer version:

  

    

(3)the same clock configration in the .cfg

  

Through the debug,I think is must be  the init clock of the GPtimer4;but i used the same gel script and uboot  to init the timer,all the things confused me.

BIOS/SYS
Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • Tom Kopriva
    Posted by Tom Kopriva
    on Jul 30 2012 14:31 PM
    Expert6950 points

    Hi Jeffery,

    you are correct.

    The Clock module uses the dmtimer. Not sure why, but the dmtimer now defaults to 32768. I'm not quite sure why the timer's clock period isn't being updated...

    Can you try to explicitly add this to your .cfg file:

    Clock.tickPeriod = 20000000;

    and see if that updated the and let me know how this worked. If this works, it may be a problem with the graphical user interface.

    Thanks,

    Tom

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • jeffery wang
    Posted by jeffery wang
    on Jul 30 2012 20:46 PM
    Prodigy145 points

    Hi Tom;

    thank you for reply.

    I just had tryed like your suggestion, unfortunately ,the result was not correct,it  delayed long time than 1s . Here are some debug logs:

    (1) configure in .cfg:

     (2) debug in ROV

          clock: 

        timer:

     

     

    (3)Target/clock enable for Task_sleep(1000)

             1st  time to the breakpoint:

          

            2nd time to the breakpoint:

           

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Tom Kopriva
    Posted by Tom Kopriva
    on Jul 31 2012 11:45 AM
    Expert6950 points

    Hi Jeffery,

    If your gel script modifies the timer's frequency, then you can update the timer module with this frequency to that it scales properly.

    Timer.intFreq.lo = 20000000; /* 20MHz */

    Timer.intFreq.hi = 0;

    An alternative is to edit your gel script so that it doesn't update the timer's frequency (e.i. leaving it at the default) and then you should also get the correct scaling.

    Thanks,

    Tom

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • jeffery wang
    Posted by jeffery wang
    on Aug 01 2012 04:45 AM
    Prodigy145 points

    Hi Tom:

             Used the timer module  and set the freq as 20M will make the task_sleep OK. I tryed it last week.
             My BIOS cfg was not used the timer module defore.
              
            What my question are:
                      (1) why used the older RTSC version without change bios cfg, the task_sleep is ok,the GPTIMER is 20M
                           but used the new RTSC version ,the GPTIMER IS 32768,Task_sleep(1000)is not correct like before,
                           just only used the time module and set freq as 20M.

                             

                                    

            (2) in my application,the clock   setting is below                

                     Clock.tickSource = Clock.TickSource_TIMER;
                     Clock.timerId = 1;   //the time is GPtimer4
                     Clock.tickPeriod = 1000; 

                     But in my gel file,i didn't init the GPtimer4, in my option, if i didn't init the GPtimer4,the task_sleep() would be err or hang .

                     In fact, the  task_sleep()  is run ok,just the delay time is not correct in the new  RTSC version .

                     The debug way of dm8148 evm board  is that :  after the uboot reached the 2nd level ,just break it , and used the jtag emulator to connect  the evm board.

                     the related gel script are :

       OnTargetConnect()
    {
        GEL_TextOut( "\nConnecting Target...\n" );

        HDVPSSInit();

        GEL_TextOut( "Connecting Target... Done.\n\n" );
    }

    menuitem "TI814x 2 HDVPSS Init"
    hotmenu HDVPSSInit()
    {
        GEL_TextOut("\t ****  DM814X2 DDR3 System_Initialisation IS in progress .......... \n","Output",1,1,1);
        ALL_ADPLL_CLOCKS_ENABLE_API();
       
        DDR3_EMIF0_EMIF1_Config();
       
        ControlModule_ClkEnable();
       
        DucatiClkEnable();
       
        /*GEMSSClkEnable();*/
       
        DSSClkEnable();
       
        Timer1_32kHClkEnable();
        Timer3_32kHClkEnable();
       
        /*SpinboxEnable();*/
       
        /*MaiboxEnable();*/
     
     /* For ISS */
     
         ISS_A8_Enable();
        
        GEL_TextOut("\t ****  DM814X2 DDR3 System_Initialisation IS Done ****************** \n","Output",1,1,1);
    }


    menuitem "DM814X2 System Initialization"
    /********************************************************************************************/
     /***** For GP Device *************/
     hotmenu DM814X_System_Initialisation_GP_device()
     {
     GEL_TextOut("\t ****  DM814X2 System_Initialisation IS in progress .......... \n","Output",1,1,1); 
     //-IS_DEVICE_GP_TEST();
     ALL_ADPLL_CLOCKS_ENABLE_API();
     //-DDR2_EMIF0_EMIF1_Config();
     DucatiClkEnable();
     GEMSSClkEnable();
     GEL_TextOut("\t ****  DM814X2 System_Initialisation IS Done ****************** \n","Output",1,1,1); 
     }

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Tom Kopriva
    Posted by Tom Kopriva
    on Aug 01 2012 14:06 PM
    Expert6950 points

    Hi Jeffery,

    jeffery wang
    why used the older RTSC version without change bios cfg, the task_sleep is ok,the GPTIMER is 20M
                           but used the new RTSC version ,the GPTIMER IS 32768,Task_sleep(1000)is not correct like before,
                           just only used the time module and set freq as 20M.

    Between the these releases of SYS/BIOS, it was decided that the default frequency for the timers need to be set to what the hardware defaults to after a reset instead of a frequency that gets "commonly" set by some other application such as a bootloader.

    The Timer module does not modify the registers that manipulate the clock frequency to the timer. This needs to be done by the developer by either including these settings in their application (e.g. using a bootloader such as uboot or some other init() function all) or via some gel file.

    The Clock module uses a timer instance from the Timer module. It assumes that the Timer is being clocked at the correct scale. With this assumption, it will call a doTick() function periodically for its system ticks (which is used by Task_sleep()). Functionally, as long as there is some sort of mechanism that periodically calls the "doTick()" function, Task_sleep() will always as it should. However, If the timer's input clock frequency is modified, you need to inform the Timer module that actual frequency input so that the time scales accordingly and the doTick() function gets called at the correct rate.

    jeffery wang
    But in my gel file,i didn't init the GPtimer4, in my option, if i didn't init the GPtimer4,the task_sleep() would be err or hang .

    Whether doTick() is called every ms or every us, it still will work. The problem is that it just wouldn't be scaled properly and unless you have some sort of reference clock there is no way for the Timer to detect if the input frequency is correct. Also, when you have such a reference clock, you'd also need to know that the reference clock is also correct...which leads back to an assumption that a different clock is correct...

    Thanks,

    Tom

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • jeffery wang
    Posted by jeffery wang
    on Aug 02 2012 08:35 AM
    Prodigy145 points

    Hi tom:

              After reading you reply ,i know many of timer and clock  module in BIOS/SYS.

              I checked the uboot source code more carefully,and i just found the init() code of  timer 1 (Evm.c/per_clocks_enable())

              SO i didn't  think the uboot () modified the registers of the  GPTtimer4

              (1) the uboot verson is : 

                      ti-ezsdk_dm814x-evm_5_02_02_60/u-boot-2010.06-psp04.01.00.05

     

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Tom Kopriva
    Posted by Tom Kopriva
    on Aug 02 2012 14:28 PM
    Expert6950 points

    Hi Jeffery,

    You are correct, the default frequency is 20MHz for your device and it needs to be scaled accordingly with:

    Timer.intFreq.lo = 20000000; /* 20MHz */

    Timer.intFreq.hi = 0;

    This wiki page has more information on the default timer frequency: http://processors.wiki.ti.com/index.php/SYS/BIOS_dmtimer_configuration_for_TI81xx

    I know know why the default frequency was changed, but it is highly unlikely that it be changed any time soon.

    Thanks,

    Tom

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • jeffery wang
    Posted by jeffery wang
    on Aug 06 2012 07:42 AM
    Prodigy145 points

    Hi Tom:

            sorry for reply so late.

            I read the wiki about the dmtimer, as the describing of wiki,the SYS/BIOS clock of two m3 are ok  no matter what the new or older version RTSC .

          The dtimer problem is only  just on c674 core.

           "A major complicating factor for all of this is the fact that u-boot and Linux are constantly changing, and both can contain (or not contain) code for configuring the clock input choice. On top of that, this clock input choice can change from version to version, or PSP to PSP, depending on the whim of the developer or system integrator (or, quite possibly, the current level of Cosmic Microwave Background radiation :)This makes it very difficult for SYS/BIOS to pick a reasonable default setting for the input clock frequency. Some systems will boot up to a dmtimer clock input of 32 KHz, while others will boot up with 20 MHz, and others still might boot up with 27 MHz. Some systems will have multiple settings performed, with possible u-boot, Linux default, and explicit Linux device driver settings applied consecutively, with the last one "winning"."  

          In my application,i just used the uboot and i can guarantee that it just inited the  timer 1 in uboot and inited the  timer 3 in  my gel script .

    "You are correct, the default frequency is 20MHz for your device and it needs to be scaled accordingly with"    

    do you mean that whether i inited the timer or not,the default  clock frequency  in sys/bios is 20MHZ? In this application,I didn't init the timer4,why can sys run well?

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Tom Kopriva
    Posted by Tom Kopriva
    on Aug 07 2012 19:59 PM
    Verified Answer
    Verified by David Friedland
    Expert6950 points

    Hi Jeffery,

    jeffery wang
    do you mean that whether i inited the timer or not,the default  clock frequency  in sys/bios is 20MHZ? In this application,I didn't init the timer4,why can sys run well?

    SYS/BIOS assumes that the dmtimer defaults to 32kHz. From the looks of the datasheet, the hardware defaults to the main oscillator's frequency which I think would 20MHz for your device. I'm not sure what the uboot or application does to the timers, but in any case SYS/BIOS needs to be updated with the timer's actual frequency. Once updated, the module assumes that this frequency applies to all timers.

    Thanks,

    Tom

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • jeffery wang
    Posted by jeffery wang
    on Aug 08 2012 00:56 AM
    Prodigy145 points

    Hi  Tom:

                  Thank you very much for you continuous help. I just want to know  more about  clock and timer of sys/bios .

                  I will folllow your suggestion to synchronize the frequency between the SYS/BIOS and the actual application.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use