MQX application ISR help

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

MQX application ISR help

Jump to solution
2,458 Views
DangerMouse
Contributor II

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

1 Solution
798 Views
c0170
Senior Contributor III

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

View solution in original post

9 Replies
799 Views
DangerMouse
Contributor II

Does MQX not know about these FlexTimer interrupts -Overflow, channels etc. 

Do i have to configure the NVIC registers directly?

0 Kudos
799 Views
c0170
Senior Contributor III

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

799 Views
DangerMouse
Contributor II

Thanks MartinK that helps alot!

0 Kudos
799 Views
DavidS
NXP Employee
NXP Employee

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

0 Kudos
799 Views
nancyb
Contributor III
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
0 Kudos
799 Views
nancyb
Contributor III

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

0 Kudos
799 Views
Cdn_aye
Senior Contributor I

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

0 Kudos
799 Views
Cdn_aye
Senior Contributor I

Found the header file and posted the answer in the new discussion I had created.

0 Kudos
799 Views
nancyb
Contributor III

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

0 Kudos