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

cross mob
Not applicable
Hi All,

I have XMC1300 kit and pin P2.5 potentionmeter is connected as it is analog pin also.

I want to use this pin as key input digital pin on my application design. But before that I tried to work on XMC1300 kit.

My aim is to use falling edge on this pin P2.5 through ERU to generate an interrupt.

Based on the example below


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_SWCTRL,
.enable_output_trigger = true,
.output_trigger_channel = XMC_ERU_ETL_OUTPUT_TRIGGER_CHANNEL0
};


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


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

NVIC_SetPriority(ERU0_0_IRQn, 15);
NVIC_ClearPendingIRQ(ERU0_0_IRQn);
NVIC_EnableIRQ(ERU0_0_IRQn ) ;

void ERU0_0_IRQHandler(void)
{
XMC_ERU_ETL_ClearStatusFlag(ERU0_ETL1);
}


But issues I am getting are:

  • Continuous interrupt is generating irrespective of P2.5 voltage level(digital high or low)
  • If I try to use any interrupt other than ERU0_0_IRQHandler, its not working


As P2.5 is analog pin I had made it Input pin for key. Some where I read that Analog Pin for making digital input I have to use XMC_GPIO_EnableDigitalInput(XMC_GPIO_PORT2, 5); so I have used this also.

But still I am not getting the correct result.

Please guide me where I am doing wrong.

Regards,
Tinchu
0 Likes
0 Replies