Can't get serial output to work.

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

Can't get serial output to work.

2,020 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by gwlindberg on Fri Feb 05 16:58:09 MST 2016
We're trying to get serial debug output to work. We've got everything to compile and we can step through and everything looks good, just no output on the pins. We are using an LPC1517, currently running off of the internal RC osc pll'd to 72MHz.

It looks like something stupid has happened in the setup. 

We are using the board file from the Board_LPC1549_TQFP48 project.
WE have:
#define DEBUG_UART LPC_USART0

#if defined(DEBUG_UART)
    /* Disables pullups/pulldowns and enable digital mode */
    Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 14, (IOCON_FUNC0 | IOCON_MODE_INACT | IOCON_DIGMODE_EN));
    Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 15, (IOCON_FUNC0 | IOCON_MODE_INACT | IOCON_DIGMODE_EN));

    /* UART signal muxing via SWM */
    Chip_SWM_MovablePortPinAssign(SWM_UART0_RXD_I, 0, 14);
    Chip_SWM_MovablePortPinAssign(SWM_UART0_TXD_O, 0, 15);

    /* Use main clock rate as base for UART baud rate divider */
    Chip_Clock_SetUARTBaseClockRate(Chip_Clock_GetMainClockRate(), false);

    /* Setup UART */
    Chip_UART_Init(DEBUG_UART);
    Chip_UART_ConfigData(DEBUG_UART, UART_CFG_DATALEN_8 | UART_CFG_PARITY_NONE | UART_CFG_STOPLEN_1);
    Chip_UART_SetBaud(DEBUG_UART, 115200);
    Chip_UART_Enable(DEBUG_UART);
    Chip_UART_TXEnable(DEBUG_UART);
#endif

/* Sends a character on the UART */
void Board_UARTPutChar(char ch)
{
#if defined(DEBUG_UART)
    Chip_UART_SendBlocking(DEBUG_UART, &ch, 1);
#endif
}

The Board_UARTPutChar() routine is being called, but we get nothing on the pins.

Any insight would be appreciated.
Labels (1)
0 Kudos
Reply
5 Replies

1,773 Views
athmesh_n
Contributor IV

Hi gwlindberg‌, I have the same issue. If you have solved your issue, can you please help? Issue is given below:

I'm working on LPC1517 custom board. It worked when crystal oscillator was present on the board. After removing the crystal oscillator and selecting IRC as main clock for board, the UART is not working, 

 

NOTE: The main clock now after debug is 72 MHz.

             BRG value obtained for 115200 bauds is 39. 

             Used main clock rate as base for UART baud rate divider  

What modifications must be done in UART, for its working?

 

IDE : MCUXpresso

Controller : LPC1517

 

Thanks and Regards,

Athmesh Nandakumar

0 Kudos
Reply

1,773 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by gwlindberg on Wed Feb 24 11:06:05 MST 2016
Hi R2D2,

I just went back and verified that the SWM and IOCON init routines are setting the appropriate fields to defaults. So the above snippet is what is being used to setup the UART. Although that does sound like a likely problem.

I had not ported the uart rb example to our board from the LPCXpresso 1549, I'll see if I can get some time to do that.

Regards,
0 Kudos
Reply

1,773 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Tue Feb 23 12:08:23 MST 2016
Your code snippet is not showing what you have / have not changed in detail  :(

I would guess you setup is wrong, especially your board setup (swmSetup[] ?) and that's confusing SWM...
0 Kudos
Reply

1,773 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by gwlindberg on Tue Feb 23 11:34:45 MST 2016
Hi Miccio,
I know that the serial port on our board can work because we have put it into the onboard rom download mode and have been able to communicate with the rom.

We just haven't been able to get our own serial code to work.  I based the code that I'm using on the ring buffer example and it doesn't work. I've tried the debug print routines and they don't work.

From the other way around, I tested the ring buffer code on the LXPXpresso 1549 board and that works, I then changed the port pins to the ones that we are using, the default pins for a 1517, and that works. So that accounts for the only thing that we changed on our board from the examples, the chip pins, 13 & 18 on the 1549 to 14 & 15 on the 1517.

There must be something else gong on with the 1517 that I haven't figured out yet.

Regards,
0 Kudos
Reply

1,773 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by miccio on Tue Feb 23 03:34:43 MST 2016
Hi gwlindberg,

does the same happen when you try to run any of the the uart examples (ring buffer, polling api, interrupt-based api)?
Have you already ruled out any hardware-related issue? wrong pins, etc..
0 Kudos
Reply