Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

lock attach
Attachments are accessible only for community members.
Not applicable
Hi all, 🙂

I'm using a XMC4400 and have a problem with my ERU: I've connected one button at P1.0 and one at P1.1.
Both of them are connected to a external pull-up resistor, so they should trigger on a falling edge while pressing the buttons.
From the reference manual I know that each of those two ports can be triggered by the ERU:

P1.0: ERU0.3B0
P1.1: ERU0.3A0

so I've tried to initialize them (see attached files).
First of all, since I want to trigger if one or the other button is pressed (equal to a logical OR), I tried to initialize the ERU with

const XMC_ERU_ETL_CONFIG_t BTN01_ERU_ETL_config =

but this was working more like a logical AND (event was triggered when both buttons were pressed...).

The combination
const XMC_ERU_ETL_CONFIG_t BTN01_ERU_ETL_config =

was working like a logical OR instead. Maybe I'm wrong but this looks for me like they've mixed them up in the xmc_eru.h.

So now here is my question: if the event gets triggered, how can I see (in the ERU0_0_IRQHandler) if the trigger was due to a falling edge at source A0 or at B0 (= button0 or button1)?
Is there a possibility to see that?

Since afterwards the 2 buttons should have different functions (for example one should toggle LED0, the other should trigger LED1),
is there any other possibilty to trigger different events by ERU while using those 2 pins (same ERU, same ETL.channel)?

I know that when I use another ETL.Channel (for example ETL.channel == 2 for PIN 0.4 -> ERU0.2B3) I can do this.
But if the ETL.channel of both PINs are the same (like as for my buttons: ETL.channel == 3), how can I do that?

Best regards
1 Reply
First like received

The ERU status flag EXICONx.FL is already the result of the selected input source (A, B, OR or AND logic).
For the case the OR logic is selected, there are no additional flags in the ERU to indicate if which of A or B has triggered the event.

One possibility is to check directly the port pins' input values with Pn_IN.Px register bits.
Of course, this assumes the resulting pulse on the pin following the button press is long enough for the application software to read these input values.

Regarding the inversion of OR and AND logic settings, I don't see this problem.
I am using the XMC peripheral library v2.1.2.
Are you also using this or later version?

Min Wei