ERU output

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

cross mob
Not applicable
I have this example for using ERU (I have found this example in the distributed XMC Peripheral Lib examples section)
I'd like to use it on XMC1100. The Port I/O functions says P0.0 connected to ERU0.PDOUT0 . It means when I remove the interrupt handling from this example the LED will still toggled?



#include
#include

#define LED P0_0
#define POT P2_5

XMC_ERU_ETL_CONFIG_t button_event_generator_config =
{
.input = ERU0_ETL1_INPUTA_P2_5,
.source = XMC_ERU_ETL_SOURCE_A,
.edge_detection = XMC_ERU_ETL_EDGE_DETECTION_FALLING,
.status_flag_mode = XMC_ERU_ETL_STATUS_FLAG_MODE_HWCTRL,
.enable_output_trigger = true,
.output_trigger_channel = XMC_ERU_ETL_OUTPUT_TRIGGER_CHANNEL0
};

XMC_ERU_OGU_CONFIG_t button_event_detection_config =
{
.service_request = XMC_ERU_OGU_SERVICE_REQUEST_ON_TRIGGER
};

void ERU0_0_IRQHandler(void)
{
XMC_GPIO_ToggleOutput(LED);
}

int main(void)
{

XMC_ERU_ETL_Init(ERU0_ETL1, &button_event_generator_config);
XMC_ERU_OGU_Init(ERU0_OGU0, &button_event_detection_config);

XMC_GPIO_CONFIG_t config;

config.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL;
config.output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH;
XMC_GPIO_Init(LED, &config);

config.mode = XMC_GPIO_MODE_INPUT_TRISTATE;
XMC_GPIO_Init(POT, &config);

NVIC_SetPriority(ERU0_0_IRQn, 3U);
NVIC_EnableIRQ(ERU0_0_IRQn);

while(1)
{
/* Infinite loop */
}
}
0 Likes
1 Reply
chismo
Employee
Employee
First like received
Hello,

Each GPIO pin can support one of many possible alternate output functions.
In the mentioned example, it is selected as an general purpose output and not as an ERU output (Alternate output function 1).

To do this, the line:
config.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL; // selecting GPO

has to be changed to:
config.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT1 ;  // selecting alternate output function 1: ERU0.PDOUT0


Regards,
Min Wei
0 Likes