Hello,
I have built several sensor-interface devices using that are built around serial output (MIDI) using the hardware USI of an ATTiny26. Since I'd like to get away from the sort of limited and slow MIDI spec, I am wondering if it is possible to build an HID device using AVR-USB that reads USI/UART serial data and packs it up into an HID report as if it were e.g. a joystick. The idea is to build a modular system where I can plug different controller modules into the base UART->HID board to connect to the computer. All of the controller devices would use the same spec for sending controls (controller numbers, range, etc.). Will the UART interrupts interfere with the USB communication? How would you recommend that I get started? I have a lot of experience working with AVR's but haven't delved very deep into AVR-USB. Would the ATTiny2313 work as the USB chip?
Any advice is greatly appreciated.
Thanks,
Andrew
UART/USI -> HID device?
Hello Andrew
You asked a number of questions...
Will the UART interrupts interfere with the USB communication?
- Yes, it will. The USB code must not be interrupted.
How would you recommend that I get started?
- If synchronizing your devices with the USB 1msec "heartbeat" is an option, you can access your external devices while the USB host "isn't looking".
Depending on how much data you want to transfer through the USI it may get necessary to synchronize the transfer with the USB activity using a timer ("PLL style").
To get an idea of the CPU activity set a port pin in the USB interrupt code and clear it before entering the idle loop (don't forget to remove this extra line in the USB interrupt routine before doing anything serious with your new device! ).
Would the ATTiny2313 work as the USB chip?
- that depends on how big your USI transfer code is. HID requires more ROM space than low level USB transfer. Maybe a tiny45 or one of the small mega devices would be a better choice.
Cheers
Gert
You asked a number of questions...
Will the UART interrupts interfere with the USB communication?
- Yes, it will. The USB code must not be interrupted.
How would you recommend that I get started?
- If synchronizing your devices with the USB 1msec "heartbeat" is an option, you can access your external devices while the USB host "isn't looking".
Depending on how much data you want to transfer through the USI it may get necessary to synchronize the transfer with the USB activity using a timer ("PLL style").
To get an idea of the CPU activity set a port pin in the USB interrupt code and clear it before entering the idle loop (don't forget to remove this extra line in the USB interrupt routine before doing anything serious with your new device! ).
Would the ATTiny2313 work as the USB chip?
- that depends on how big your USI transfer code is. HID requires more ROM space than low level USB transfer. Maybe a tiny45 or one of the small mega devices would be a better choice.
Cheers
Gert