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)
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.
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)
If this condition is met and the SetVector function is called, does that need to be called again after changing priority?
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() */
/* Enable the interrupt */
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.
Either use the Cy_SysInt_Init function or call the CMSIS function.