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

__HAL_TSC_GET_GROUP_STATUS returns status for incorrect TSC group #7

Closed austinphillips2 closed 3 years ago

austinphillips2 commented 3 years ago

The __HAL_TSC_GET_GROUP_STATUS macro is used to return the conversion status of an individual TSC group.

#define __HAL_TSC_GET_GROUP_STATUS(__HANDLE__, __GX_INDEX__) ...

The __GX_INDEX__ field is incorrectly masked in the #define definition resulting in the status being returned for TSC group 0 rather than the group requested by __GX_INDEX__.

This issue has previously been reported and acknowledged at https://community.st.com/s/question/0D50X0000ASrqJjSQJ/bug-in-stm32l0-tsc-library but a fix has not been made available in this repository.

RKOUSTM commented 3 years ago

Hi @austinphillips2,

Thank you for your 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 soon in a 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

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,