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.
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
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:
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.
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); }
jeffery wangwhy 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 wangBut 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...
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
You are correct, the default frequency is 20MHz for your device and it needs to be scaled accordingly with:
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.
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?
jeffery wangdo 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.
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.