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

AURIX™ Forum Discussions

Not applicable
I am new to DSP. I have looked through the BaseFramework TC21x Demos supported by infineon, and have found some defined functions that refer to External Request Unit.
But I don't know what processes should I do to complete an external interrupt triggered by rising edge?
How could I define an external interrupt and then enter the interrupt service function?
0 Likes
3 Replies
User13290
Level 5
Level 5
First solution authored
Hi Li,

lidalaw168 wrote:
I am new to DSP. I have looked through the BaseFramework TC21x Demos supported by infineon, and have found some defined functions that refer to External Request Unit.
But I don't know what processes should I do to complete an external interrupt triggered by rising edge?
How could I define an external interrupt and then enter the interrupt service function?


Have you tried the ScuEruDemo that is included in the iLLD demos? The documentation of this example says that Infineon tested it on a TC29x device using their TriBoard. It interrupts on every rising edge of port pin P20_0.

Since you are new to AURIX it might be advisory to studie chapters 16.8.4 (external interrupts) and 8.4.1 (External Request Unit) of the TC21x/TC22x/TC23x family manual. These discuss your specific derivative in detail. In addition you may also need to study the TC Architecture Manual Volume 1. Its chapter 5 discusses the foundations of the interrupt system.

Note that the above ScuEruDemo needs to be build in conjunction with the iLLD library which, like the demo itself, must be ascertained from your MyICP portal. If you wish to integrate the example into our IDE then I recommend this application note which explains it step-by-step.

Best regards,


Henk-Piet Glas
Principal Technical Specialist
0 Likes
cwunder
Employee
Employee
50 solutions authored 250 sign-ins 25 likes received
what processes should I do to complete an external interrupt triggered by rising edge?
How could I define an external interrupt and then enter the interrupt service function?


If you use the Bifaces or Frameworks then you can add this extremely simplistic code example to build upon. Note the pin you choose must be available for selection, in the code example P10.7 was used on the TC277.


volatile uint32_t eru0_cnt;

void SCU_SRC0(void) {
eru0_cnt++;
}

void ERU_Init(void) {
/*configure P10.7 REQ4/ERS0 */
Ifx_SCU_EICR eicr0 = {
.B.EXIS0 = EXISn_Input_2, /* 2 */
.B.FEN0 = FENn_Disabled, /* 0 */
.B.REN0 = RENn_Enabled, /* 1 */
.B.LDEN0 = LDENn_WillNotBeCleared, /* 0 */
.B.EIEN0 = EIENn_TriggerIsEnabled, /* 1 */
.B.INP0 = INPn_TriggerOGU_0, /* 0 */
/* not using the other half of EICR0 */
};
SCU_EICR0.U = eicr0.U;

/*configure Flag Gating Register 0 */
Ifx_SCU_IGCR igcr0 = {
.B.IPEN00 = IPENxy_BitDoesNotTakePartInPatternDetection, /* 0 */
.B.IPEN01 = IPENxy_BitDoesNotTakePartInPatternDetection, /* 0 */
.B.IPEN02 = IPENxy_BitDoesNotTakePartInPatternDetection, /* 0 */
.B.IPEN03 = IPENxy_BitDoesNotTakePartInPatternDetection, /* 0 */
.B.IPEN04 = IPENxy_BitDoesNotTakePartInPatternDetection, /* 0 */
.B.IPEN05 = IPENxy_BitDoesNotTakePartInPatternDetection, /* 0 */
.B.IPEN06 = IPENxy_BitDoesNotTakePartInPatternDetection, /* 0 */
.B.IPEN07 = IPENxy_BitDoesNotTakePartInPatternDetection, /* 0 */
.B.GEEN0 = GEENn_PatternDetectionTriggerDisabled, /* 0 */
.B.IGP0 = IPGn_ActivatedOnTrggerPatternNotConsidered, /* 1 */
/* not using the other half of IGCR */
};
SCU_IGCR0.U = igcr0.U;

/* create entry in the desired CPU vector table */
IFX_INTERRUPT(SCU_SRC0, CPU0, 1);
/* configure the ERU0 SRC register for CPU0, IRQ level 1 */
SRC_SCUERU0.U = (0 << TOS) | (1 << SRE) | 1;
}
0 Likes
teoBits
Employee
Employee
100 replies posted 50 replies posted 25 replies posted
Hello lidalaw168,

You can also find a code example project for the External Request Unit (which shows how to setup an external interrupt triggered by a rising edge) here: ERU training code example.
this example also comes with a tutorial, which can be found here: ERU tutorial.

If you are interested in other modules and you want to start programming for AURIX™, you can get the new Integrated Development Environment (IDE) here: AURIX™ Development Studio and get inspired by numerous trainings from here: AURIX™ Trainings.

If you are not familiar with Eclipse based IDE’s checkout the Getting Started guide!

Hope it helps,
teoBits
0 Likes