STMicroelectronics / STM32CubeH7

STM32Cube MCU Full Package for the STM32H7 series - (HAL + LL Drivers, CMSIS Core, CMSIS Device, MW libraries plus a set of Projects running on all boards provided by ST (Nucleo, Evaluation and Discovery Kits))
https://www.st.com/en/embedded-software/stm32cubeh7.html
Other
490 stars 302 forks source link

Possible undocumented return value of LL_TIM_OC_GetMode() function #230

Closed khevessy closed 1 year ago

khevessy commented 2 years ago

I do not know if this is a bug, but this function https://github.com/STMicroelectronics/STM32CubeH7/blob/0c3a06c18bd2a87b006a84f997f2b0b56d97a113/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_ll_tim.h#L2221-L2226 might return something else than the documented return values that are mentioned in its header. It will happen if field CCxS is different from zero (channel is not output). Maybe it is wrong to call this function on non-output channel but the function header should mention that the return value will differ.

ASELSTM commented 2 years ago

Hi @Irisbus,

It is indeed not accurate to call LL_TIM_OC_GetMode on non-output channel, the function description is actually mentioning this.

https://github.com/STMicroelectronics/STM32CubeH7/blob/0c3a06c18bd2a87b006a84f997f2b0b56d97a113/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_ll_tim.h#L2190

Hence, the documented returned values are specifying the output compare mode when channel is configured as output. It is therefore left to the user to provide the correct parameters to the function in order to get right results.

With regards,