Project based on
http://www.recursion.jp/avrcdc/
But I wasn’t satisfied with data speed transmission, that was to low. So I decided to upgrade firmware. Success – interface works fine even with 115200 bps.
Firstly I tried with Atmega8 microcontroller and used 256 bytes of his SRAM as a buffer for serial port. I made new section in memory, and placed it between dates and stack so it can be programmed by 8 bits register. Thanks to that you don’t have to worry about overloading – to add an element you need just save and increase address indicator. Just for indicator, I reserved one of processor register.
Function of interrupt I code in assembler language to get optimal buffer work. USb interruption can be unblocked as fast as it’s possible.
Sending buffer ( this who get data from usb and send data by serial port) is very simple – typical 8 bytes buffer, that can magazine data from one transfer. New data can’t be store, until all previous won’t be send. Solution so simple but very good.
System worked well with speed about 57600, but was unstable with 115200. solution was to designe receiver interruption so can be started repeatedly.
For Atmega88 interrupt function must be change- serial port register for new AVR is out of range for sbi/cbi instruction and to increase one bit we need new temporary register.
This version can correctly set baudrate/bits for start and stop, for windows and linux. I saved standard speed transmission – of course that list can be change.
At
http://www.elektroda.pl/rtvforum/topic1560638.html you can find original text, and board diagram in eagle, sources, and plug &play .hex for atmega8 and atmega88.