- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Good Morning,
I can't get an Interrupt to work with the XMC Controller, please help me getting my head around:
The rising edge of Pin 0.9 is supposed to trigger the interrupt, please tell me where i am mistaking:
//Setting p0.9 as Input
XMC_GPIO_SetMode(XMC_GPIO_PORT0, 9,XMC_GPIO_MODE_INPUT_PULL_DOWN);
//ERU Config
XMC_ERU_ETL_CONFIG_t eruInit;
eruInit.input_b = ERU0_ETL1_INPUTB_P0_9;
eruInit.edge_detection = XMC_ERU_ETL_EDGE_DETECTION_RISING;
eruInit.enable_output_trigger = true;
eruInit.output_trigger_channel = XMC_ERU_ETL_OUTPUT_TRIGGER_CHANNEL0;
//OGU Config
XMC_ERU_OGU_CONFIG_t oguInit;
oguInit.service_request = XMC_ERU_OGU_SERVICE_REQUEST_ON_TRIGGER;
//ERU and OGU Init:
XMC_ERU_ETL_Init(ERU0_ETL1, &eruInit);
XMC_ERU_OGU_Init(ERU0_OGU0, &oguInit);
//enable Interrupt
NVIC_SetPriority(ERU0_0_IRQn,3);
NVIC_EnableIRQ(ERU0_0_IRQn);
and then my IRQ Handler:
void ERU0_0_IRQHandler(void)
{
//set breakpoint and be happy when the code arrives here
}
Do i use the right ERU, ETL, OGU? Is everything configured propperly? I read something that i have to call a Method "ClearEventStatus" in xmc4800, but i dont know what could be a valid argument.
Thank you in advance.
Steffen
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Steffen_S ,
Could you please try including the below two parameters in addition to the ones you mentioned for configuring ERU?
eruInit.source = XMC_ERU_ETL_SOURCE_B ;
eruInit.status_flag_mode = XMC_ERU_ETL_STATUS_FLAG_MODE_HWCTRL,
You can read about these two parameters in the XMC library implementation by following these steps -> open DAVE-> Help -> XMC library implementation-> XMC 4.x.x-> Modules -> ERU -> XMC_ERU_ETL_CONFIG_t.
For the source, it is clear from your code that you desire to use input B. And for status_flag_mode, please find the details in the section 4.5(Event Request Unit) of XMC 4700 reference manual here. I am sharing the image from the reference manual below. It explains the correct choice for this parameter according to your application.
You can use the API XMC_ERU_ETL_ClearStatusFlag() to clear the Flag so that the next event is considered as new event. Hope this helps.
Please let us know in case of any further query.
Best Regards,
Aashita
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Steffen_S ,
Could you please try including the below two parameters in addition to the ones you mentioned for configuring ERU?
eruInit.source = XMC_ERU_ETL_SOURCE_B ;
eruInit.status_flag_mode = XMC_ERU_ETL_STATUS_FLAG_MODE_HWCTRL,
You can read about these two parameters in the XMC library implementation by following these steps -> open DAVE-> Help -> XMC library implementation-> XMC 4.x.x-> Modules -> ERU -> XMC_ERU_ETL_CONFIG_t.
For the source, it is clear from your code that you desire to use input B. And for status_flag_mode, please find the details in the section 4.5(Event Request Unit) of XMC 4700 reference manual here. I am sharing the image from the reference manual below. It explains the correct choice for this parameter according to your application.
You can use the API XMC_ERU_ETL_ClearStatusFlag() to clear the Flag so that the next event is considered as new event. Hope this helps.
Please let us know in case of any further query.
Best Regards,
Aashita