Serial Example
UART Smoke Test
Initialize the board serial port and print a repeating counter through a USB-to-UART adapter.
Run It
Use these commands from the COS workspace when the board and serial adapter are attached.
make -C firmware/lpc51u68_uart clean allmake -C firmware/lpc51u68_uart flashpython3 tools/uart_viewer.py --device <serial-device> --baud 9600
What To Look For
- Serial output proves pin wiring and adapter ground are correct.
- The counter proves the firmware remains alive after boot.
- This gives every later RTOS example a debug channel.
#include "cos_lpc51u68_bsp.h"
int main(void)
{
uint32_t tick = 0;
cos_lpc51u68_uart0_init_9600_8n1();
cos_lpc51u68_uart0_puts("\r\nCOS LPC51U68 UART0 smoke test: 9600 8N1\r\n");
for (;;) {
cos_lpc51u68_uart0_puts("cos uart tick ");
cos_lpc51u68_uart0_put_hex32(tick++);
cos_lpc51u68_uart0_puts("\r\n");
cos_lpc51u68_busy_delay(1200000u);
}
}