Hello,
I'm not sure if this topics should be posted in the BIOS are or here - correct me if I'm wrong here.
Im trying build a run-time System with some SWI-Threads which are called at a fixed period. Therefore I use a Clock funcion to post the SWIs.
- SWI0 excecuted with every call of the Clock function
- SWI1 every 4th Clock call
- SWI2 every 16th
- SWI3 every 512th
Clock and SWI are created static in the .cfg File. The Lines are:
/****************************************************************************/
var clock0Params = new Clock.Params();
clock0Params.instance.name = "clock0";
clock0Params.period = 1;
clock0Params.startFlag = true;
Program.global.clock0 = Clock.create("&clk0Func", 200, clock0Params);
Clock.tickPeriod = 100;
Clock.timerId = -1;
var swi0Params = new Swi.Params();
swi0Params.instance.name = "hdl_swi0";
swi0Params.priority = 8;
Program.global.hdl_swi0 = Swi.create("&swi0Func", swi0Params);
var swi1Params = new Swi.Params();
swi1Params.instance.name = "hdl_swi1";
swi1Params.priority = 7;
swi1Params.trigger = 4;
Program.global.hdl_swi1 = Swi.create("&swi1Func", swi1Params);
var swi2Params = new Swi.Params();
swi2Params.instance.name = "hdl_swi2";
swi2Params.priority = 6;
swi2Params.trigger = 16;
Program.global.hdl_swi2 = Swi.create("&swi2Func", swi2Params);
var swi3Params = new Swi.Params();
swi3Params.instance.name = "hdl_swi3";
swi3Params.priority = 5;
swi3Params.trigger = 512;
Program.global.hdl_swi3 = Swi.create("&swi3Func", swi3Params);
/****************************************************************************/
The Clock-SWI-function calls the other SWIs in this way:
void clk0Func (void)
{
GPIO0_7_toggle(); //Toggle testpin
Swi_post(hdl_swi0); //SWI0: every Clock-Tick
Swi_dec(hdl_swi1); //SWI1 executed every 4. Tick (Init_Trigger = 4)
Swi_dec(hdl_swi2); //SWI2 executed every 16. Tick (Init_Trigger = 16)
Swi_dec(hdl_swi3); //SWI3 executed every 512. Tick (Init_Trigger = 512);
}
At the moment the SWIs are only toggling onboard LEDs. Not more.
The Problem is that, SWI0 / clk0Func is not executed in the periode I expected:
- With Clock.tickPeriod = 100, I meassure about 92 us
- With 500, I get 488 us
- With 1000, I get 1005.1 us
Questions:
Why is there such a big difference between the configured time and the real period? How can I reduce it?
Another point is that the maximum frequency of the fastest Task I want to test will be 16 kHz / 62.5 us. When I reduce the Clock.tickPeriod value the Clock funktion doen't even get called anymore. How can i get faster Clock ticking?
My HW / SW Setup is:
- Code Composer Studio v5.4.0.00091with xdctools_3_25_00_48 , am335x_sysbios_ind_sdk_1.0.0.8 and bios_6_35_01_29
- AM3359 on ICE Evalboard
Regards,
Tim