PicoUART
small, fast, and precise bit-bang UART for 8-bit AVR MCUs
Install / Use
/learn @nerdralph/PicoUARTREADME
picoUART
small, fast, and precise bit-bang half-duplex UART for 8-bit AVR MCUs
(c) Ralph Doncaster 2020 open source MIT license
picoUART is a pico-size simplex high-speed AVR bit-bang UART. Code size is less than 80 bytes total for transmit and receive. picoUART timing is accurate to the cycle (+- 0.5 cycle error); this is less than 1% at 8Mhz.
picoUART is a library that is compatible with the Arduino API but is not dependent on any Arduino functions so it can be used with avr-libc, and sample makefiles can be found for the examples. When used with the Arduino IDE, version 1.6.0 or later is required.
Default Rx is on PB1, and Tx is on PB0. If set to the same pin in pu_config.h, picoUART is also capable of 1-wire (shared Rx/Tx) operation.
picoUART 1.0.0 supports interrupt-driven receive using pin-change interrupts on the t13 and t85 series. Currently 1-wire shared Rx/Tx is not supported with PCINT-based receive. Full-duplex communication is not possible, so received characters will be lost if they arrive during transmit. For the interrupt driven receive, use purx_dataready() and pu_read(). Due to ISR overhead, the maximum reliable speed is 115.2kbps at 8Mhz. There is a single-character receive buffer, so data is likely to be lost if it is not read and processed quickly. A 16-byte receive FIFO is a possibility for a later version.
Examples include a clock tuner program to help determine the best OSCCAL value for error-free communication.
For an even smaller transmit-only asynchronous serial library, see <a href="https://github.com/nerdralph/debugSerial">debugSerial</a>.
For a full-duplex bit-banged AVR UART implementation, see <a href="http://nerdralph.blogspot.com/2020/06/a-full-duplex-tiny-avr-software-uart.html">WGMUART</a>.
Related Skills
node-connect
338.7kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
83.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
338.7kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
83.6kCommit, push, and open a PR
