AnsweredAssumed Answered

Bugreport in stm32f3 USART HAL - wrong USART_IT_CM value defined in library

Question asked by subrt.stanislav on Oct 1, 2014
Latest reply on Oct 1, 2014 by Montassar BEN ROMDHANE
Hello,

I would like to report a bug in this USART HAL file:
/**
  ******************************************************************************
  * @file    stm32f3xx_hal_uart.h
  * @author  MCD Application Team
  * @version V1.0.1
  * @date    18-June-2014
  * @brief   Header file of UART HAL module.
  ******************************************************************************

In that file you can find
#define UART_IT_CM                          ((uint16_t)0x142E)
#define UART_IT_WUF                         ((uint16_t)0x1476)

UART_IT_CM value is wrong (should indicate bit position in ISR register therefore there shouldnt be two definitions starting 0x14...) With current value it is possible to enable interrupt but not possible to check if that interrupt is pending.
Correct value is:

#define UART_IT_CM                          ((uint16_t)0x112E)

Also the documentation is wrong about ZZZZ part
/** @defgroup UART_Interrupt_definition   UART Interrupts Definition
  *        Elements values convention: 0000ZZZZ0XXYYYYYb
  *           - YYYYY  : Interrupt source position in the XX register (5bits)
  *           - XX  : Interrupt source register (2bits)
  *                 - 01: CR1 register
  *                 - 10: CR2 register
  *                 - 11: CR3 register
  *           - ZZZZ  : Flag position in the ISR register(4bits)
  * @{
  */
4 bits for ISR flag definition is not enough and you need at least 5 (for instance for Character match interrupt at bit 17)

Hope it helps somebody

With best regards
Stanislav Subrt

Outcomes