How do I install an interrupt service routine in MQX Lite?

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

How do I install an interrupt service routine in MQX Lite?

Jump to solution
600 Views
tim_gack
Contributor II

Hello,

I am working on a Processor Expert and MQX Lite based project. I would like to include the virtual com port project from SDK version 2.1. This is mostly working, but I'm having some trouble installing the USB0 interrupt service routine into the MQX interrupt table. 

This is the attempt to install the interrupt service routine. This results in execution of the unhandled interrupt exception handler.

PEX_RTOS_InstallInterrupt(INT_USB0, USB0_IRQHandler, NULL);

This is the Processor Expert configuration:

pastedImage_1.png

This is the Interrupt Service Routine function:

void USB0_IRQHandler(void *param)
{
   USB_DeviceKhciIsrFunction(s_cdcVcom.deviceHandle);
}

And finally, the INT_USB0 definition:

pastedImage_2.png

I had incorrectly configured the interrupts at one point which caused MQX to stop working because systick was missing, but, interestingly the usb device did start working. That configuration looked like this:

pastedImage_4.png

So, in light of that I tried offsetting INT_USB0 parameter by -1, which did not work at all.

Any help would with this would be greatly appreciated.

1 Solution
411 Views
tim_gack
Contributor II

Hi Daniel,

I found the problem.

In the SDK 2.x usb examples there are some special sections of memory defined specifically for the USB buffer descriptor table, state management structure and a dma buffer. These memory sections do not exist in a stock processor expert project so I've added those section to the PE generated linker script and disabled linker script generation. The interrupt stack was to small as well, so for now I've increased its size from 1K to 4K. 

Thanks again for the help,

Tim

View solution in original post

3 Replies
411 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Tim:

MQX Lite install interrupts through the MQX standard ISR installation mechanism. I would suggest you try to use

_int_install_isr(IntVector, (INT_ISR_FPTR)IsrFunction, IsrParam);

If this does not work, please also check whether this vector is enabled.

 

Regards

Daniel

0 Kudos
412 Views
tim_gack
Contributor II

Hi Daniel,

I found the problem.

In the SDK 2.x usb examples there are some special sections of memory defined specifically for the USB buffer descriptor table, state management structure and a dma buffer. These memory sections do not exist in a stock processor expert project so I've added those section to the PE generated linker script and disabled linker script generation. The interrupt stack was to small as well, so for now I've increased its size from 1K to 4K. 

Thanks again for the help,

Tim

411 Views
tim_gack
Contributor II

Hi Daniel,

Thank you for the response. 

The symptom for this issue is not that the interrupt doesn't occur, it's that the Unhandled interrupt service routine is called when a USB interrupt occurs rather than calling the USB0_IRQHandler. 

I did try calling the _int_install_isr function directly, but since the PEX_RTOS_InstallInterrupt function calls the _int_install_isr internally I just put it back because it separates kernel ISRs from application ISRs and casts the service routine parameter as appropriate for the current MQX version.

Are there other reasons that might cause the MXQ interrupt processor to call the Unhandled ISR rather than the installed ISR? 

Regards,

Tim

0 Kudos