- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm using a PSOC62 cy8c6247bzi_d54. I'm using Modus Toolbox v1.1 and cannot currently upgrade.
I'm trying to sort out an issue where a GPIO interrupt handler is taking a long time to get called on the CM0+ after the interrupt fires or sometimes even appears to be ignored. I don't think it's an issue with a masked interrupt or interrupts beings disabled, though that merits more checking.
I would like to change the interrupt priority for the GPIO from the default. Right now, I'm using gpio_irq_init to set up the interrupt which uses a hard-coded interrupt priority of 3 for the CM0+. gpio_irq_init calls gpio_irq_setup_channel which in turn makes the following actions:
// Sets the default priority
Cy_SysInt_Init (calls NVIC_SetPriority)
gpio_irq_enable
NVIC_EnableIRQ
Rather than duplicate and modify the code and force all GPIOs to use the same interrupt priority, could I safely call NVIC_SetPriority after returning from gpio_irq_init? Or do I need to call NVI_DisableIRQ, then NVIC_SetPriority, and then NVIC_EnableIRQ? Is there anything else I should consider that I haven't already mentioned?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just call the CMSIS function
void | NVIC_SetPriority (IRQn_Type IRQn, uint32_t priority) |
I cant think of a reason why that would be a problem.
It is curious that you want to change the interrupt priorities when things are running.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
One more possible function call that may be problematic that can happen after NVIC_SetPriority (see cy_sysint.c):
/* Set the new vector only if it was moved to __ramVectors */
if (SCB->VTOR == (uint32_t)&__ramVectors)
{
(void)Cy_SysInt_SetVector(config->intrSrc, userIsr);
}
If this condition is met and the SetVector function is called, does that need to be called again after changing priority?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi MaWa_4506761,
The cy_stc_sysint_t structure of the Cy_SysInt_Init() should be used to assign the interrupt priority of the GPIO interrupt.
/* Prototype of ISR function for port interrupt 0 */
void Interrupt_Handler_Port0 (void);
cy_stc_sysint_t intrCfg =
{
/*.intrSrc =*/ NvicMux7_IRQn, /* CM0+ interrupt is NVIC #7 */
/*.cm0pSrc =*/ ioss_interrupts_gpio_0_IRQn, /* Source of NVIC #7 is GPIO port 0 interrupt */
/*.intrPriority =*/ 1UL /* Interrupt priority is 1 */
};
/* Initialize the interrupt with vector at Interrupt_Handler_Port0() */
Cy_SysInt_Init(&intrCfg, &Interrupt_Handler_Port0);
/* Enable the interrupt */
NVIC_EnableIRQ(intrCfg.intrSrc);
If the reason you are using MTB 1.1 is because you need dual core support, then you can evaluate the new MTB 2.2 which supports dual core programming.
Regards,
Bragadeesh
Bragadeesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just call the CMSIS function
void | NVIC_SetPriority (IRQn_Type IRQn, uint32_t priority) |
I cant think of a reason why that would be a problem.
It is curious that you want to change the interrupt priorities when things are running.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
AlanH_86 I don't want to change the priority while I'm running. I just want it set to certain priority and leave it at that priority *and* I want to take advantage of the gpio_irq_init function.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Got it.
Either use the Cy_SysInt_Init function or call the CMSIS function.