Stopping slice timer via an event

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

cross mob
User15071
Level 1
Level 1
Hello,

I am using a XMC4400 microcontroller.
I have an ADC that triggers an interrupt once the measured value is out of bounds, and a DMA line that copies the
measurement result to SRAM. However, I would like to stop a timer slice as well without software intervention
and without an external pin. The user manual specifies that a timer can be stopped using an external event (pin toggle) or software, but I
don't have the time to do it in the DMA ISR - literally every microsecond counts so I must find a way to make the hardware stop the timer for me
once the ADC out of bounds event takes place and _before_ the ISR is resolved and invoked.
Is that possible? If so - how?

Thanks in advance,

Tamir Michael
0 Likes
6 Replies
DRubeša
Employee
Employee
First solution authored First like received
Hi,

so just an idea how it can be done:
For this example I used ADC_MEASUREMENT_ADV and CCU4_SLICE_CONFIG APPs for the proof of concept. Inside of the ADC_MEASUREMENT_ADV APP I set under the "Boundary Settings" tab following settings:

3228.attach

(your requirements may vary but you get the idea). Then open the CCU4_SLICE_CONFIG APP and under "Function Settings" tab select following settings:

3229.attach

(again correct setting I´ll leave to you...maybe you want only rising edge or you also want to clear the timer not only stop it....play a bit with the options). So currently we have set a generation of boundary flag in case we are out of boundary and we also defined that timer should be stopped in case of event 0. What we need to do at the end is to assign boundary flag as an input event 0 to timer. We do this by selecting "HW Signal Connections..." under "DAVE" menu. There make sure you have the following connection established:

3230.attach

Under "HW Signal Connectivity" you will something similar to this:

3231.attach

And that should be it...of course you need to configure all other parameters of ADC and Timer but a functionality that you were interested in should be done like this.

Best regards,
Deni
0 Likes
User15071
Level 1
Level 1
Hi,

Thanks for your reply.
I forgot to mention that I do not use Dave here - but the XMC4000 peripheral library instead.
Can you please clarify how the very last step (i.e. connecting the boundary condition to the event) can be achieved using the library?
The API of the library suggests that an external pin is needed, but maybe there is a pin that can be used for this purpose?

Thanks in advance.
0 Likes
User15071
Level 1
Level 1
Found this in AP32305:

"6.2.4 Boundary Flag Events in XMC4400, 4200 and 4100 Devices
XMC4400, 4200 and 4100 devices are able to generate events after a change in a boundary flag. For more
details, see 7.4 Boundary Flags.
To generate and handle an event provoked by a boundary flag change:
1. Enable and configure the comparison mode (Fast Compare Mode or Limit Checker) and its respective
boundary flag. (See Use Cases Comparator)
2. Select a service request line in the respective Boundary Flag Node Pointer bitfield (BFLyNP) of the
Boundary Flag Node Pointer Register (GxBFLNP).
3. Enable the Interrupt, DMA transfer or Peripheral action for the service request line selected"

Still, any further advise will be much appreciated.
0 Likes
User15071
Level 1
Level 1
This is a lot more relevant, actually:

VADC.G0BFLOUT0 O VADC.G1REQGTK
VADC.BGREQGTK
CCU41.IN0L
CCU80.IN0I
CCU43.IN0H

looks like CCU80 can then use external input I to trigger an event to stop the timer.
0 Likes
DRubeša
Employee
Employee
First solution authored First like received
Hi,

so the last part of the connection between two modules is directly linked to your last post that is a section from a 17.14 Interconnects sub chapter in the User Manual (if everyone is wondering). With the first figure I initialized the Boundary Flag interrupt generation and with second one I defined input to a Timer module that should stop the timer. However, I haven´t define the "real", hardware connection between these two modules. This was done with the ""HW Signal Connections..." menu. DAVE solver "knows" all the possible inputs and output of a module and connects them together based on the connection diagrams such as one that you posted above. Due to the fact that you posted the Boundary flag 0 output of group 0, I defined the same group so I can get the following settings (additionally, I use CCU4 so I can either use CCU41.IN0L or CCU43.IN0H as inputs). Finally, a configuration and XMCLib code should look like this (I´m showing here Timer module part while you mentioned that you already have ADC module set and working).

3233.attach

(here you can see that I´m using CCU43 slice)

3234.attach

(notice .mapped_input member where input H is selected, if you check your post one more time you will see that CCU43.IN0H directly correlates to my configuration; other options may be different in your case (active level and edge))

3235.attach

(now define previously configured event)

3236.attach

(with this XMCLib function call you define the connection between event (in our case 0) and what should happen with the "stop" functionality)

And that´s it...if you set the ADC boundary flag interrupt generation for the group 0 properly, you should be fine.

Best regards,
Deni
0 Likes
User15071
Level 1
Level 1
Hi,

Thank you.
Infineon tech support suggested using, among others,

VADC.G2SR3 O NVIC, Service request 3 of group 2
GPDMA
CCU81.IN2J

I totally missed that in the user manual !

Thanks again.
0 Likes