Jul 07, 2020
06:14 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 07, 2020
06:14 AM
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
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
- Tags:
- IFX
2 Replies
Jul 07, 2020
07:13 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 07, 2020
07:13 AM
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
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
Jul 07, 2020
09:36 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 07, 2020
09:36 AM
Hi Jesus,
thank you very much for your kind support!
BR
Gii
thank you very much for your kind support!
BR
Gii