I am able to open and work with the debug UART on the LPC824 on the dev board rev C.
However when redirecting the usb uart pins RX/TX from 7 and 18 to my output pins it doesn't seem to be working. I've tied RX to TX physically and it hangs at waiting for the getLineUART(recv_buf, sizeof(recv_buf)); on the UART example code.
I think my project is messed up with the semihosting/debug/redlib stuff.
1. Is it possible to get both working at the same time?
2. What library and configuration should I be targeting to get the regular UART to work? Should I disable the debug macro's? Do I need to rewrite the code to get regular UARTs to work?
Thanks
Hi,
As you know that the uart0 signals can be routed to any PORT pins, on the LPC824_Xpresso board, the UART0_TX is routed to P0_7 of LPC824 as TARGET_TX-P0_7 node, then connected to PIO0_18 of UART0_RX of LPC11U35.
The UART0_RX is routed to P0_18 of LPC824 as TARGET_RX-P0_18 node, then connected to PIO0_19 of UART0_TX of LPC11U35 as node LINK_TX by closing the pin2&3 of JP3.
When the LPC824 put character to UART0_TX pin, the LPC11U35 will receive the character, then transfer it via USB to PC. The mechanism for receiver is the same.
You can route the UART0 TX/RX to the other pins via the code:
1)The code can route the UART0 pin to P0_7 and P0_18 as the example code
/* Enables clock for switch matrix.: 0x01u */
CLOCK_EnableClock(kCLOCK_Swm);
/* USART0_TXD connect to P0_7 */
SWM_SetMovablePinSelect(SWM0, kSWM_USART0_TXD, kSWM_PortPin_P0_7);
/* USART0_RXD connect to P0_18 */
SWM_SetMovablePinSelect(SWM0, kSWM_USART0_RXD, kSWM_PortPin_P0_18);
2)The code can route the UART0 pin to P0_26 and P0_25, but you have to delete the above code.
/* Enables clock for switch matrix.: 0x01u */
CLOCK_EnableClock(kCLOCK_Swm);
/* USART0_TXD connect to P0_26 */
SWM_SetMovablePinSelect(SWM0, kSWM_USART0_TXD, kSWM_PortPin_P0_26);
/* USART0_RXD connect to P0_25 */
SWM_SetMovablePinSelect(SWM0, kSWM_USART0_RXD, kSWM_PortPin_P0_25);
Pin_MUX.c
void BOARD_InitPins(void)
{
/* Enables clock for IOCON block.: 0x01u */
CLOCK_EnableClock(kCLOCK_Iocon);
/* Enables clock for switch matrix.: 0x01u */
CLOCK_EnableClock(kCLOCK_Swm);
const uint32_t pio15_config = (/* Selects pull-up function */
IOCON_PIO_MODE_PULLUP |
/* Enable hysteresis */
IOCON_PIO_HYS_EN |
/* Input not invert */
IOCON_PIO_INV_DI |
/* Disables Open-drain function */
IOCON_PIO_OD_DI |
/* Bypass input filter */
IOCON_PIO_SMODE_BYPASS |
/* IOCONCLKDIV0 */
IOCON_PIO_CLKDIV0);
/* PORT1 PIN5 (coords: ) is configured as */
IOCON_PinMuxSet(IOCON, 15, pio15_config);
const uint32_t pio30_config = (/* Selects pull-up function */
IOCON_PIO_MODE_PULLUP |
/* Enable hysteresis */
IOCON_PIO_HYS_EN |
/* Input not invert */
IOCON_PIO_INV_DI |
/* Disables Open-drain function */
IOCON_PIO_OD_DI |
/* Bypass input filter */
IOCON_PIO_SMODE_BYPASS |
/* IOCONCLKDIV0 */
IOCON_PIO_CLKDIV0);
/* PORT3 PIN0 (coords: ) is configured as */
IOCON_PinMuxSet(IOCON, 30, pio30_config);
/* USART0_TXD connect to P0_7 */
SWM_SetMovablePinSelect(SWM0, kSWM_USART0_TXD, kSWM_PortPin_P0_7);
/* USART0_RXD connect to P0_18 */
SWM_SetMovablePinSelect(SWM0, kSWM_USART0_RXD, kSWM_PortPin_P0_18);
/* Disable clock for switch matrix. */
CLOCK_DisableClock(kCLOCK_Swm);
}
Hope it can help you
BR
XiangJun Rong