AnsweredAssumed Answered

Faulty assert() in USART_SetBaudRate() of fsl_uart.c for LPC80x

Question asked by Robert Beekmans on Jun 27, 2019
Latest reply on Jul 3, 2019 by 12345 67890

Hi all,

 

When using the lastest McuXpresso v11 and LPCXpresso804 SDK v2.6.0, I noticed when setting the baudrate of a USART to 57600 or either 115200 bps an assert got triggered.

 

/* If the baud rate calculated is not very precise, please select the FRG clock as
* the USART's source clock, and set the FRG frequency to a more suitable value.
*/
assert(diff < ((baudrate_Bps / 100) * 3));

 

Should in my opinion be changed to:

 

/* If the baud rate calculated is not very precise, please select the FRG clock as
* the USART's source clock, and set the FRG frequency to a more suitable value.
*/
assert(best_diff < ((baudrate_Bps / 100) * 3));

 

With this change I was able to successfully set the baudrate to 115k2 (or 57k6) within my application.

Hopefully you agree with this change so it can be incorparated to prevent others bumping into this faulty assert.

 

Kind regards,

 

Robert

Outcomes