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

cross mob
User89344
Level 1
Level 1
First question asked Welcome!

Hi,

I'd like to trigger interrupts on pins 2.1, 2.2 and 2.3 on a XMC 1300 eval board (boot kit).
The interrupts should be triggered on any edge of an external digital signal connected to the pins.
Pins 2.2 and 2.3 work, but 2.1 does not trigger any interrupt.

Is it possible at all to configure this setup and if, how?

Inside the "ERU Application Note" (V1.0, 2015-07) in section 5.3 there are only ERU0 mappings for pins 2.2 and 2.3 mentioned, however in the "Reference Manual XMC1300 AB-Step" (V1.3 2016-08) in table 23-14 there is also ERU0.1B0 mentioned for pin 2.1.
(Note that the ERU application note states pin 0.9 for ERU0.1B0 while the reference manual says 0.9 has no ERU connection at all and the ERU0.1B0 would be connected to 2.1).

I'm using the XMClib directly, i.e. without the graphical DAVE apps. So far my configuration looks like that:

/* === configuration ==== */
static const XMC_ERU_ETL_CONFIG_t eru_config_p21 =
{
     .input = (ERU0_ETL1_INPUTB_P2_1 << 2), // input seems broken for source B
     .source = XMC_ERU_ETL_SOURCE_B
     .edge_detection = XMC_ERU_ETL_EDGE_DETECTION_BOTH,
     .status_flag_mode = XMC_ERU_ETL_STATUS_FLAG_MODE_HWCTRL,
     .enable_output_trigger = true,
     .output_trigger_channel = XMC_ERU_ETL_OUTPUT_TRIGGER_CHANNEL0,
};

static const XMC_ERU_ETL_CONFIG_t eru_config_p22 =
{
    .input = (ERU0_ETL0_INPUTB_P2_2 << 2),
    .source = XMC_ERU_ETL_SOURCE_B,
    .edge_detection = XMC_ERU_ETL_EDGE_DETECTION_BOTH,
    .status_flag_mode = XMC_ERU_ETL_STATUS_FLAG_MODE_HWCTRL,
    .enable_output_trigger = true,
    .output_trigger_channel = XMC_ERU_ETL_OUTPUT_TRIGGER_CHANNEL1,
};

static const XMC_ERU_ETL_CONFIG_t eru_config_p23 =
{
    .input = (ERU0_ETL1_INPUTB_P2_3 << 2),
    .source = XMC_ERU_ETL_SOURCE_B,
    .edge_detection = XMC_ERU_ETL_EDGE_DETECTION_BOTH,
    .status_flag_mode = XMC_ERU_ETL_STATUS_FLAG_MODE_HWCTRL,
    .enable_output_trigger = true,
    .output_trigger_channel = XMC_ERU_ETL_OUTPUT_TRIGGER_CHANNEL2,
};

static const XMC_ERU_OGU_CONFIG_t eru_ogu_config = 
{
    .enable_pattern_detection = false,
    .peripheral_trigger = XMC_ERU_OGU_PERIPHERAL_TRIGGER2,
    .service_request = XMC_ERU_OGU_SERVICE_REQUEST_ON_TRIGGER,
};

/* === ISR === */
static void ERU0_0_IRQHandler(void)
{ // not executed
...
}

static void ERU0_0_IRQHandler(void)
{ // executed
...
}

static void ERU0_0_IRQHandler(void)
{ // executed
...
}

