uart dma example rework

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

uart dma example rework

448 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dragilla on Sat Nov 19 02:53:24 MST 2011
Hey,
I'm trying to read data from gps on uart0 and resend it on uart1.
I'm using the uart_dma_test.c (from lpc17xx.cmsis.driver.library.zip) as my base.

I can do a simple loop reading and prinint data from gps. There data is of course incomplete because its is not buffered:
while(1) {
        len = 0;
        while (len == 0)
        {
            len = UART_Receive(LPC_UART0, buffer, sizeof(buffer), NONE_BLOCKING);
        }
        UART_Send(LPC_UART1, buffer, sizeof(buffer), BLOCKING);
}
So I know that both uart0 and uart1 are set up correctly. I can see the data showing up on my console.

Now I add uart1 to the uard_dma_test, change the uart_send port to uart1... and...
it doesn't send
I mean I can see it calling the UART_Send function and it's calling it with the gps data, but I don't see the output on the console.
I traced the uart send down to line
((LPC_UART1_TypeDef *)UARTx)->/*RBTHDLR.*/THR = Data & UART_THR_MASKBIT;
in lpc17xx_uart.c

Attached is my code.
Plaease help me to find the reason.
0 Kudos
1 Reply

329 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dragilla on Sat Nov 19 09:23:25 MST 2011
erm, Silly me, I forgot to initialize uart1 - me bad. If someone wants to make some use of my code, just add
    // Initialize UART1 peripheral with given to corresponding parameter
    UART_Init(LPC_UART1, &UARTConfigStruct);

just after initializing the uart0.

regards,
--
Luke
0 Kudos