This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software:
Hello,
Is it possible to trigger a CLA task after a certain number of interrupts/events have occured?
Currently , I have configured a CLA task to automatically trigger on every SDFM interrupt using the driver lib function CLA_setTriggerSource()
CLA_setTriggerSource(CLA_TASK_1, CLA_TRIGGER_SDFM1INT);
I would like to modify the above such that the CLA task triggers after 'n' number of SDFM interrupts have occured. How do i go about doing this?
I am looking for a functionality similar to what the driverlib function EPWM_setInterruptEventCount() does for the EPWM module.
//***************************************************************************** // //! Sets the ePWM interrupt event counts. //! //! \param base is the base address of the EPWM module. //! \param eventCount is the event count for interrupt scale //! //! This function sets the interrupt event count that determines the number of //! events that have to occur before an interrupt is issued. //! Maximum value for eventCount is 15. //! //! \return None. // //***************************************************************************** static inline void EPWM_setInterruptEventCount(uint32_t base, uint16_t eventCount)
Thanks!
Hi AK,
The simplest way to implement this sort of functionality is to have a global variable in you CLA file that keeps track of how many times the task has been triggered. You can check at the beginning of the task if the variable is equal to 'n' and execute the desired functionality then. If the variable is less than n, you can increment it and break out of the task.
Let me know if you have any concerns with this method.
Best Regards,
Delaney
Hi Delaney,
I am implementing somthing similar at the moment. I was wondering if there was an inbuilt method to do this from the MCU internally(without any software intervention).
The point here is that the CLA task will run at every interrupt, i don't want this to happen in the first place(If CLA task PIE interrupts are enabled, it would un-necessarily interrupt the CPU constantly).
The next best thing is that the CLA task runs at every interrupt, but the functionality can be run every nth interval.
Hi AK,
I see; as far as the CLA goes, there is no specific setting in any CLA register that can configure tasks to trigger after 'n' conditions like in the ePWM module.
There may be a way to implement this using the CLB module. I will loop in the CLB expert to comment, although they are currently out for business travel so, please expect a reply for them towards the end of this week or early next week.
Best Regards,
Delaney
Hi AK,
After looking into it, I actually don't think the CLB has access to the CLA so this wouldn't be a feasible solution.
Another idea - you could have the SDFM trigger one task, then in the case that it is the nth trigger (you can check the global flag), the first task will trigger a second task to run the desired code. If it's not the nth trigger, you can just break out of the first task. This second task can be used to trigger the CPU interrupt, so the CPU would only be triggered every nth SDFM trigger.
Would this work for your application?
Best Regards,
Delaney
Thanks Delaney,
Another idea - you could have the SDFM trigger one task, then in the case that it is the nth trigger (you can check the global flag), the first task will trigger a second task to run the desired code. If it's not the nth trigger, you can just break out of the first task. This second task can be used to trigger the CPU interrupt, so the CPU would only be triggered every nth SDFM trigger.
This is a good idea, Will try this out.