UART configuration and operation for LPC55S16

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

UART configuration and operation for LPC55S16

ソリューションへジャンプ
1,086件の閲覧回数
yangao
Contributor III

Hi,

I am using the LPC55S16 evaluation board. In our design, there is a UART that needs to be configured for half-duplex operation. It should normally function in RX mode, but when receiving data, it should switch to TX mode to send a response back. Later, at some point, we need to convert the UART to full-duplex operation. Is this achievable? If so, how can it be done?

Regards,

Winston

 

0 件の賞賛
返信
1 解決策
1,056件の閲覧回数
Harry_Zhang
NXP Employee
NXP Employee

HI @yangao 

Yes, you can configure the UART on the LPC55S16 for both half-duplex and full-duplex operation.

Configure UART initially for receiving (RX)

    USART_GetDefaultConfig(&config);
    config.baudRate_Bps = BOARD_DEBUG_UART_BAUDRATE;
    config.enableTx     = false;
    config.enableRx     = true;

    USART_Init(DEMO_USART, &config, DEMO_USART_CLK_FREQ);

Configure UART for full-duplex (TX and RX enabled)

    USART_GetDefaultConfig(&config);
    config.baudRate_Bps = BOARD_DEBUG_UART_BAUDRATE;
    config.enableTx     = true;
    config.enableRx     = true;

    USART_Init(DEMO_USART, &config, DEMO_USART_CLK_FREQ);

 

BR

Hang

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
1,038件の閲覧回数
yangao
Contributor III

Hi,

Follow up question, when  the UART works in half duplex mode, actually I need to set it as one-wire UART - the TX and RX are in the same line. When the UART works in full duplex mode, the TX and RX are separate lines. Is there a solution for this kind of settings?

Regards,

Winston

0 件の賞賛
返信
1,057件の閲覧回数
Harry_Zhang
NXP Employee
NXP Employee

HI @yangao 

Yes, you can configure the UART on the LPC55S16 for both half-duplex and full-duplex operation.

Configure UART initially for receiving (RX)

    USART_GetDefaultConfig(&config);
    config.baudRate_Bps = BOARD_DEBUG_UART_BAUDRATE;
    config.enableTx     = false;
    config.enableRx     = true;

    USART_Init(DEMO_USART, &config, DEMO_USART_CLK_FREQ);

Configure UART for full-duplex (TX and RX enabled)

    USART_GetDefaultConfig(&config);
    config.baudRate_Bps = BOARD_DEBUG_UART_BAUDRATE;
    config.enableTx     = true;
    config.enableRx     = true;

    USART_Init(DEMO_USART, &config, DEMO_USART_CLK_FREQ);

 

BR

Hang

0 件の賞賛
返信