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

cross mob
User2235
Level 3
Level 3
When the Infineon will release Dave3 Apps for the HRPWM module?
0 Likes
13 Replies
Not applicable
Hi Amsantos,

Thank you very much for the interest. This was planned and we will info you if any update.

Best regards,
Sophia
0 Likes
Not applicable
Hi Sophia,

I also take very much interest in this peripheral. Maybe there is some "non-Dave3" example code already available ?!

Best regards
Uwe
0 Likes
sich_4729076
Employee
Employee
Hi UHeller,

I have the basic initialisation code on the CSG0 for the HRPWM module. For the HRC part, I am still working on it.

void CSG_Init(void)
{

//remove the HRPWM from reset -> SCU
SCU_RESET->PRCLR0 |= 0x00800000;
SCU_CLK->CLKSET |= SCU_CLK_CLKSET_CCUCEN_Msk;
SCU_CLK->CGATCLR0 |= 0x00800085;//HRPWM+CCU8+CCU4+VADC

HRPWM0->HRBSC |= 0x100;
HRPWM0->CSGCFG |= 0x03;

HRPWM0_CSG0->DSV2 = 0x220;
//DSV1 shadow register
HRPWM0_CSG0 ->SDSV1 = 0x220;

// Pulse Swallow shadow register
HRPWM0_CSG0 ->SPC = 0;

//Shadow transfer
HRPWM0->CSGTRG |= 0x01;


HRPWM0->HRCCFG |= 0x020000; // CLKC, module clock frequency is set to 120MHz

HRPWM0->CSGCLRG |= 0x004;

HRPWM0->CSGSETG |= 0x001; // set DAC run bit

HRPWM0->CSGSETG |= 0x002; // set comparator run bit

}
0 Likes
Not applicable
Hi CheongSL,

back from holidays I immediately took the init to my code right after DAVE3_Init. But unfortunately it doesn't seem to work. RESET, CLKSET and CGATCLR0 registers are modified according to code but after that none of the HRPWM0-registers get the values written to them. All registers remain 0.

Any idea ?

Greets
Uwe
0 Likes
sich_4729076
Employee
Employee
Hi Uwe,

What is the value writen to the SCU_CLK->CGATCLR0 register? Clock gating for both CCU8 and HRPWM0 must be disabled.

Best regards,
Siew Lee
0 Likes
Not applicable
Hi Siew Lee,

I just copied the code you provided to my project and called the CSG_Init() rifgt after DAVE_Init(). Stepping through your init routine you can see the first three statements charging the values of the written registers but the no changes in HRPWM->* registers are visible while stepping further on.

I found in the manual the note that between SCU-registers and HRPWM-registers there should be

5th Step: Write 0x00004A4E to the GLBANA register. (xmc4400: v.11, page 22-127)

Maybe you did that outside of the init-routine.

Best regards
Uwe
0 Likes
lock attach
Attachments are accessible only for community members.
sich_4729076
Employee
Employee
Hi Uwe,

The reset for the CCU8 module also need to be de-assert. The setting for the register should be SCU_RESET->PRCLR0 |= 0x00800080. Setting of register GLBANA is not required if only CSG module is used.

I have attached my project file for your reference.

Best regards,
Siew Lee
0 Likes
Not applicable
Hi Siew Lee,

thanks for the quick answer. Indeed the additional writing of GLBANA does not change anything.

In your first example you proposed to de-assert HRPWM, CCU8, CCU4 and VADC with
SCU_CLK->CGATCLR0 |= 0x00800085;//HRPWM+CCU8+CCU4+VADC


With
SCU_RESET->PRCLR0 |= 0x00800080

as you propose now you just skip the de-assertion of CCU4 and VADC.
CCU8 was de-asserted in both examples, so nothing addition was made active here but some peripherals are missing now.

I will test it Sunday evening since I'm on leave for the weekend.
Best Regards
Uwe
0 Likes
Not applicable
Hi Siew,

sorry, I mixed up de-assert and clock gating. I tested it and the init works well now. I can see all set values in the HRPWM0-registers.

How can I set a duty cycle now and how can I get the signal out of a pin now ?

Best regards
Uwe
0 Likes
Not applicable
Hi Uwe,

I'm thinking that you should be able to set a duty cycle by writing to CC8yCR since it is using CCU8 modules. Why not to have a try?

Best regards,
Zain
0 Likes
sich_4729076
Employee
Employee
Hi Uwe,

You could connect the CSG to CCU8 module. Refer to attach image for the connections.
In DAVE3, add the PWMSP002 app, and connect the CSG output to CCU8 event. Please refer to the XMC44 reference manual, CCU8 Interconnect chapter for the connections.


301.attach

Example to connect CSG0 output to CCU80 slice 3 event1. This event1 will start the CCU8 timer.

WR_REG(PWMSP002_Handle0.CC8yRegsPtr->INS, CCU8_CC8_INS_EV1IS_Msk, CCU8_CC8_INS_EV1IS_Pos, CCU8xINyP);
WR_REG(PWMSP002_Handle0.CC8yRegsPtr->INS, CCU8_CC8_INS_EV1EM_Msk, CCU8_CC8_INS_EV1EM_Pos, 1);

WR_REG(PWMSP002_Handle0.CC8yRegsPtr->CMC, CCU8_CC8_CMC_STRTS_Msk, CCU8_CC8_CMC_STRTS_Pos, CCU8PWMLIB_EVENT_1);


Best regards,
Siew Lee
0 Likes
sich_4729076
Employee
Employee
Hi,

FYI, I have uploaded the HRPWM example project in this thread: http://www.infineonforums.com/threads/929-HRPWM-device-guide-with-examples.

Best regards,
Siew Lee
0 Likes
P__Yélamos
Employee
Employee
10 sign-ins First like given 5 sign-ins
Hello,

in latest update of Dave Apps, HRPWM Apps are inlcuded. Hope this helps!

BR
Pablo
0 Likes