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

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

897 Views
roberto74
Contributor I

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

Labels (2)
0 Kudos
3 Replies

713 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Mike Katz,

Thank you for your interest in NXP Semiconductor products and
for the opportunity to serve you.
Yes, it should be replaced by the below code, I'll report it to SDK team for checking.

assert( best_diff < ((baudrate_Bps / 100) * 3));

Have a great day,
TIC

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

713 Views
1234567890
Contributor IV

Hi, problem is already known: https://community.nxp.com/thread/501767 

0 Kudos

713 Views
roberto74
Contributor I

Hi all,

Please note that this issue is fixed in the lastest LPC80x SDK v2.7.0 (Dec 2019).

Kind regards,

Robert

0 Kudos