XMC1100 Timer triggering of ADC

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

cross mob
User8683
Level 4
Level 4
First like received
Hello,

I am attempting to set up a timer to periodically trigger ADC activities. I looked for a DAVE CE example but all examples seem to use SCAN mode I have the following code, but I am not sure if more is required as I am not getting the ADC triggered.


/* Disables the clock gating for CCU4 module */
SCU_GENERAL->PASSWD = 0x000000C0U;
SET_BIT(SCU_CLK->CGATCLR0, SCU_CLK_CGATCLR0_CCU40_Pos );
SCU_GENERAL->PASSWD = 0x000000C3UL;

/* Enables the prescaler block */
SET_BIT( pCCU4Global->GIDLC, CCU4_GIDLC_SPRB_Pos );

/* Set the prescaler value */
WR_REG( pCCU4->PSC, CCU4_CC4_PSC_PSIV_Msk, CCU4_CC4_PSC_PSIV_Pos, (uint32_t)CLOCK_DIV_BY_2 );

/* Control of CCU4 timer slices */
pCCU4Global->GCTRL = (uint32_t)0;

/* Set the period of the timer */
WR_REG( pCCU4->PRS, CCU4_CC4_PRS_PRS_Msk, CCU4_CC4_PRS_PRS_Pos, (uint32_t)1000 ); // N samples per second per channel

/* Enable the synchronized transfer of the period value into the active register */
SET_BIT( pCCU4Global->GCSS, CCU4_GCSS_S0SE_Pos);

/* Set which interrupt line the timer interrupt is directed toward */
WR_REG( pCCU4->SRS, CCU4_CC4_SRS_CMSR_Msk, CCU4_CC4_SRS_CMSR_Pos, (uint32_t)0x02 ); // Service Request 2

/* Enable interrupt generation on comparison match */
SET_BIT( pCCU4->INTE, CCU4_CC4_INTE_PME_Pos );

/* Enables the timer */
SET_BIT( pCCU4Global->GIDLC, CCU4_GIDLC_CS0I_Pos );

/* Start the timer */
SET_BIT( pCCU4->TCSET, CCU4_CC4_TCSET_TRBS_Pos );


An example in some form would be good because there seems to be a lot of configuration to get right before anything will happen.

Thanks,

Jason
0 Likes
4 Replies
Not applicable
Hi Jason,

Why don't you use DAVE app for the connection?
You can easily setup all the interconnectivity within the GUI.
0 Likes
User8683
Level 4
Level 4
First like received
Jackson,

I have not seen this ability with the DAVE Apps. The CCU apps have no GUI component so are not configurable and I could see no signals in the signal view to connect to drive the ADC. If this is possible, it is not apparent with the DAVE Apps as I have tried.

Do you have a working example?

Thanks,

Jason
0 Likes
Not applicable
Hi Jason,

You have to setup using PWMSP001 app instead of the CCU global app.
After you have setup the PWMSP001 app to run at the frequency you want (you can also disable the output pin so no PWM signal is generated), then you set the PWM status signal to trigger the ADC app via signal connection.
Also at the signal connection, set the ADC gating signal to trigger select.
Then you enable the external trigger on the ADC app UI and voila.., the ADC will be triggered by CCU4.

664.attach
665.attach
0 Likes
User8683
Level 4
Level 4
First like received
This is what I needed. I would suggest a change to the documentation of the PWM apps to include these sorts of details. To me the PWM application as currently described does not seem relevant for triggering of the ADC.
0 Likes