ERU to GPIO P0.6 on XMC4700

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

cross mob
User13334
Level 2
Level 2
Hello I use the following initialisation


XMC_ERU_ETL_CONFIG_t wsync_event_gen_config =
{
.source = XMC_ERU_ETL_SOURCE_B,
.input = ERU0_ETL3_INPUTB_P0_6,
.edge_detection = XMC_ERU_ETL_EDGE_DETECTION_RISING,
.status_flag_mode = XMC_ERU_ETL_STATUS_FLAG_MODE_SWCTRL,
.enable_output_trigger = true,
.output_trigger_channel = XMC_ERU_ETL_OUTPUT_TRIGGER_CHANNEL0
};

XMC_ERU_OGU_CONFIG_t wsync_event_det_config =
{
.enable_pattern_detection = false,
.service_request = XMC_ERU_OGU_SERVICE_REQUEST_ON_TRIGGER
};


GHPIO P0.6 as Input
     XMC_GPIO_SetMode(XMC_GPIO_PORT0, 6, XMC_GPIO_MODE_INPUT_TRISTATE);


ERU Unit Initialization
       XMC_SCU_INTERRUPT_ClearEventStatus(XMC_SCU_PERIPHERAL_RESET_ERU1);
XMC_ERU_ETL_Init(ERU0_ETL3, &wsync_event_gen_config);
XMC_ERU_OGU_Init(ERU0_OGU0, &wsync_event_det_config);
NVIC_SetPriority(ERU0_0_IRQn, 10);
// Interrupt for ERU0, OGU0
NVIC_EnableIRQ(ERU0_0_IRQn);


But the IRQ Routine is not fired

void ERU0_0_IRQHandler(void)
{
XMC_ERU_ETL_ClearStatusFlag(ERU0_ETL3);
XMC_GPIO_ToggleOutput(XMC_GPIO_PORT5, 8);
}


What is my mistake, thanks for your help

Best regards

EbbeSand
0 Likes
2 Replies
jferreira
Employee
Employee
10 sign-ins 5 sign-ins First like received
Hi,

In the initialization of the ETL use .input_b instead of .input
static const XMC_ERU_ETL_CONFIG_t wsync_event_gen_config =
{
.source = XMC_ERU_ETL_SOURCE_B,
.input_b = ERU0_ETL3_INPUTB_P0_6,
.edge_detection = XMC_ERU_ETL_EDGE_DETECTION_RISING,
.status_flag_mode = XMC_ERU_ETL_STATUS_FLAG_MODE_SWCTRL,
.enable_output_trigger = true,
.output_trigger_channel = XMC_ERU_ETL_OUTPUT_TRIGGER_CHANNEL0
};


If you want to use .input, you would need to shift by 2, i.e. .input = ERU0_ETL3_INPUTB_P0_6 << 2

Regards,
Jesus
0 Likes
User13334
Level 2
Level 2
Hello Jesus,

thanks for your help now the Interrupt is fired

Best regards

EbbeSand
0 Likes