Is there a full example of UART0 setup for LPC1769?

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a full example of UART0 setup for LPC1769?

Jump to solution
1,453 Views
larry1
Contributor II

I am working with RFID board CLEV6630B, comprising LPC1769 and CLRC663Plus.  My software is from NxpNfcRdLib_RC663_LPC1769_v05.22.01_Full in SW297851.zip with only a few printf changes so far.  I am using the Basic Discovery Loop top level project with lpc_board_nxp_lpcxpresso_1769 and lpc_chip_175x_6x.

I want to activate the 3V3 level serial port on J201.  Per the schematics, that is connected to UART0.  Board.h comes with DEBUG_UART set to UART3.  The schematic says that UART3 is No Connect.  I have changed board.h to say:

#define DEBUG_UART LPC_UART0

After recompile, my 'scope says that both the TX and RX pins of J201 are steady during calls to Board_UARTPutSTR.  TX is steady at 2V2.  RX is steady at 3V3.  I suspect that there is a problem with pinmux.

Looks like pinmux is set up in board_sysinit.c:

STATIC const PINMUX_GRP_T pinmuxing[] = {

    {0,  0,   IOCON_MODE_INACT | IOCON_FUNC2},    /* TXD3 */
    {0,  1,   IOCON_MODE_INACT | IOCON_FUNC2},    /* RXD3 */

The LPC1769 User Manual has this pin description for UART0 TX:

P0[2]/TXD0/AD0[7] 79 [2] I/O P0[2] —

General purpose digital input/output pin.
O TXD0 — Transmitter output for UART0.

The mapping from PDF to PINMUX structure is not intuitive to me, and I'm not confident that all the clocks and interrupts are set up.  For example, Board_UART_Init is empty:

/* Initialize UART pins */
void Board_UART_Init(LPC_USART_T *pUART)
{
    /* Pin Muxing has already been done during SystemInit */
}

So the question is: is there a known-good example of LPC1769 UART0 setup somewhere in the ecosystem?

Thanks,

Larry

0 Kudos
1 Solution
425 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Larry Martin ,

There isn't exactly UART0  example, you can send your whole project to me, I will help you check the code.

BR

Alice

View solution in original post

0 Kudos
6 Replies
425 Views
larry1
Contributor II

For the record, I found the mapping between LPC1769 User ManualUM10360 and the library structure in NfcReaderLibForCLRC633Plus\lpc_board_nxp_lpcxpresso_1769\src\board_sysinit.c.  The structure is defined:

typedef struct {
    uint32_t pingrp:3;        /* Pin group */
    uint32_t pinnum:5;        /* Pin number */
    uint32_t modefunc:24;    /* Function and mode. */
} PINMUX_GRP_T;

The pin group was throwing me but it looks like that is the Port, so Port 0 in the PDF equals pingrp 0 here.

The mux functions seem to be called out in order in the PDF table, so the TXD3/RXD3 default functions are in row 2, but the equivalent UART0 functions are in row 1.  With these new entries in pinmuxing[], I see now serial output on oscope:

    {0,  2,   IOCON_MODE_INACT | IOCON_FUNC1},    /* TXD0 */
    {0,  3,   IOCON_MODE_INACT | IOCON_FUNC1},    /* RXD0 */

The RX pin is still pulled to 3V3, so it must just be  a pullup input.

0 Kudos
425 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Larry,

Thanks for your sharing, yes, for Pins, when Function is 01, the function is UART pins as below:

pastedImage_1.png

BR

Alice

0 Kudos
426 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Larry Martin ,

There isn't exactly UART0  example, you can send your whole project to me, I will help you check the code.

BR

Alice

View solution in original post

0 Kudos
425 Views
larry1
Contributor II

Alice, that's a great offer, thank you.

Attached is a ZIP of nearly my complete workspace.  I had to take out the Simplified API top level projects to get the whole thing under the board's 50 MB limit.  If you need those too, a complete ZIP is available here for 3 days:

https://www.sendthisfile.com/PTpyqzQgp5JtqvV22BJaXyzN

There are minimal changes from the distributed library.  All my changes should have "larry" in a comment somewhere close.

0 Kudos
425 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Larry,

Your project really so great, I haven't find the configuration code about UART0.

If you though there is a problem with pinmux, I recommend you first just change the UART configuration code

based on UART demo under LPCopen, test it whether can work well.

0 Kudos
425 Views
larry1
Contributor II

Thanks for looking, Alice.  I have marked your first reply as the Answer.  There is no full example.  Good to know.

0 Kudos