Bug in UART library (NXP 16550 compatible UART)

This forum topic has been closed.

18 Jul 2013

Hi,

A bug report has been posted to Japanese forum:
https://mbed.org/forum/ja/topic/4471/

It seems to be a problem in UART library (only for NXP 16550 compatible UART).

When sending operation is happened during receiving operation, receiving operation seems to be broken by serial_putc() function.

It appeared only in full-duplex communication, not in half-duplex communication.
<http://mbed.org/users/mbed_official/code/mbed-src/file/f9e72c209510/vendor/NXP/LPC1768/hal/serial_api.c>

Because THR and RBR register shared same address, receiving data has been wrongly read in serial_putc().

/media/uploads/MACRUM/serial_api.jpg /media/uploads/MACRUM/um10360.jpg

24 Jul 2013

Actually i even don't see any reason why they put these last four lines of code into the serial_putc function. They just make no sense to me.

Maybe i'm overlooking something, but why would one define two local variables in a function and assign a register value to them, then assign them to themselves again and do nothing with them in the end ???

Best regards
Neni

07 Sep 2013

I also noticed this issue while looking at the serial code. I have created a pull request which removes this extra code. It looks like it was some debug code that got committed by mistake.

-Adam

09 Sep 2013

Thanks for the report and the fix! The pull request was merged.