infineon4engineers Facebook

infineon@google+ Google+

infineon@linkedin linkedin

infineon4engi@twitter twitter

infineon@youtube youtube

+ Reply to Thread
Results 1 to 3 of 3

Thread: Pin interrupt on XMC1 (via XMC Lib) not working

  1. #1
    Beginner Beginner
    Infineon Employee
    Infineon Employee
    WoS is on a distinguished road
    Join Date
    May 2015
    Posts
    17
    Points
    137.5

    Pin interrupt on XMC1 (via XMC Lib) not working

    Hi all,

    got another issue. For completeness: I am using the xmc 2go board for this experiments.

    I'd like to call a handler (toggling a LED) each time the pin P2_11 receives a falling edge.
    So not too complicated for the beginning

    P2.11 is beside GND, so easy to use a jumper for stimulation of the pulse.

    I checked the XMC1100 manual about the ERU and examples I found in the lib package about handling pin interrupts.
    So I set up something similar I expected to work - but it doesn't yet. Also found no other clues in the forum.

    Here the excerpt of the program:

    Code:
    /* example does not work ... */
    
    #include <xmc_gpio.h>
    #include <xmc_eru.h>
    
    void ERU0_0_IRQHandler(void)
    {
      XMC_GPIO_ToggleOutput(P1_0);
    }
    
    
    int main(void)  {
    	/* output for indication of handler calls */
    
    	const XMC_GPIO_CONFIG_t p1_x_conf = {
    	  .mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL,
    	  .output_level = XMC_GPIO_OUTPUT_LEVEL_LOW
    	};
    	XMC_GPIO_Init(P1_0,&p1_x_conf);					/* LED 1 */
    	XMC_GPIO_Init(P1_1,&p1_x_conf);					/* LED 2 */
    
    	/* P2.11 is ERU0.2B1 which requires the path ERS2 -> ETL2
    	 * we then send this to OGU0 triggering the interrupt */
    
    	const XMC_ERU_ETL_CONFIG_t p2_11_int_event_generator_config =
    	{
    	  .input = XMC_ERU_ETL_INPUT_B1,          /* 2B1 */
    	  .source = XMC_ERU_ETL_SOURCE_B,
    	  .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      /* OGU0 */
    	};
    	XMC_ERU_ETL_Init(ERU0_ETL2, &p2_11_int_event_generator_config);
    	const XMC_ERU_OGU_CONFIG_t p2_11_event_detection_config =
    	{
    	  .service_request = XMC_ERU_OGU_SERVICE_REQUEST_ON_TRIGGER
    	};
    	XMC_ERU_OGU_Init(ERU0_OGU0, &p2_11_event_detection_config);
    
    	/* pin configuration of /INT input */
    
    	const XMC_GPIO_CONFIG_t p2_11_conf = {
    	  .mode = XMC_GPIO_MODE_INPUT_PULL_UP,
    	  .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD
    	};
    	XMC_GPIO_Init(P2_11,&p2_11_conf);		/* /INT */
    
    	NVIC_SetPriority(ERU0_0_IRQn, 3U);
    	NVIC_EnableIRQ(ERU0_0_IRQn);         /* now it is (should be) hot... */
    
    	while(1) {
    		if (XMC_GPIO_GetInput(P2_11)) {
    			  XMC_GPIO_SetOutputLow(P1_1);
    		} else {
    			  XMC_GPIO_SetOutputHigh(P1_1);
    		}
    	};
    }
    The LED2 goes on when the pin gets zero, so the GPIO should be set correctly. But the other LED does not toggle.
    I went over and over again on the ERU config but can't see what's wrong - hopefully one can help me out here...
    I also saw that the NVIC pending bit is not set, so I assume the event does not reach the NVIC at all.

    Thanks a lot,

    /WoS
    Last edited by WoS; Jul 17th, 2015 at 01:23 AM.
    The views expressed here are my personal opinions, have not been reviewed or authorized by Infineon and do not necessarily represent the views of Infineon.

  2. #2
    Beginner Beginner
    Infineon Employee
    Infineon Employee
    WoS is on a distinguished road
    Join Date
    May 2015
    Posts
    17
    Points
    137.5
    I think I discovered an other bug in the XMC lib?

    In my above example, EXS2B of ERU0/EXISEL should be set to one after calling "XMC_ERU_ETL_Init(ERU0_ETL2, &p2_11_int_event_generator_config)". So the register 0x40010600 should countain the value 0x00000400. I overlooked it during debugging, just saw it sets it to 0x00000100 instead (which enables wrongly 2A1).

    When I set it manually (by using ".input = XMC_ERU_ETL_INPUT_B1<<2," in the const structure), the example works...
    Last edited by WoS; Jul 17th, 2015 at 01:48 AM.
    The views expressed here are my personal opinions, have not been reviewed or authorized by Infineon and do not necessarily represent the views of Infineon.

  3. #3
    chismo is on a distinguished road
    Join Date
    Apr 2013
    Posts
    267
    Points
    2451.25
    Hello,

    The data type "input" by default selects the A set of inputs.
    To select a B input, the data type "input_b" has to be used instead.
    I think your code will work with the following:

    .input_b = XMC_ERU_ETL_INPUT_B1,

    In general, I would suggest to always use the data types "input_a" and/or "input_b" for the ERU.

    Regards,
    Min Wei

+ Reply to Thread

Tags for this Thread

Disclaimer

All content and materials on this site are provided “as is“. Infineon makes no warranties or representations with regard to this content and these materials of any kind, whether express or implied, including without limitation, warranties or representations of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. No license, whether express or implied, is granted by Infineon. Use of the information on this site may require a license from a third party, or a license from Infineon.


Infineon accepts no liability for the content and materials on this site being accurate, complete or up- to-date or for the contents of external links. Infineon distances itself expressly from the contents of the linked pages, over the structure of which Infineon has no control.


Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Usage Terms of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Usage Terms of this site. Infineon reserves the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.