USB MFS, NVIC Priorities -- what is recommended setting

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

USB MFS, NVIC Priorities -- what is recommended setting

1,132 Views
Cdn_aye
Senior Contributor I

Hi

I read through the manuals and posts but am not certain on the priority settings in the NVIC. Right now we have the USB NVIC defaulted to 4; I think this what was from the example code. I am seeing missed interrupts for the call backs for the USB stack and was thinking maybe we have a problem with the priority of other interrupts. The other interrupts are from the PIT0 and FTM0 these are set at 0xB0. I am assuming that higher is a lower priority.

Has anyone else experienced USB MFS failures based on flash drive or based on 'other interrupts' at the same?

Thanks

Robert

Labels (2)
Tags (3)
0 Kudos
Reply
3 Replies

527 Views
Martin_
NXP Employee
NXP Employee

Hi Robert,

did you debug this problem further ? Are you using MQX and its native usb stack ?

How exactly do you configure nvic for PIT0 and FTM0 ? Have you used _int_install_kernel_isr() - are both kernel isrs ? Do you use MQX _bsp_int_init() to initialize NVIC for these ?

In MQX Cortex-M4 PSP, there are 16 levels of NVIC interrupts. However, odd levels are internally used by the MQX kernel itself, and user is allowed to use only even levels for kernel isrs and mqx managed isrs.

Therefore _bsp_int_init() function gets priority parameter between hw_level_max to 7, and this value is doubled before written to NVIC. As you're using a lot of PE drivers, make sure you configure only even NVIC levels (2,4,6,8,10,12,14,16) in PE dialogs. The lower priority value, the higher interrupt priority.

527 Views
Cdn_aye
Senior Contributor I

Hi Martin

That is critical information about the even priorities; I never knew that and must have missed it in the MQX doc set.

Yes we are using MQX and it's native USB stack.

We install the vectors via mqx, but setup via C for both the FTM0, PIT0, here is the init for FTM0 and PIT0. Please note the setting of the priorities...  an attempt to see if the priorities would have an impact on the USB irq recognition. But it either doesn't or we have the wrong priorities. Can you recommend a priority schema? We have low frequency interrupts < 2.5k for the FTM0 and the same for the PIT0. We are primarily concerned about the USB or lack thereof. What I have observed is that the cheaper flashdrives appear to take longer for startup sequencing before becoming ready. That is I think the flash drive controller is slow and takes varying amounts of time to come online depending on the flash drive vendors choice of USB controller. But I thought that the call backs would not register from the USB until the controller was definitely ready? Do you think that this is an invalid assumption. Maybe just the physical interface being plugged in (ie flash drive inserted) triggers the device ready for the MQX stack and it gets out of sync from there on?

We did not use the kernel form of the install... should we? We are running the vector table out of RAM because the boot loader is always loaded and uses the ROM vector table.

void vFn_FTM0_PIT0_ISR_Install (void){

//~~~~~~~~~~~~~~~~~~~~~~ Install FTM0 ISR Vectors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    _int_install_isr    (INT_FTM0, FreqCapture_Interrupt, 0);           // install ISR for FTM0, only one interrupt for entire timer, sets NVIC

    _bsp_int_init       ((IRQInterruptIndex)INT_FTM0, 4, 0, TRUE);      // sets priority of interrupts, loads vector table

    _bsp_int_enable     ((IRQInterruptIndex)INT_FTM0);                  // enables interrupt

//~~~~~~~~~~~~~~~~~~~~~~ Install PIT0 ISR Vectors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    _int_install_isr    (INT_PIT0, FreqOut_Interrupt, 0);               // install ISR for FTM0, only one interrupt for entire timer, sets NVIC

    _bsp_int_init       ((IRQInterruptIndex)INT_PIT0, 4, 0, TRUE);      // sets priority of interrupts, loads vector table

    _bsp_int_enable     ((IRQInterruptIndex)INT_PIT0);                  // enables interrupt

    return;

}

Thank you for responding.

Regards

Robert

0 Kudos
Reply

527 Views
Martin_
NXP Employee
NXP Employee

I think the interrupt scheme depends on the low latency requirement in your application. The FTM0 and PIT0 are low frequency interrupts but when the event occurs, the application may require to handle it as soon as possible. If so, put FTM0 and PIT0 to be high priority interrupts (low value, level 3), but keep the interrupt seervice routines as short as possible. Using _bsp_int_init to initialize NVIC is correct in MQX environment.

For usbh, you first initialize stack and usb controller (install interrupt handler, allocate memory) by _usb_host_init(). Then, callback routine for a class is registered as specified by USB_HOST_DRIVER_INFO. Then the USB Host stack is ready to provide services to events like device ATTACH.  Section 4.2 in USB Host User's Guide gives more details.

0 Kudos
Reply