Skip to main content
JGrci
Visitor II
March 7, 2019
Question

Bug in STM32L0 TSC library

  • March 7, 2019
  • 2 replies
  • 983 views

I would like to report a bug in HAL TSC library for the stm32L0 series of microcontrollers.

The bug is in the stm32l0xx_hal_tsc.h header file in the  __HAL_TSC_GET_GROUP_STATUS macro.

This is the current version of the macro (buggy version):

#define __HAL_TSC_GET_GROUP_STATUS(__HANDLE__, __GX_INDEX__) \

((((__HANDLE__)->Instance->IOGCSR & (uint32_t)(1UL << (((__GX_INDEX__) & (uint32_t)TSC_NB_OF_GROUPS) + 16UL))) == (uint32_t)(1UL << (((__GX_INDEX__) & (uint32_t)TSC_NB_OF_GROUPS) + 16UL))) ? TSC_GROUP_COMPLETED : TSC_GROUP_ONGOING)

This macro always returns the state of the Group 1, regardless of the __GX_INDEX__.

The correct version of the macro should be:

#define __HAL_TSC_GET_GROUP_STATUS(__HANDLE__, __GX_INDEX__) \

((((__HANDLE__)->Instance->IOGCSR & (uint32_t)(1UL << (((__GX_INDEX__)) + 16UL))) == (uint32_t)(1UL << (((__GX_INDEX__)) + 16UL))) ? TSC_GROUP_COMPLETED : TSC_GROUP_ONGOING)

In short eliminate the "& (uint32_t)TSC_NB_OF_GROUPS)" code.

I have also fond that this (correct) version is in the CubeMX STM32F3 library and this library works OK.

Hope this will be helpful to others !

This topic has been closed for replies.

2 replies

ST Technical Moderator
March 8, 2019

Hello,

I will check this reported issue and come back to you with update.

Thanks for your contribution.

Kind Regards,

Imen

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
ST Technical Moderator
March 12, 2019

Hello,

This issue is confirmed and will be fixed in coming release of Cube firmware package.

Kind Regards,

Imen.

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks