7 years, 7 months ago.

Using UART1 with LPCExpresso11U68


I posted a question here https://mbed.org/forum/platform-49-LPCXpresso11U68-community/topic/4957/

Maybe it is not the right place so I'm duplicating it here as well. ____________

I'm trying to use USART1 on pins P0_14 and P0_13 because it already has the arduion header. But when I define

Serial myport(P0_14, P0_13); // USART1

the program halts.

The same problem is when I define:

Serial myport(P1_0, P0_20); // USART2


Serial myport(P1_23, P1_6); // USART2

Serial pc(USBTX, USBRX); //(P0_19, P0_18);

is working ok.

Any ideas?

Will start looking into the serial class source to understand how it is selecting the required pin function. ____________

Ok, looks like it has not been implemented https://github.com/mbedmicro/mbed/blob/master/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11U6X/serial_api.c

How can I enable support for UART1-4?


#define UART_NUM    1

static const PinMap PinMap_UART_TX[] = {
    {P0_19, UART_0, 1},
    {P1_18, UART_0, 2},
    {P1_27, UART_0, 2},
//    {P1_18, UART_1, 2},
//    {P1_0 , UART_2, 3},
//    {P1_23, UART_2, 3},
//    {P2_4 , UART_3, 1},
//    {P2_12, UART_4, 1},
    { NC  , NC    , 0}

static const PinMap PinMap_UART_RX[] = {
    {P0_18, UART_0, 1},
    {P1_17, UART_0, 2},
    {P1_26, UART_0, 2},
//    {P1_2 , UART_1, 3},
//    {P0_20, UART_2, 2},
//    {P1_6 , UART_2, 2},
//    {P2_3 , UART_3, 1},
//    {P2_11, UART_4, 1},
    {NC   , NC    , 0}

I am going to find out why it was commented out.

posted by Martin Kojtal 30 May 2014

Hi, The UART1-4 implementation has been done and tested. I made pull request below and hope to merge soon: https://github.com/mbedmicro/mbed/pull/341

Regards, Toyo

posted by Toyomasa Watarai 03 Jun 2014


The UART1-4 support code has been pushed into GitHub: https://github.com/mbedmicro/mbed/commit/850e3c4d3d402724860d0adae966ac05c9a8ed16

However, mbed library of online compiler has not been updated yet. Please can you wait for next library update. http://mbed.org/users/mbed_official/code/mbed/shortlog

Regards, Toyo

posted by Toyomasa Watarai 06 Jun 2014

Hi, It is still not working, I tried with both mbed and mbed-src libraries. The problem is in the receiving side, transmitting if working ok. When receiving only the first byte is returned.

Regards, Jurgis

posted by Jurgis Jurksta 22 Jun 2014

1 Answer

7 years, 7 months ago.


During serial_api porting, I noticed that UART1-4 had totally different register set from UART0. Even if you enabled commented out lines, it will not work (probably crash).

It must to be extra support code (a lot) for UART1-4. I will find out mode detail.

Regards, Toyo

Thank you for clarifying this. Is there anything I can do to help with it?

posted by Jurgis Jurksta 30 May 2014

Do you know if UART1-4 will be ported anytime soon? I'm new to ARM and mbed platform but I want to use LPC11U6X mcu in my next project and mbed libraries seems like an easy start.

I'll try to port at least UART1, it does not seem like an easy task for An ARM newbie but we'll see ...

posted by Jurgis Jurksta 31 May 2014


I've just done my initial implementation for UART1-4 support and will start its test soon. I will update the progress on this.

Regards, Toyo

posted by Toyomasa Watarai 02 Jun 2014

That is great, thank you!

posted by Jurgis Jurksta 03 Jun 2014

I just tested it, looks like something is not right. Here is a test program. http://mbed.org/users/jurgis/code/test_lpcxpresso11u68_uart1/

I connected pins P1_8 and P1_2 on the lpcexpresso11U68 board so that everything which gets sent should also be returned. Unfortunatelly I get back only the first byte.

posted by Jurgis Jurksta 05 Jun 2014