AnsweredAssumed Answered

Bug report: stm32f0xx_usart.c v1.5.0

Question asked by sole.toni on Jul 22, 2016
Latest reply on Jul 29, 2016 by FTITI.Walid
In the function:
void USART_SetReceiverTimeOut(USART_TypeDef* USARTx, uint32_t USART_ReceiverTimeOut)
The code:
 /* Clear the receiver Time Out value by clearing the RTO[23:0] bits in the RTOR register  */
  USARTx->RTOR &= (uint32_t)~((uint32_t)USART_RTOR_RTO);
  /* Set the receiver Time Out value by setting the RTO[23:0] bits in the RTOR register  */
  USARTx->RTOR |= USART_ReceiverTimeOut;


The problem is that in the datasheet, in the page 701, says:

RTOR can be written on the fly. If the new value is lower than or equal to the counter, the
RTOF flag is set.

Then went I call to this function of the interrupt routine to assign a new timeout value it generate a new interrupt on every call.

To solve it, this function have to be changed, saving the initial value of the register in a local variable, change the value and store it back to the register.

Outcomes