how PWM output assigned for CCU4

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

cross mob
Not applicable
Hi,

I've created a simple PWM app with my DAVE4 and the app is working on my eval board (XMC1100 boot kit).

When I debug the program I can't find how the output pin assigned to CCU4.
I've seen some register settings while debugging which are set up the PWM modul.
I've also seen that the output pin configured. (previously I have changed the PinMapping)
But how the CCU4 modul know which output pin have to drive? For example how CCU4 know that it should drive P1.3?
0 Likes
3 Replies
User10215
Level 4
Level 4
First like received
Hi j,

I'm using a XMC4500 but I guess the Apps are the same. I suppose in the App-configuration you clicked on the Output-enable in the Pin-Settings-tab of the App. Now you can right click on the App and choose "Manual Pin Allocator". In this you can choose a Pin of your liking. Also, if you right-click on the App and choose "Manual Resource Assignment" you can manualy choose the CCU4 channel. Be aware, that the options for the Pins you can choose depend on the selected CCU4-channel and vice versa.

If you don't choose a Pin and CCU4-channel by yourself, DAVE just configures the one it likes. You can see which hardware-options DAVE selected by clicking on the "Report"-button in the same line you find the "Build"-button.

Best regards,
Niclas
0 Likes
Not applicable
Niclas wrote:
Hi j,

I'm using a XMC4500 but I guess the Apps are the same. I suppose in the App-configuration you clicked on the Output-enable in the Pin-Settings-tab of the App. Now you can right click on the App and choose "Manual Pin Allocator". In this you can choose a Pin of your liking. Also, if you right-click on the App and choose "Manual Resource Assignment" you can manualy choose the CCU4 channel. Be aware, that the options for the Pins you can choose depend on the selected CCU4-channel and vice versa.

If you don't choose a Pin and CCU4-channel by yourself, DAVE just configures the one it likes. You can see which hardware-options DAVE selected by clicking on the "Report"-button in the same line you find the "Build"-button.

Best regards,
Niclas



This is my simple program which works on XMC1100 and bkinks P1.3 (based on the generated DAVE code)
How CCU40 notified that it should drive P1.3?



#include

#include "XMC1100.h"
#include "GPIO.h"

int main(void)
{
XMC_SCU_UnlockProtectedBits();
SCU_CLK->CGATCLR0 |= SCU_CLK_CGATSTAT0_CCU40_Msk;
XMC_SCU_LockProtectedBits();

//CCU40->GCTRL = ;
CCU40->GIDLC |= CCU4_GIDLC_SPRB_Msk;
CCU40_CC43->PSC = 10;
CCU40_CC43->PRS = 0x8000;
CCU40_CC43->CRS = 0x4000;
CCU40->GCSS |= 0x5000;

PORT1->IOCR0 = 0x90000000;
PORT1->HWSEL = 0;
PORT1->PHCR0 = 0;
PORT1->OMR = 0;

CCU40->GIDLC |= 1 << 3; //slice3
CCU40_CC43->TCSET = CCU4_CC4_TCSET_TRBS_Msk;

while(1);
}

0 Likes
User10215
Level 4
Level 4
First like received
Hi j,

This "PORT1->IOCR0 = 0x90000000" is the part you're looking for. This tells the Pin to take on an alternate function. For this Pin with this selected alternate function it will be connected to the CCU4-channel. Have a look into the datasheet of the controller. There should be a chapter "Port I/O Function Table" where you can find which alternate function connects to which hardware for each pin.

Regards,
Niclas
0 Likes