LPC4330 NGX Xplorer - USART0 Can't Receive

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

LPC4330 NGX Xplorer - USART0 Can't Receive

883 Views
nsmith17044
Contributor II

I've been struggling to understand what I'm missing with respect to getting the USART0 on the NGX Xplorer board to receive.  Code I'm using is almost identical to what I'm using on USART3 that works perfectly.

I've verified physical connection of the GPIO pins to the vias by setting high and low and the physical connection is good.

I have two Xplorer boards, both exhibit the same problem so I believe this to be configuration.

Again, USART3 is working and receive interrupt is processing received data perfectly.  Transmission of data on USART0_TX is fine.

Init code:

#define LPC_UART_BTMOD          LPC_USART0
#define LPC_UARTIRQ_BTMOD       USART0_IRQn

#define             FPUART_BTMOD_BAUD           (115200)    //baudrate for BT module interface

    Chip_UART_Init( LPC_UART_BTMOD );
    Chip_UART_SetBaud( LPC_UART_BTMOD , FPUART_BTMOD_BAUD);
    Chip_UART_ConfigData( LPC_UART_BTMOD , UART_LCR_WLEN8 | UART_LCR_SBS_1BIT | UART_LCR_PARITY_DIS);

    Chip_UART_TXEnable(LPC_UART_BTMOD);

    //setup the FIFO for receive on 1 character threshold (FCR register)
    Chip_UART_SetupFIFOS( LPC_UART_BTMOD, ( UART_FCR_FIFO_EN    //must be set for UART operation
                                        |
                                        UART_FCR_RX_RS      //reset RX fifo
                                        |
                                        UART_FCR_TX_RS      //reset TX fifo
                                        |
                                        UART_FCR_TRG_LEV0   //level 0 - one character
                                       ));


    //enable interrupt for received characters (receive buffer register)
    Chip_UART_IntEnable( LPC_UART_BTMOD, (UART_IER_RBRINT | UART_IER_RLSINT));

    // Priority
    NVIC_SetPriority( LPC_UARTIRQ_BTMOD , IRQ_PRI_USARTBTMOD );
    // Enable Interrupt for UART channel
    NVIC_ClearPendingIRQ( LPC_UARTIRQ_BTMOD );
    NVIC_EnableIRQ( LPC_UARTIRQ_BTMOD );

    // USART0_TXD - F6 (P6_4 - GPIO3[3])
    Chip_SCU_PinMuxSet(0x6, 4, (SCU_MODE_PULLDOWN | SCU_MODE_FUNC2));
    // USART0_RXD - F9 (P6_5 - GPIO3[4])
    Chip_SCU_PinMuxSet(0x6, 5, (SCU_MODE_INACT | SCU_MODE_INBUFF_EN | SCU_MODE_ZIF_DIS | SCU_MODE_FUNC2));

I see well formed data on the RX line with the scope at the proper rate.  I've verified the actual register values of the USART0 peripheral and it all looks correct with respect to what the above code should be setting up.  I don't see the interrupt called as data comes in and I don't see the interrupt pending flags get set for USART0.

Can anyone tell me what I'm missing here?

Labels (2)
0 Kudos
3 Replies

516 Views
nsmith17044
Contributor II

Has anyone verified that the PERIPH_UART example starts up and works?  I tested this project (from 2.19 library) on three NGX Xplorer 4330 eval boards and all three stop when it appears to be switching to the crystal.  Specifically it looks like the code become non-responsive when the Chip_Clock_DisableMainPLL() function is called inside of Chip_SetupCoreClock().  My application code starts up and runs the core at 204MHz on these boards.  I realized that the Chip_SetupCoreClock() function with 2.19 is quite different than the one I was using.  I copied the older one over and was able to at least get the PERIPH_UART sample to start to run.  Seems that switching from the IRC to 12Mhz crystal isn't supported with 2.19 directly?  Well that's a topic for another post.

I do see the TX line working and see the 'Starting UART Auto-Baud...' message in hyperterminal but the sample seems to be stuck in the auto-buad mode as if it is not getting any word frames to sync on and the interrupt does not fire.  I've verified that I'm connected to pins 9 an 10 on J8 of the eval board (I'm referencing the rev 1.2 schematic).  Probing right on pin 10 of J8, I see the 'a' characters that I type from the PC with a 3.3V voltage swing and at 115200 baud.

After working with the sample I decided to go back and work with my app code gain as I could not find any differences from how the sample was doing the setup and how I was doing it.  I changed my app code so I could do some free-run testing and monitor the USART0 IRQ as what I was doing before was running code and hitting a breakpoint.  The debugger interrupt must have been getting fired before any USART0 interrupts could be handled so it appeared that the USART0 interrupt was not being triggered.  At this point the USART0 is receiving and probably has been from the beginning but I was 'stepping on it' with the debugger.

0 Kudos

516 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Nathan,

   The lpcopen v2.19 really have problem.

   Now we already have the 2.20 reversion, I have attached the newest project, please use the IAR uart project, I have test it on my side, it can use the P6_5 to receive the data and with interrupt.

   Wish it helps you!

   Any new problem after referring the v2.20 code, please let me know!


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

516 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Nathan,

    Please download the LPCopen code for NGX from this link:

http://www.nxp.com/assets/downloads/data/en/software/lpcopen_2_19_lpcxpresso_ngx_xplorer_4330.zip 

Folder:    lpcopen_2_19_lpcxpresso_ngx_xplorer_4330\periph_uart

You can download this code to your NGX LPC4330 board directly, this project is using the UART0, P6_4 and P6_5 as the UART0 pin.

P6_4 is the U0_TXD pin, it should connect to the terminal RX pin.

P6_5 is the U0_RXD pin, it should connect to the terminal TX pin.

Please also check your board, use the correct pin, then test it again on your side.

Wish it helps you!

If you still have question, please let me know!


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos