serialF0  1.3
Serial stream for HvA-Xmegaboard
serialF0 Documentation


This documents the alternative serial interface for the HvA-Xmegaboard.

The serial interface makes a default in and output stream for USART0 of port F. The baudrate is 38400 and the protocol is 8N1.

Application main.c, ...
init_stream(), printf(), scanf(), puts(), ...
uartF0_putc(), uartF0_puts(), uartF0_getc(), getline()
serialF0.c, serialF0.h

This serial interface is based om md_serial.c from J.D.Bakker. It uses USART0 of portF, but it is rather easy to make a variant for one or more of the other USART's.
This interface uses two non circulair buffers for sending and receiving the data. The default size (depth) of both buffers is 100. The size of the buffers can be altered with the two macros TXBUF_DEPTH_F0 and RXBUF_DEPTH_F0.
The interface uses two ISR's USARTF0_RXC_vect and USARTF0_DRE_vect. The ISR for receiving data has a medium interrupt level and The interrupt level for transmitting is set to a low level and is off when there is no data in the TX buffer.

To use the standard io-functions you need only to include stream.h, to call the initialization function init_stream(), to enable the interrupt mechanism.

  #include "serialF0.h"


  printf("print some text to USART0 of port F");

To use streams for USART0 port F:


Wim Dolman (
Latest version can be found here:


This library is free software. You can redistribute it and/or modify it. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY.