S5D9 - Determine which edge of IRQ caused interrupt?

Hi RenesasRulz,

I'm using an S5D9 with e2Studio and SSP 1.7.8, and have two IRQ lines connected to sensors. I have added two instances of the External IRQ Driver on r_icu to a thread which will keep track of the sensor status.  I have them configured to trigger on either a rising or falling edge with filtering.

How can I detect which edge (rising or falling) caused the IRQ callback? With a breakpoint, I can see that external_irq_callback_args_t *p_args is passed into the IRQ callback, but it only seems to have a const void *p_context and uint32_t channel within.

How can the info provided to the callback be used to determine whether a rising or falling edge caused the interrupt?

Many thanks!
Scott

  • Hello Scott,

    I usually use the primitive but working way for this case. I just read the pin state inside the interrupt callback handler. If it's high, then the edge is rising, otherwise it's falling.

    Kind regards,
  • In reply to Sergey Sokol:

    Thanks, Sergey,

    That's the solution I landed on as well. Just surprised that there's no information built into the callback p_args to give you this type of information. Hoping your solution works well for me, too!

    Kind regards,

    Scott
  • I think you can do this in software by looking at the current state of the signal in the ISR.
  • In reply to larry_c_not_Renesas:

    Thanks larry_c,

    Is this done just by using g_ioport pinRead function? Any working example code would be appreciated.

    Kind regards!

    Scott