STMicroelectronics / STM32CubeH5

Full firmware package for STM32H5 series containing CMSIS, HAL-LL, BSP drivers, MW libraries plus a set of projects.
https://www.st.com/en/embedded-software/stm32cubeh5.html
Other
48 stars 11 forks source link

Bug in UCPD_InitStruct() function #7

Closed tdjastrzebski closed 10 months ago

tdjastrzebski commented 1 year ago

UCPD_InitStruct() function is missing value lshift is: UCPD_InitStruct->psc_ucpdclk should be: (UCPD_InitStruct->psc_ucpdclk << UCPD_CFG1_PSC_UCPDCLK_Pos) since UCPD_CFG1_PSC_UCPDCLK_Pos != 0

Btw, PSC_UCPDCLK name is inconsistent with registry description (RM0456 section 74.8.1) - see https://github.com/STMicroelectronics/cmsis_device_u5/issues/1

ALABSTM commented 10 months ago

Hi @tdjastrzebski,

Thank you for this report. From what I see, there is no need to shift the value of UCPD_InitStruct->psc_ucpdclk before the assignment.

Indeed, the possible values taken by UCPD_InitStruct->psc_ucpdclk are already shifted.

This is not the case for the other attributes like UCPD_InitStruct->transwin that are meant to take values "between Min_Data=0x1 and Max_Data=0x1F" that are not shifted, thus requiring the shift operations.

I hope this makes things clearer. Please allow me to close this issue in this case.

With regards,