Jump to content

MIOS32_Timer problem


Duggle

Recommended Posts

I'm initialising a timer from App_Init()

MIOS32_TIMER_Init(1, 20000, TTest, MIOS32_IRQ_PRIO_LOW);

The routine is

void TTest(){
	static	u32 PulseCount;				//counter variable
	MIOS32_TIMER_ReInit(1,50000);
	if (++PulseCount&1)
		delH(100);
	else
		delL(200);
}

The port pins are sent high and low with a short soft delay with delH() and delL().

The pin toggles very fast (nothing like 50ms).

The ISR is being triggered repeatedly so fast the application hangs.

Is there anything obvious in my usage?

 

 

Edited by Duggle
Link to comment
Share on other sites

Based on your observations it looks like MIOS32_TIMER_ReInit (unintentionally) triggers an interrupt.

Which core module are you using?

And does it also happen if MIOS32_Timer_ReInit() is only called on interval changes?

 

E.g. write:

   static u32 lastInterval = 0;
   u32 interval = 50000; // could also be a global variable, controlled by app

   if( interval != lastInterval ) {
      lastInterval = interval;
      MIOS32_TIMER_ReInit(1, interval);
   } 

Best Regards, Thorsten.

 

Best Regards, Thorsten.

Link to comment
Share on other sites

I've used the method you've provided and it works ok, as a simple interval timer, auto repeating by default.

Once the interval becomes too short <=4us, the system gets stuck and hangs. This means I need another approach.

 

I'm now in the process of researching how to program the timer registers directly (with the perpheral library) which is time consuming, but will yield very high resolution low cpu performance for the complex patterns required. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...