6 Replies Latest reply on Oct 8, 2020 8:59 AM by AlanH_86

    What is the proper way to change the priority for a GPIO Interrupt?


      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?