Problems with HRPWM module on XMC4400

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

cross mob
Not applicable
Hi,

I'm trying to use the HRPWM module on XMC4400. I'm using XMC Lib in Keil, and there are two examples provided by infineon but they won't work. Through debugging I find that the initialization function provided by XMC Lib is not executing correctly.


hrpwm->HRCCFG |= (clkc << HRPWM0_HRCCFG_CLKC_Pos);

hrpwm->HRCCFG |= HRPWM0_HRCCFG_HRCPM_Msk; /* Release HR generation from power down mode */

XMC_HRPWM_lDelay(); /* As per Initialization sequence */

/* Enable global high resolution generation / Force charge pump down */
hrpwm->GLBANA |= HRPWM0_GLBANA_GHREN_Msk;

XMC_HRPWM_lDelay();

/* Check High resolution ready bit field */
if ((hrpwm->HRGHRS & HRPWM0_HRGHRS_HRGR_Msk) == 1U)
{
/* High resolution logic unit is ready */
status = XMC_HRPWM_STATUS_OK;
}

The first two line can execute correctly, however,

hrpwm->GLBANA |= HRPWM0_GLBANA_GHREN_Msk;

This line is not able to set the GLBANA.GHREN to 1, the bit stays 0 after the statement. And following this, HRGHRS.HRGR won't become 1.
I'm wondering if this is a hardware issue?

Thanks,
Fan
0 Likes
4 Replies
Not applicable
Update:
I tried DAVE 4 instead and it's working now.
However, if I use DAVE 4 to create a Keil project for the same project, build it and download through Keil without any modification, it still doesn't work.
Maybe there's a problem with Keil?
0 Likes
Not applicable
Dear yifan,

have you found out why GHREN is not set using keil ? Or do you still use Dave ?

It is because i have to implement a dual LLC Converter and the PWM is actually located at the HRPWM Output Pins even if the CCU8 output would fit and I have to use the HRPWM which is actually not willing to play...
First I thought it is only a problem of understanding the 400 pages of the manual in short time, but reading your thread and debugging my code shows the same behavior - the GHREN is nit set with the IFX Code nor if i manually write to the Address 0x40020914 where GLBANA is located.

I did some tests and modified the XMC_HRPWM_EnableGlobalHR(HRPWM0); function as follows to my code :
{
volatile uint32_t i;

// wait for GLBANA.GHREN is really set
while( (HRPWM0->GLBANA & (uint32_t)HRPWM0_GLBANA_GHREN_Msk) == 0U)
{
HRPWM0->GLBANA |= (uint32_t)HRPWM0_GLBANA_GHREN_Msk; // HRPWM0 start @ Address 0x40020900 and GLBANA @ Address 0x40020914

for (i = 0U; i <= 28800U; i++) // Wait more than 2 microseconds
{
__NOP();
}
}
}

The while() is never escaped in this example above but when I changed the Mask to stupidly writing 0xFFFFFFFF to the GLBANA register I saw it twice, that some time later the GLBANA was modified to 0x00044A4E.
Seems absolutely strange to me ?

Couldn't really be that the code is only running on DAVE ??? THis sounds absolutely strange to me. Maybe it is an issue with the JTAG ? I use a j-link plus from Segger.

Thanks for your feedback & regards,
Marcus
0 Likes
Not applicable
Hi again,

I did some tests and modified the XMC_HRPWM_EnableGlobalHR(HRPWM0); function as follows to my code :
{
volatile uint32_t i;

// wait for GLBANA.GHREN is really set
while( (HRPWM0->GLBANA & (uint32_t)HRPWM0_GLBANA_GHREN_Msk) == 0U)
{
HRPWM0->GLBANA |= (uint32_t)HRPWM0_GLBANA_GHREN_Msk; // HRPWM0 start @ Address 0x40020900 and GLBANA @ Address 0x40020914

for (i = 0U; i <= 28800U; i++) // Wait more than 2 microseconds
{
__NOP();
}
}
}

The while() is never escaped in this example above but when I changed the Mask to stupidly writing 0xFFFFFFFF to the GLBANA register I saw it twice, that some time later the GLBANA was modified to 0x00044A4E.
Seems absolutely strange to me ?
0 Likes
Not applicable
Dear yifan,

have you found out why GLBANA.GHREN is not set using Keil µVision, or do you completely changed using Dave ?

It is because i have to implement a dual LLC Converter and the PWM is actually located at the HRPWM Output Pins even
if the CCU8 output would fit and I have to use the HRPWM which is actually not willing to play...

First I thought it is only a problem of understanding the 400 pages of the related chapter from the manual in a short time,
but reading your thread and debugging my code shows the same behavior - the GHREN is not set with the IFX Code nor if i manually
write to the Address 0x40020914 where GLBANA is located.

Couldn't really be that the code is only running on DAVE ???

But changing the code the following way first calling the init solved the problem of GLBANA being not set (but I actually have even no PWM output):


// init HRPWM0
if(XMC_HRPWM_Init(HRPWM0) != XMC_HRPWM_STATUS_OK)
{
// seems to be failed ?
retval = RET_NOK;
}
else
{
// enable HRPWM globally and force charge pump down
XMC_HRPWM_EnableGlobalHR(HRPWM0);

// initialize HRC Unit ...





Thanks for your feedback & regards,
Marcus
0 Likes