Announcements

Help us improve the Power & Sensing Selection Guide. Share feedback

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

cross mob
User10505
Level 1
Level 1
Hi,

here I have an 16bit Timer.
Now to my question, is it possible to make a software interrupt in the function "CCU40_0_IRQHandler"? And have you an idea or have you an example without Apps (e.g. CMSIS) ?
The idea is an second timer wich is synchron to the CCU40_0_IRQHandler...


XMC_CCU4_SLICE_COMPARE_CONFIG_t timer_config_ccu40 = {
.timer_mode = XMC_CCU4_SLICE_TIMER_COUNT_MODE_EA,
.monoshot = XMC_CCU4_SLICE_TIMER_REPEAT_MODE_REPEAT,
.prescaler_initval = 0, };


/** 16 Bit Timer **/

XMC_CCU4_Init(CCU40, XMC_CCU4_SLICE_MCMS_ACTION_TRANSFER_PR_CR);
XMC_CCU4_SLICE_CompareInit(CCU40_CC40, &timer_config_ccu40);
XMC_CCU4_SLICE_SetTimerPeriodMatch(CCU40_CC40, 0x2328);

XMC_CCU4_SLICE_EnableEvent(CCU40_CC40, XMC_CCU4_SLICE_IRQ_ID_PERIOD_MATCH);
XMC_CCU4_SLICE_SetInterruptNode(CCU40_CC40, XMC_CCU4_SLICE_IRQ_ID_PERIOD_MATCH, 0);
NVIC_SetPriority(CCU40_0_IRQn, 2);
NVIC_EnableIRQ(CCU40_0_IRQn);
XMC_CCU4_StartPrescaler(CCU40);
XMC_CCU4_EnableShadowTransfer(CCU40, XMC_CCU4_SHADOW_TRANSFER_SLICE_0);

XMC_CCU4_EnableClock(CCU40, 0);
XMC_CCU4_SLICE_StartTimer(CCU40_CC40);


void CCU40_0_IRQHandler(void)
{
#if 0
if((CCU40_CC40->INTS)&0x00000001)
{

}
#endif

-->>>> (Software) Interrupt ??? <<<<<--

CCU40_CC40->SWR |= 0x00000001;
}



Thanks...
0 Likes
8 Replies
Travis
Employee
Employee
First solution authored Welcome! 500 replies posted
Hi,

So sorry I really do not understand your intention. Can you please be a bit more specific? Do you mean that you want to re trigger the CCU again with this existing interrupt handler or you want to do a nested interrupt?
0 Likes
User10505
Level 1
Level 1
Hi,

First I´m sorry.
I would like to have a nested interrupt wich is triggert after 10 invocations from the existing interrupt handler.
Maybe I need the NVIC but I don´t have any experiance with it and how I triggert die NVIC by software command.

Thanks.
0 Likes
Not applicable
It would be better if you can explain your application so that we can sort it out for you.
0 Likes
Travis
Employee
Employee
First solution authored Welcome! 500 replies posted
MaJa wrote:
Hi,

First I´m sorry.
I would like to have a nested interrupt wich is triggert after 10 invocations from the existing interrupt handler.
Maybe I need the NVIC but I don´t have any experiance with it and how I triggert die NVIC by software command.

Thanks.


Totally do not understand your needs.
0 Likes
User10505
Level 1
Level 1
like this..
but I don´t know, is it correct ?

SCB->CCR |= 0x00000002; // Enable Software Interrupt

NVIC_SetPriority(ERU0_0_IRQn, 3);
NVIC_EnableIRQ(ERU0_0_IRQn);


and in the ire_handler


void CCU40_0_IRQHandler(void)
{
#if 0

some code

#endif


cnt125us++;
if(cnt125us >= 10){
NVIC->STIR |= 0x01; // now ERU0_0_IRQHandler Software Interrupt
cnt125us = 0;
}

}

0 Likes
Not applicable
So in simple words you meant to call a user handler inside CCU40_0_IRQHandler ?? BTW you are just enabling ERU interrupt as per your code. ERU0_0_IRQHandler will be fired only when any event is detected on that particular pin. Again i would say if you can tell your application, we can help you.
0 Likes
User10505
Level 1
Level 1
yes thats right. Inside the CCU40_0_IRGHandler, I would like to call a user handler (software interrupt)
0 Likes
Not applicable
so you can do a simple function call in the CCU4 system handler..
0 Likes