Skip to main content
Topic: USBasp UART (Read 1041 times) previous topic - next topic


I've recently modified original USBasp AVR programmer's firmware to allow it to double as an USB to UART adapter. It's probably pretty useful, since it allows simple debugging of chips without additional hardware - and USBasp is already dirt cheap, so why not reuse it?
There were some hiccups during development, such as problems with UART interrupts - USB timing is VERY strict, so I couldn't just allow interrupts at any time. Instead, they were optimized to be as short as possible and turn off interrupts only for very short periods of time - a handful of processor clocks.
As a result, I was able to achieve UART speeds of about 12kB/s from device to computer and 14kB/s in the opposite direction - these rates correspond to constant UART stream at 120000 and 140000 baud. I'd call that success.
Here's the GitHub repository with the whole code - both modified hardware and a command line utility actually allowing you to use USBasp as UART terminal (also included is write/read benchmark) - - it also contains a pretty detailed log and instructions for installation.
If I have time in the following days/weeks, I'll try to optimize it even more (though this is increasingly hard now) and squeeze some extra kilobytes. Please comment and tell me what you think :)