Duggle Posted June 14, 2015 Report Share Posted June 14, 2015 (edited) 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 June 14, 2015 by Duggle Quote Link to comment Share on other sites More sharing options...
TK. Posted June 14, 2015 Report Share Posted June 14, 2015 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. Quote Link to comment Share on other sites More sharing options...
Duggle Posted June 14, 2015 Author Report Share Posted June 14, 2015 Hi TK, I'm using STM32F1x. The application is a complex square wave generator with the interval changes in a state machine inside the ISR. I'll try your suggestion.... Thanks! Quote Link to comment Share on other sites More sharing options...
Duggle Posted June 16, 2015 Author Report Share Posted June 16, 2015 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.