/* === Initialization === */
void eru_init(void)
{
	XMC_ERU_ETL_Init(ERU0_ETL1, &eru_config_p21);
	XMC_ERU_ETL_Init(ERU0_ETL0, &eru_config_p22);
	XMC_ERU_ETL_Init(ERU0_ETL1, &eru_config_p23);
	
	XMC_ERU_OGU_Init(ERU0_OGU1, &eru_ogu_config);
	XMC_ERU_OGU_Init(ERU0_OGU2, &eru_ogu_config);
	XMC_ERU_OGU_Init(ERU0_OGU3, &eru_ogu_config);
	
	NVIC_SetPriority(ERU0_0_IRQn, (3U));
	NVIC_SetPriority(ERU0_1_IRQn, (3U));
	NVIC_SetPriority(ERU0_2_IRQn, (3U));
	
	NVIC_EnableIRQ(ERU0_0_IRQn);
	NVIC_EnableIRQ(ERU0_1_IRQn);
	NVIC_EnableIRQ(ERU0_2_IRQn);
	
	XMC_SCU_INTERRUPT_SetEventHandler(ERU0_0_IRQn, &ERU0_0_IRQHandler);
	XMC_SCU_INTERRUPT_SetEventHandler(ERU0_1_IRQn, &ERU0_1_IRQHandler);
	XMC_SCU_INTERRUPT_SetEventHandler(ERU0_2_IRQn, &ERU0_2_IRQHandler);
}



Would be great if someone could enlighten me here! 🙂


Kind regards,
nfr

0 Likes
1 Solution
Aashita_R
Moderator
Moderator
Moderator
50 likes received 100 solutions authored 250 replies posted

Hi @funkyluke ,

Please follow XMC 1300 device datasheet for the pin mapping functionalities. You can refer page no. 29 of the same for the PORT I/O functions to check for the connection of pins 2.1, 0.9 with the ERU module. 

Also, I tried to trigger interrupts on pin P2.1 i.e. ERU0.1B0. I tried changing the source for input trigger and and initializing the correct ERU and ETL module. I have implemented the code mentioned under the section "XMC lib implementation" on the page 15 of ERU Application note and the LED toggles on the failing edge of the signal provided at P2.1.

Aashita_Raj_0-1659500595529.png

Can you please try checking the register values of inside the XMC_ERU_ETL_Init() API so that the values being set are correct or not?


Best Regards,

Aashita

 

 

 

View solution in original post

0 Likes
3 Replies
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

Hi,

Please see one ERU based code example for reference.

/*
 * Copyright (C) 2014 Infineon Technologies AG. All rights reserved.
 *
 * Infineon Technologies AG (Infineon) is supplying this software for use with
 * Infineon's microcontrollers.
 * This file can be freely distributed within development tools that are
 * supporting such microcontrollers.
 *
 * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
 * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
 * INFINEON SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL,
 * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
 *
 */

/**
 * @file
 * @date 04 Dec, 2014
 * @version 1.0.0
 *
 * @brief External interrupt using ERU
 *
 * The user can switch on/off the LED connected to (P0.0) of bootkit board using the potentiometer.
 *
 * History <br>
 *
 * Version 1.0.0 Initial <br>
 *
 */


#include <xmc_gpio.h>
#include <xmc_eru.h>

#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 */
  }
}

 Best Regards,
Vasanth 

0 Likes
funkyluke
Level 2
Level 2
5 sign-ins First like received 10 replies posted

Hello nfr,

could it be that you use Pin 2.1 as SDO/TDO, maybe because your debugger requests it?? 

In that case it might be disconnected from the ERU and connected to HWO. 

Regards,
funkyluke

0 Likes
Aashita_R
Moderator
Moderator
Moderator
50 likes received 100 solutions authored 250 replies posted

Hi @funkyluke ,

Please follow XMC 1300 device datasheet for the pin mapping functionalities. You can refer page no. 29 of the same for the PORT I/O functions to check for the connection of pins 2.1, 0.9 with the ERU module. 

Also, I tried to trigger interrupts on pin P2.1 i.e. ERU0.1B0. I tried changing the source for input trigger and and initializing the correct ERU and ETL module. I have implemented the code mentioned under the section "XMC lib implementation" on the page 15 of ERU Application note and the LED toggles on the failing edge of the signal provided at P2.1.

Aashita_Raj_0-1659500595529.png

Can you please try checking the register values of inside the XMC_ERU_ETL_Init() API so that the values being set are correct or not?


Best Regards,

Aashita

 

 

 

0 Likes