Hello David,
Please follow my step and try it on your side.
Please still modify the code based on the orignial periph_uart_rb code.
You can just call :val = Chip_UART_Send(LPC_USART, "Test\n", 5);
Then modify the Chip_UART_Send like this:
/* Transmit a byte array through the UART peripheral (non-blocking) */
int Chip_UART_Send(LPC_USART_T *pUART, const void *data, int numBytes)
{
int sent = 0;
uint8_t *p8 = (uint8_t *) data;
/* Send until the transmit FIFO is full or out of bytes */
/* while ((sent < numBytes) &&
((Chip_UART_ReadLineStatus(pUART) & UART_LSR_THRE) != 0)) {
Chip_UART_SendByte(pUART, *p8);
p8++;
sent++;
}*/
while ((sent < numBytes) ) {
while((Chip_UART_ReadLineStatus(pUART) & UART_LSR_THRE) == 0);
Chip_UART_SendByte(pUART, *p8);
p8++;
sent++;
}
return sent;
}
I have test it on my side, I can get the test printf data on my side:

My main code is:
int main(void)
{
uint8_t key;
int bytes;
int val=0;
/* Generic Initialization */
SystemCoreClockUpdate();
Board_Init();
Init_UART_PinMux();
Board_LED_Set(0, false);
/* Setup UART for 115.2K8N1 */
Chip_UART_Init(LPC_USART);
Chip_UART_SetBaud(LPC_USART, 115200);
Chip_UART_ConfigData(LPC_USART, (UART_LCR_WLEN8 | UART_LCR_SBS_1BIT));
Chip_UART_SetupFIFOS(LPC_USART, (UART_FCR_FIFO_EN | UART_FCR_TRG_LEV2));//UART_FCR_TRG_LEV2
Chip_UART_TXEnable(LPC_USART);
/* Before using the ring buffers, initialize them using the ring
buffer init function */
RingBuffer_Init(&rxring, rxbuff, 1, UART_RRB_SIZE);
RingBuffer_Init(&txring, txbuff, 1, UART_SRB_SIZE);
/* Enable receive data and line status interrupt, the transmit interrupt
is handled by the driver. */
Chip_UART_IntEnable(LPC_USART, (UART_IER_RBRINT | UART_IER_RLSINT));
/* preemption = 1, sub-priority = 1 */
NVIC_SetPriority(UART0_IRQn, 1);
NVIC_EnableIRQ(UART0_IRQn);
/* Send initial messages */
// Chip_UART_SendRB(LPC_USART, &txring, inst1, sizeof(inst1) - 1);
// Chip_UART_SendRB(LPC_USART, &txring, inst2, sizeof(inst2) - 1);
val = Chip_UART_Send(LPC_USART, "Test\n", 5);
/* Poll the receive ring buffer for the ESC (ASCII 27) key */
key = 0;
while (key != 27) {
bytes = Chip_UART_ReadRB(LPC_USART, &rxring, &key, 1);
if (bytes > 0) {
/* Wrap value back around */
if (Chip_UART_SendRB(LPC_USART, &txring, (const uint8_t *) &key, 1) != 1) {
Board_LED_Toggle(0);/* Toggle LED if the TX FIFO is full */
}
}
}
/* DeInitialize UART0 peripheral */
NVIC_DisableIRQ(UART0_IRQn);
Chip_UART_DeInit(LPC_USART);
return 1;
}
Please try this at first, after it works on your side, then modify the chip initialization and test again.
Any 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!
-----------------------------------------------------------------------------------------------------------------------