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

XMC™ Forum Discussions

jbakerLS
Level 1
Level 1
5 questions asked 5 replies posted 5 sign-ins

I'm working with the boot kit for the XMC1404 series, "XMC1400 BOOT Kit" to test out the CCU4 to create a 20 KHz output. I found a few examples on how to do this, and was able to successfully get it to work on XMC1400_CCU4_Single_PWM.

In this example it sets up the CCU4 using Module Instance 0 and Timer Slice Instance 0 to control the P4_0 LED.

Then I decided prior to getting custom hardware for the product I'm working on, I'd move the PWM signal over to the desired Output, which is P3_3. This is where I ran into some problems.

It seems to me the Timer is not running, and that is causing no interrupts or output changes.

According to the reference manual, P0_9 can be set as alternate function for CC40_OUT3 and CC41_OUT3. I've been able to get the timer to work with CC40_OUT3, which is XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT4.

Switching over to using CC41_OUT3 (XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT9) for P0_9 I cannot get the timer to run at all.

I'll attach the source code that modified the example below with a few compile switches that I've been enabling and disabling to try to get past this issue.

If there is some reason why P3_3 can't be used in this way that I haven't seen in the Reference manual, that would be helpful information as well.

Additionally, the XMC Peripheral Driver Library  version I'm using is XMClib v2.1.6. I'm not sure if there is a higher version that is supported by the XMC1400 series.

Thanks,

Jason

 

0 Likes
1 Solution
Andrew
Level 2
Level 2
5 replies posted 5 sign-ins First solution authored

You seem to be running the CCU in monoshot mode, and then restart the timer in an ISR. That seems a bit convoluted to me?

Your interrupt is likely not being run. See section "5.1.2 Interrupt Node Assignment" of the reference manual. Likely you need to add the following line to make it work:

XMC_SCU_SetInterruptControl(IRQ24_IRQn, XMC_SCU_IRQCTRL_CCU41_SR3_IRQ24);

 

View solution in original post

0 Likes
7 Replies
Andrew
Level 2
Level 2
5 replies posted 5 sign-ins First solution authored

The following line should properly set the mode of P3.3 to output CCU41.OUT3.

XMC_GPIO_SetMode(P3_3, (XMC_GPIO_MODE_OUTPUT_PUSH_PULL | P3_3_AF_CCU41_OUT3));

These are defined in xmc1_gpio_map.h and I find this easier to use then looking up which GPIO ALT function number to use.

Since you have been able to use P0.9 using CCU40.OUT3, I'm guessing it must be something simple. Are you sure your timer is running?

0 Likes

I'm decently confident that the Timer is running. I added data structures that point to CCU41_BASE (module_structure) and CCU41_CC43_BASE(slice_structure).

When I let the code run while it is configured for CC40_CC43, I can see that CCU41_CC43_BASE->TIMER increments up.

A few other registers also become enabled while it's running as well.

I'll link a log of these structures following configuration and after letting it run. 

At run time, my application code has changed the DR and is slowly ramping it up.

Thanks for pointing out the reference to P3_3_AF_CCU41_OUT3.

0 Likes
Andrew
Level 2
Level 2
5 replies posted 5 sign-ins First solution authored

I still believe it must be some small config detail that's preventing this from working. I am unable to download your example code - it contains just an empty file? It's difficult for me to help you further without looking at the code.

0 Likes

That's strange... sorry about that. I've double checked that this zip folder is not empty.

The project where I've been testing on has a bit of other code in it. If you'd prefer, I can put this code back into the original PWM project and zip that up instead of just the initialization.

0 Likes
Andrew
Level 2
Level 2
5 replies posted 5 sign-ins First solution authored

You seem to be running the CCU in monoshot mode, and then restart the timer in an ISR. That seems a bit convoluted to me?

Your interrupt is likely not being run. See section "5.1.2 Interrupt Node Assignment" of the reference manual. Likely you need to add the following line to make it work:

XMC_SCU_SetInterruptControl(IRQ24_IRQn, XMC_SCU_IRQCTRL_CCU41_SR3_IRQ24);

 

0 Likes

After adding the SetInterruptControl code, I've been able to get CC41.OUT3 to work on P0_9, P4_3, and P3_3 (which is the target).

I had also added modified the monoshot mode, but that doesn't seem to positively or negatively impact the output, so as you suggested I'll just set it as false (it's what was setup from the demo I found)

thanks for helping me determine the issue with this.

0 Likes

Good to hear it's working now.

If you've set the timer up in continuous running mode you should be able to remove all the code related to setting up the interrupt and handling it. Unless you still need the interrupt to do something else in your application of course.

0 Likes