// Simple string transmit function void uart_send_string(const char *str) while (*str) USART_Tx(UART_HANDLE, *str++);
// Initialize UART uart_init();
while (1) // Main loop does nothing – everything is interrupt driven __WFI(); // Wait for interrupt simplicity studio uart example
Create a new file main.c and add the following code:
Universal Asynchronous Receiver-Transmitter (UART) is one of the most fundamental and widely used interfaces in embedded systems. Whether you are debugging via logs, communicating with a sensor, or interfacing with a GSM module, UART is often the go-to protocol. // Initialize UART uart_init()
int main(void) // Chip initialization (important for errata) CHIP_Init();
// Enable RX interrupt (optional but useful) USART_IntEnable(UART_HANDLE, USART_IEN_RXDATAV); NVIC_EnableIRQ(USART0_RX_IRQn); communicating with a sensor
// Function to initialize UART void uart_init(void) // Enable clock for USART CMU_ClockEnable(UART_CLOCK, true);