Dear Sirs,
I have a motion control application, where I need to push the PWM frequency up to 64Khz or more.
The current loop computation should remain at 8Khz., so I need to process exactly one interrupt every eight PWM periods.
As far as I know there is not such feature in the PWM module.
The easy way is to add a counter to skip the unwanted interrupts returning immediately from the interrupt routine.
Unfortunately when the processing take place the interrupt duration may last more than one PWM period, and thus it may loose interrupts (while the interrupt routine is still active) and thus the result is to skip 7 periods "after" the routine is over, leading into a slower and possibly irregular update period.
First question is:
Is it possible to re-enable the interrupt routine within the same routine, in order to have it reenter and correctly count the PWM periods during current loop computations?
An other solution may use a different timer to generate the 8Khz interrupt, but I am concerned with the possible synchronizations problems to update the PWM module within a different unrelated module. It is true that the same clock run all internal timers, so there should be no runaway between the two interrupts, but it is still possible that different processing delays during initialization may cause different phases between the timers at each power up.
Second question is:
Are there any problems updating the PWM module asynchronously?
There may be other possible solution to this problem, so the
Third question is:
Are there other different solutions to the original problem?
For the records I am using a custom project based on LM3S2739 and CCS5 with StellarisWare library, even is this problem may be more general to the Stellaris LM3S family.
Regards.
Mau.