STMicroelectronics / STM32CubeL0

STM32Cube MCU Full Package for the STM32L0 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))
Other
103 stars 57 forks source link

Fix __HAL_TSC_GET_GROUP_STATUS to report requested group index #8

Closed austinphillips2 closed 3 years ago

austinphillips2 commented 3 years ago

The current implementation of __HAL_TSC_GET_GROUP_STATUS incorrectly applies a mask to the requested TSC group index which results in the status of TSC group index 0 being returned rather than the requested TSC group index.

Modify so that the __GX_INDEX input to HAL_TSC_GET_GROUP_STATUS is honoured and the correct group index status is returned.

This bug has previously been reported at https://community.st.com/s/question/0D50X0000ASrqJjSQJ/bug-in-stm32l0-tsc-library

Fixes #7

RKOUSTM commented 3 years ago

Hi @austinphillips2,

Thank you for your suggestion and contribution. A fix for this code below :

https://github.com/STMicroelectronics/STM32CubeL0/blob/904c92833dc000c5819504d230c29e882d18f691/Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_hal_tsc.h#L574-L575

will be published as soon in in future release (STM32L0Cube V1.12.0) looks like the following:

+ #define __HAL_TSC_GET_GROUP_STATUS(__HANDLE__, __GX_INDEX__) \ 
+ ((((__HANDLE__)->Instance->IOGCSR & (uint32_t)(1UL << (((__GX_INDEX__) & 0xFUL) + 16UL))) == (uint32_t)(1UL << (((__GX_INDEX__) & 0xFUL) + 16UL))) ? TSC_GROUP_COMPLETED : TSC_GROUP_ONGOING)

Thank you again for your contribution.

With regards,

RKOUSTM commented 3 years ago

ST Internal Reference: 62853

austinphillips2 commented 3 years ago

@RKOUSTM Thank you for the update. Since this issue appears to have already been known about and a fix already planned, what is the reason that it hasn't been addressed in the source in the github repository?

RKOUSTM commented 3 years ago

Hi @austinphillips2,

Thank you for your contribution. The release of STM32L0Cube V1.12.0 firmware package will be available soon on GitHub repository. Stay tuned.

Thank you again for your contribution.

With regards,

RKOUSTM commented 3 years ago

Hi @austinphillips2,

I hope you are fine. The issue you reported has been fixed in the frame of version v1.12.0 of the STM32CubeL0 published on GitHub.

Thank you again for having reported.

With regards,