Hi. I'm attempting to install an application ISR in MQX to run on FlexTimer overflow.
Have enabled interrupts in FlexTimer register and installed the ISR with MQX function:
_int_install_isr(INT_FTM1, FLEXTIMER1_ISR, isr_ptr);
When timer overflows the ISR is not getting called.
Is there a way to check if ISR is installed correctly or is there
some other configuration missing?
Thanks
Solved! Go to Solution.
Hello DangerMouse,
you were right in your second post with an assumption. First enable interrupt flag in peripheral register, install isr into the MQX vector table and then enable interrupt in NVIC.
If you're working with a cortex core , you must configure it. There're functions in psp/cortex/cortex.c :
_cortex_int_init
_cortex_int_enable
_cortex_int_disable
There''re redefined with macros in bsp.h for your board:
#define _bsp_int_init(num, prior, subprior, enable) _cortex_int_init(num, prior, enable)
#define _bsp_int_enable(num) _cortex_int_enable(num)
#define _bsp_int_disable(num) _cortex_int_disable(num)
Regards,
MartinK
Does MQX not know about these FlexTimer interrupts -Overflow, channels etc.
Do i have to configure the NVIC registers directly?
Hello DangerMouse,
you were right in your second post with an assumption. First enable interrupt flag in peripheral register, install isr into the MQX vector table and then enable interrupt in NVIC.
If you're working with a cortex core , you must configure it. There're functions in psp/cortex/cortex.c :
_cortex_int_init
_cortex_int_enable
_cortex_int_disable
There''re redefined with macros in bsp.h for your board:
#define _bsp_int_init(num, prior, subprior, enable) _cortex_int_init(num, prior, enable)
#define _bsp_int_enable(num) _cortex_int_enable(num)
#define _bsp_int_disable(num) _cortex_int_disable(num)
Regards,
MartinK
Thanks MartinK that helps alot!
My first hurdle for doing such code development is forgetting to enable the clock gate to the module.
The SIM section of the reference manual will detail all the SIM_SCGCx registers.
For FTM1 and FTM 0 they are in SIM_SCGC6 bits 25 and 24 respectively.
Biggest clue that this step is missing is when looking at the module in the register view and all registers are the same value and not changeable.
Regards,
David
I am using the flextimer configured as a quadrature detector and cannot get MQX to recognize the timer overflow interrupt. I performed the suggested initialization:
FTM1_SC |= FTM_SC_TOIE_MASK;
_int_install_isr(INT_FTM1, (void (_CODE_PTR_)(pointer))FTM1_ISR, &pmdPositionMotor1);
initialized = _cortex_int_init(INT_FTM1, 7, TRUE);
initialized = _cortex_int_enable(INT_FTM1);
The flextimer isr worked on the TWR-K60N512 platform without the _cortex_int_* calls, but does not work on the K60FX512VLQ12 processor and MQX 3.8 patch for TWR-K60F120M.
The flextimer correctly decodes the quadrature signal but does not service the interrupt. My workaround is to poll the TOF flag in a periodic task and perform the corresponding isr processing.
Is there still a problem with my code or is the problem with MQX?
Nancy
Hi Nancy
I am the same spot with the flextimer and trying to sort out what is needed. Can you share with me what you used for header files in the mqx project and how did you set up the register access. We have a working mqx timer system on the CF V1, 51JM128, but now we are using the K20dx256 and all the rules have changed. In that system I assigned
VMCF51JM_STRUCT_PTR reg_ptr;
Then did all the register access's through reg_ptr__>field
But it doesn't seem to work this way on the Kinetis. I was wondering if you or someone would have a suggestion on how to set up the register access & headers.
Thanks
Robert
Found the header file and posted the answer in the new discussion I had created.
Here is how to fix the flex timer isr problem. In cortex.h change the following from 3 to 4:
#define CORTEX_PRIOR_IMPL (4)
Thanks to David Seymour for finding this solution.
Nancy