HRPWM XMCLib configuraation API

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

cross mob
User18120
Level 1
Level 1
Dear All,

I'm working with XRPWM, using API from XMCLib to configure the unit, in particular the reset from a CCU80 slice compare, but I noticed that HRPWM is always reset by Slice 0, even if the setting points to a different slice.

After some investigation I found what I guess is an error in the XMCLib routine to configure HRPWM,
It is in routines XMC_HRPWM_HRC_ConfigSourceSelect0 and XMC_HRPWM_HRC_ConfigSourceSelect1 in file xmc_hrpwm.c.

The original routine:

/*****************************************************************************
* HRCy timer selection (HRCyTSEL)
****************************************************************************/
reg = (uint32_t)config->timer_sel;
reg |= ((uint32_t)config->src_trap_enable) << HRPWM0_HRC_TSEL_TS0E_Pos;
hrc->TSEL &= (uint32_t)0xFFFEFFF8;
hrc->TSEL |= reg;


I modified to:

/*****************************************************************************
* HRCy timer selection (HRCyTSEL)
****************************************************************************/
reg = (uint32_t)config->timer_sel << HRPWM0_HRC_TSEL_TSEL0_Pos;
reg |= ((uint32_t)config->src_trap_enable) << HRPWM0_HRC_TSEL_TS0E_Pos;
hrc->TSEL &= (uint32_t)0xFFFEFFF8;
hrc->TSEL |= reg;


(And the same for Config1.)

With this modification it is working correctly.

Please, can you confirm that my workaround is correct, and I'm not missing or overlooking something else in the code?
If this is correct, how can I fix it in the global library for any future project? At the moment I made the modification in \Libraries\XMCLib local to the project.
Thank you very much for your help!

Best regards
Simone GIli
0 Likes
2 Replies
jferreira
Employee
Employee
10 sign-ins 5 sign-ins First like received
Hi,

Thanks for reporting the issue.
We have fixed and it will be included in the next XMCLib release.

void XMC_HRPWM_HRC_ConfigSourceSelect1(XMC_HRPWM_HRC_t *const hrc, const XMC_HRPWM_HRC_SRC_CONFIG_t *const config)
{


/*****************************************************************************
* HRCy timer selection (HRCyTSEL)
****************************************************************************/
reg = (uint32_t)config->timer_sel << HRPWM0_HRC_TSEL_TSEL1_Pos;
reg |= ((uint32_t)config->src_trap_enable) << HRPWM0_HRC_TSEL_TS1E_Pos;
hrc->TSEL &= (uint32_t)~(HRPWM0_HRC_TSEL_TSEL1_Msk | HRPWM0_HRC_TSEL_TS1E_Msk);
hrc->TSEL |= reg;
}

Regards,
Jesus
0 Likes
User18120
Level 1
Level 1
Hi Jesus,

thank you very much for your kind support!

BR
Gii
0 Likes