NMI managing

I want to use the NMI so I configured the P200 pin to act as NMI, but I can't find how to insert my NMI interrupt function. 

Any help, please?

  • Hello Laboratori,

    To register callback for one of the NMI's, you'll need to use R_BSP_GroupIrqWrite() function, i.e. R_BSP_GroupIrqWrite(BSP_GRP_IRQ_NMI_PIN, nmi_pin_callback); for NMI pin, where nmi_pin_callback is the name of your callback function (the prototype is: void nmi_pin_callback(bsp_grp_irq_t irq);).

    Regards
  • In reply to Renesas Karol:

    Thanks Karol,

    I added your suggestions to my code. Now the problem is that the NMI is not detected. I'm shorting P2.0 to GND in the SK-S7G2 board and nothing happens. I've searched for the correct driver to configure the NMI but I'm not sure if it is "External IRQ driver on r_icu" or anything else (I cannot find NMI in its properties). What should I do to have the NMI working, please?
  • In reply to Laboratori Elecsan:

    Hello Laboratori,

    I can also see that by default NMI is only enabled for stack pointer monitor (in ThreadX applications) interrupt. Set R_ICU->NMIER_b.NMIEN to 1 and the NMI should be enabled. In your callback, make sure to perform R_ICU->NMICLR_b.NMICLR = 1; in order to clear the interrupt flag once you finished processing.

    Regards
  • In reply to Laboratori Elecsan:

    Another question. How is configured the interrupt detection using the SSP, not the MCU registers? (falling edge, rising edge, digital filtering)

    Thanks.
  • In reply to Renesas Karol:

    Thank you, Karol. Now I have the NMI working.

  • In reply to Laboratori Elecsan:

    Hello Laboratori,

    NMI section of the ICU is relatively simple and SSP currently does not provide a driver layer for it. You can configure interrupt trigger and filtering using settings in R_ICU->NMICR register.

    Regards
  • In reply to Renesas Karol:

    Thank you. I was asking it to be more "SSP compliant" just in case it was already implemented, but I don't fear the MCU registers :)
  • In reply to Renesas Karol:

    Hi Karol,
    I don't see NMIMD have the option to select to detect rising and falling edges in the S128 manual. Is there any way to enable this option.

    Thanks.
  • In reply to Copper:

    The NMIMD bit is defined in Sec 12.2.5 of the S128 user Manual.

    -Gary

  • In reply to garyj:

    I select NMI detection for falling edge. I see that the callback function for this interrupt keep executing as long as this NMI pin stay LOW. Am I stating this correct?