Announcements

Ever wondered how you could shape the future in collaboration with others? Join us at OktoberTech Asia Pacific and get inspired. Click here to sign up FREE of charge.

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

XMC™ Forum Discussions

atvmainiac
Level 1
5 questions asked 10 sign-ins First solution authored
Level 1

Im attempting to use 1 GPIO to toggle on and off a CCU timer. Should i be using a generated interrupt, or should i generate an event within the CCU slice to accomplish this? i thought i could use an event like this:

" XMC_CCU4_SLICE_ConfigureEvent(CCU40_CC40, XMC_CCU4_SLICE_EVENT_0, &Timer_Start);
XMC_CCU4_SLICE_StartConfig(CCU40_CC40, XMC_CCU4_SLICE_EVENT_0, XMC_CCU4_SLICE_START_MODE_TIMER_START_CLEAR);"

 

Then i realized, without creating another event, id likely not have a way to use the END event or stop timer function. Can someone advise?

(My goal is to put as much of this on the hardware to eliminate having to use SW to achieve my goal, any advice is appreciated)

I know i can accomplish this task by generating an interrupt via the ERU and button, but was unsure if there is another way. Can events only start/stop its action, or can they be used to toggle? i didnt see a toggle function in the CCU4.h library. 

 

 

 

*SIDE NOTE: I had asked an admin if the PDOut flag on the ERU is sticky, This flag can be cleared in the bits by hardware, or if you set it as sticky during the ERU setup, you can clear this bit with the XMC_ERU_ETL_ClearStatusFlag(ERU0_ETLx); function. Thought i would share that if anyone has tried to use the PDOut on the ERU as a Periph trigger. caught me up for about 30 mintues last night.

 

 

0 Likes
1 Solution
ncbs
Moderator
Moderator 50 likes received 250 sign-ins 250 replies posted
Moderator

Hi @atvmainiac,

1. Have the following connections: DIGITAL_IO -> EVENT_DETECTOR -> EVENT_GENERATOR -> INTERRUPT. The IO pin is configured as an input pin. Then, configure the EVENT_DETECTOR to detect the edge of your choice. When the active edge occurs, then a trigger will be generated. EVENT_GENERATOR will detect this trigger through its "trigger_in" input. An interrupt will be generated and INTERRUPT will force the control to the ISR. You may start or stop the CCU4 timer by using the "XMC_CCU4_SLICE_StartTimer" and "XMC_CCU4_SLICE_StopTimer" APIs respectively.

ncbs_1-1656568723381.png

 

2. A DIGITAL_IO pin can be connected to "in0" (or any one of the input pins). Consider in0 for explanation purposes. In the "Function Settings", select "Event0" which corresponds to in0 and configure the edge selection and level selection as per your choice. Choose "Triggered by Event 0" for "Count function" to control the CCU4 slice.

ncbs_0-1656568234723.png

 

I hope you meant to start and stop the CCU4 slice when you referred to this:"Can events only start/stop its action, or can they be used to toggle? i didnt see a toggle function in the CCU4.h library".

Let me know if this helps you.

Regards,
Nikhil

 

View solution in original post

0 Likes
1 Reply
ncbs
Moderator
Moderator 50 likes received 250 sign-ins 250 replies posted
Moderator

Hi @atvmainiac,

1. Have the following connections: DIGITAL_IO -> EVENT_DETECTOR -> EVENT_GENERATOR -> INTERRUPT. The IO pin is configured as an input pin. Then, configure the EVENT_DETECTOR to detect the edge of your choice. When the active edge occurs, then a trigger will be generated. EVENT_GENERATOR will detect this trigger through its "trigger_in" input. An interrupt will be generated and INTERRUPT will force the control to the ISR. You may start or stop the CCU4 timer by using the "XMC_CCU4_SLICE_StartTimer" and "XMC_CCU4_SLICE_StopTimer" APIs respectively.

ncbs_1-1656568723381.png

 

2. A DIGITAL_IO pin can be connected to "in0" (or any one of the input pins). Consider in0 for explanation purposes. In the "Function Settings", select "Event0" which corresponds to in0 and configure the edge selection and level selection as per your choice. Choose "Triggered by Event 0" for "Count function" to control the CCU4 slice.

ncbs_0-1656568234723.png

 

I hope you meant to start and stop the CCU4 slice when you referred to this:"Can events only start/stop its action, or can they be used to toggle? i didnt see a toggle function in the CCU4.h library".

Let me know if this helps you.

Regards,
Nikhil

 

0 Likes