LPC4330 UART0_RX not operating

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

LPC4330 UART0_RX not operating

Jump to solution
790 Views
daliborzanca
Contributor I

Hi,

I have NGX LPC-4330-Xplorer board;
pins U0_TXD (9), U0_RXD (10) and GND (1) are interconnected to FTDI cable C232HD pins RXD,TXD,GND.
I tried to debug project "periph_uart_rb" from package lpcopen_2_12_lpcxpresso_ngx_xplorer_4330.zip
On start it prints initial text:

 

LPC18xx/43xx UART example using ring buffers
Press a key to echo it back or ESC to quit

 

but when I press any key there is no echo, no reaction at all.
I think it should repeat the char pressed and LED should toggle.
I measured the FTDI cable and there is 115200 Bd 1Start+8Data+1Stop bit on its TX output pin as expected.

 

Also tried project "periph_uart", no reaction to pressed key, only prints some text.

 

Then I created my project, based on LPCOpen, and tested if the pin used for UART0_RX is functional;

when reconfigured it to Function_0 (be GPIO) I was polling this GPIO & incremented when zero,

the counter risen on each char sent from terminal => pin is functional.

 

UART is initialized:

  Chip_UART_Init(LPC_UART);

  Chip_UART_SetBaud(LPC_UART, 115200);

  Chip_UART_ConfigData(LPC_UART, UART_LCR_WLEN8 | UART_LCR_SBS_1BIT); /* Default 8-N-1 */

  Chip_UART_TXEnable(LPC_UART);

 

for printing I successfully use function:

Chip_UART_SendBlocking(LPC_UART, mystr, 7);     // mystr[] filled with 7 characters before..

 

for reception I tried construction:

a = Chip_UART_Read(LPC_UART, recbuf, 64);     // try to read, maximally 64 bytes

but it always returns 0

 

tried also reading my way:

// try polling of UART0 / LSR.RDR

ula = *((unsigned long *)0x40081014); // UART0_LSR

if (ula & 0x0001) // b0 = RDR (RX Data Ready)

       data = *((unsigned long *)0x40081000); // UART0_RBR

 

but the bit RDR is never set

 

tried to print content of UART0 registers after initializetion (before the endless loop),

UART0_IER:  0x00000000

UART0_IIR:  0x000000C1

UART0_LCR:  0x00000003

UART0_LSR:  0x00000000

UART0_ACR:  0x00000000

UART0_OSR:  0x000000F0

UART0_HDEN: 0x00000000

UART0_SYNC: 0x00000000

UART0_TER:  0x00000001

UART0_THR:  0x00000000

 

The only thing I found interesting is that register IIR / bits_7,6 are HH => FIFO is enabled.

Not sure why (does it LPCOpen) and if it affects the way how RX module works,

could this be the reason why bit RDR (DataReceived) is never set when a char comes ?

Am I to use different procedure for reception, based on anything else that waiting for RDR==1 and reading RBR ?

 

Could anybody show any example code with UART0 that really works on NGX LPC-4330-Xplorer board ?

Any idea what could be wrong or what to try ?

Other registers that affect UART functionality, MUXes, clocks ?.. (but TX works ok)

 

Any ideas welcome.

Original Attachment has been moved to: dal_test1.c.zip

Tags (1)
0 Kudos
1 Solution
505 Views
rolfmeeser
NXP Employee
NXP Employee

No Problem to use P6_4/P6_5 even if for the purpose of booting via UART0 pins P2_0/P2_1 have been used before.

However, make sure that the pin multiplexers for pins P2_0/P2_1 no longer select UART0 function. If both pin pairs P2_0/P2_1 and P6_4/P6_5 select UART0, then at least for the RXD signal only one of the pins will be functional!

View solution in original post

0 Kudos
3 Replies
505 Views
daliborzanca
Contributor I

Thank you Rolf, you are right.

Initial value of

SCU register for pin P2_1 is 0x00 (func0..SGPIO5) when Boot_via_USART3 is selected (or any other probably),

but it is 0xD1 (func1..U0_RXD) when Boot_via_USART0 is selected, that was my problem.

So I had 2 pins both configured as U0_RXD, and in this case obviously P2_1 has priority over P6_5.

After assigning func4..GPIO5_1 to pin P2_1 the P6_5 functions correctly as the only U0_RXD.

0 Kudos
506 Views
rolfmeeser
NXP Employee
NXP Employee

No Problem to use P6_4/P6_5 even if for the purpose of booting via UART0 pins P2_0/P2_1 have been used before.

However, make sure that the pin multiplexers for pins P2_0/P2_1 no longer select UART0 function. If both pin pairs P2_0/P2_1 and P6_4/P6_5 select UART0, then at least for the RXD signal only one of the pins will be functional!

0 Kudos
505 Views
daliborzanca
Contributor I

I have just found that the the issue (UART0_RX not functional) occurs only when Boot-mode selector (J4 on my NGX Xplorer PCB) selects USART0 (DIP switches 1234 are Up,Up,Up,Up) .

Description in AN11239 states exactly:

"Boot from device connected to USART0 using pins P2_0 and P2_1. For flash parts, enter UART ISP mode"

The USART0 I/Os on the LPC4330 / BGA100 can be routed to pins P2_0, P2_1 (= those used by Bootloader) or pins P6_4, P6_5 (== those used by me, available on pinheader J8).

Which register controls the selection between these two options ?

Can I boot from pins P2_0, P2_1 and then switch to P6_4, P6_5 ?

Or is it not controlable and Boot_via_UART0 automatically means the UART0 pins can be only P2_0 and P2_1 ?

0 Kudos