Interrupts on MQX 4.0

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Interrupts on MQX 4.0

651 Views
ezequielwortman
Contributor I

Hi everybody,

I'm working with two PWM channels in order to make a sine wave from DC voltage, and my strategy is to use a sine table, which means that within a specific period of time I need to update my position or step in the table, moving forward each time one step. I've tested my KWIKSTIK with MQX 4.0 and despite installing the interrupt correctly (I think?) I'm not having the results I expected. I have two questions:

-For KWIKSTIK users:

I'm using Flextimer 1 and 2 for the PWM channels, and I was testing the flextimer0 to use as interrupt. Is this correct or could it be the cause of my problem? The interrupt works but when trying to change the PWM Duty Cycle on the interrupt routine the channels do not respond well, I need to refine the signal.( Channels are working at 20 Khz, interrupt should be at 10Khz)

-For MQX users:

The only thing I have to do with MQX is to install the interrupt with int_install_isr and then I'm good to go right? I know I have to set a routine for the interrupt but besides that no further instructions are needed?

If possible, could you please provide me with a example of an interrupt in MQX 4.0? I'm interested also in an example on how to set up a PIT Timer, if the Flextimer0 Interrupt is interfering with the PWM channels.

Thanks for everything!!

Ezequiel

Tags (3)
0 Kudos
3 Replies

319 Views
egoodii
Senior Contributor III

If it were ME, I'd set up a Programmable Delay Block to trigger regular DMA operations to set the timer values and avoid realtime firmware overhead altogether!

0 Kudos

319 Views
ezequielwortman
Contributor I

Hi Earl,

Thanks for the answer! I read some of this on the K40 datasheet, basically this would imply a hardware trigger right? The PDB triggers the flextimer? With this implementation a software interrupt is no longer needed?

Thanks!

Ezequiel

0 Kudos

319 Views
egoodii
Senior Contributor III

The PDB would trigger a DMA request to transfer your 'next' width to the FlexTimer channel register.  If this is a 'continuous' waveform with 'few' on-the-fly changes in shape or period, then the DMA controller can cycle itself thru the set of widths over the repetition period.  It should also be possible for the FlexTimer channel to trigger the DMA itself as it needs each reload?

0 Kudos