EmbeddedRelated.com
Forums

Bit-banged USB?!?!

Started by Tim Wescott February 15, 2012
I came across this schematic (well, my son dragged it into my attention):
http://www.otd.kr/data/file/pj_LIMKB/1964092542_24157b90_Aikon28LIMKB29-
SMD_Schematic.PNG

This is for a universal keyboard controller.  The thing that is really 
catching my eye, though, is that the thing appears to be set up to bit-
bang the USB.

Has anyone ever heard of doing this?  Tried it?  Succeeded?  USB slow is 
1.5MHz, so there's a remote possibility that one might possibly have 
enough time to do something if the processor isn't doing much else (the 
processor in the above schematic is clocking at 12MHz), but I'm pretty 
astonished that they're even managing that.

-- 
Tim Wescott
Control system and signal processing consulting
www.wescottdesign.com
On Wed, 15 Feb 2012 22:18:01 -0600, Les Cargill wrote:

> Tim Wescott wrote: >> I came across this schematic (well, my son dragged it into my >> attention): >> http://www.otd.kr/data/file/
pj_LIMKB/1964092542_24157b90_Aikon28LIMKB29-
>> SMD_Schematic.PNG >> >> This is for a universal keyboard controller. The thing that is really >> catching my eye, though, is that the thing appears to be set up to bit- >> bang the USB. >> >> Has anyone ever heard of doing this? Tried it? Succeeded? USB slow >> is 1.5MHz, so there's a remote possibility that one might possibly have >> enough time to do something if the processor isn't doing much else (the >> processor in the above schematic is clocking at 12MHz), but I'm pretty >> astonished that they're even managing that. >> >> > > That's from PD0(RXD) and PD2(INT0)? Are those configured then as just > PIO (emphasis O)? > > Pretty crazy, but keyboard events are relatively infrequent - hundreds > per second at most.
I have absolutely no clue how it's configured -- the source code isn't available. I'm still trying to get past bit-banged USB. -- My liberal friends think I'm a conservative kook. My conservative friends think I'm a liberal kook. Why am I not happy that they have found common ground? Tim Wescott, Communications, Control, Circuits & Software http://www.wescottdesign.com
Tim Wescott wrote:
> I came across this schematic (well, my son dragged it into my attention): > http://www.otd.kr/data/file/pj_LIMKB/1964092542_24157b90_Aikon28LIMKB29- > SMD_Schematic.PNG > > This is for a universal keyboard controller. The thing that is really > catching my eye, though, is that the thing appears to be set up to bit- > bang the USB. > > Has anyone ever heard of doing this? Tried it? Succeeded? USB slow is > 1.5MHz, so there's a remote possibility that one might possibly have > enough time to do something if the processor isn't doing much else (the > processor in the above schematic is clocking at 12MHz), but I'm pretty > astonished that they're even managing that. >
That's from PD0(RXD) and PD2(INT0)? Are those configured then as just PIO (emphasis O)? Pretty crazy, but keyboard events are relatively infrequent - hundreds per second at most. -- Les Cargill
On Wed, 15 Feb 2012 21:34:49 -0600, Tim Wescott
<tim@seemywebsite.please> wrote:

>I came across this schematic (well, my son dragged it into my attention): >http://www.otd.kr/data/file/pj_LIMKB/1964092542_24157b90_Aikon28LIMKB29- >SMD_Schematic.PNG > >This is for a universal keyboard controller. The thing that is really >catching my eye, though, is that the thing appears to be set up to bit- >bang the USB. > >Has anyone ever heard of doing this? Tried it? Succeeded? USB slow is >1.5MHz, so there's a remote possibility that one might possibly have >enough time to do something if the processor isn't doing much else (the >processor in the above schematic is clocking at 12MHz), but I'm pretty >astonished that they're even managing that.
There have been a number of reports of people doing that over the years, although there always seemed to have been some caveats about error handling and such. The obvious Google search seems to lead to a number of those projects, although I've never (knowingly) seen such a beast in operation. One such claiming to work on a 12MHz AVR: http://vusb.wikidot.com/
On Wed, 15 Feb 2012 22:51:50 -0600, Robert Wessel wrote:

> On Wed, 15 Feb 2012 21:34:49 -0600, Tim Wescott > <tim@seemywebsite.please> wrote: > >>I came across this schematic (well, my son dragged it into my >>attention): >>http://www.otd.kr/data/file/pj_LIMKB/1964092542_24157b90_Aikon28LIMKB29- >>SMD_Schematic.PNG >> >>This is for a universal keyboard controller. The thing that is really >>catching my eye, though, is that the thing appears to be set up to bit- >>bang the USB. >> >>Has anyone ever heard of doing this? Tried it? Succeeded? USB slow is >>1.5MHz, so there's a remote possibility that one might possibly have >>enough time to do something if the processor isn't doing much else (the >>processor in the above schematic is clocking at 12MHz), but I'm pretty >>astonished that they're even managing that. > > > There have been a number of reports of people doing that over the years, > although there always seemed to have been some caveats about error > handling and such. The obvious Google search seems to lead to a number > of those projects, although I've never (knowingly) seen such a beast in > operation. > > One such claiming to work on a 12MHz AVR: > > http://vusb.wikidot.com/
I tried the obvious (to me) search on IxQuick, and didn't find anything. What search phrase did you use? -- My liberal friends think I'm a conservative kook. My conservative friends think I'm a liberal kook. Why am I not happy that they have found common ground? Tim Wescott, Communications, Control, Circuits & Software http://www.wescottdesign.com
On 16/02/2012 04:34, Tim Wescott wrote:
> I came across this schematic (well, my son dragged it into my attention): > http://www.otd.kr/data/file/pj_LIMKB/1964092542_24157b90_Aikon28LIMKB29- > SMD_Schematic.PNG > > This is for a universal keyboard controller. The thing that is really > catching my eye, though, is that the thing appears to be set up to bit- > bang the USB. > > Has anyone ever heard of doing this? Tried it? Succeeded? USB slow is > 1.5MHz, so there's a remote possibility that one might possibly have > enough time to do something if the processor isn't doing much else (the > processor in the above schematic is clocking at 12MHz), but I'm pretty > astonished that they're even managing that. >
Atmel has an application note and sample software for doing this (for a mouse) with an AVR. It's many years old, using quite a simple AVR - but it's written in assembly and not easy to modify or re-use, and it's not exactly full-feature. Still, bit-banged slow USB is not going to be too difficult for a simple peripheral and a fast microcontroller, if you can be sure to get low jitter on the bit timing. XMOS do USB2.0 full speed (480 Mbps) in software, along with their fairly sophisticated buffered IO ports.
On Wed, 15 Feb 2012 21:34:49 -0600, Tim Wescott
<tim@seemywebsite.please> wrote:

>bit- >bang the USB. > >Has anyone ever heard of doing this?
Yes. I built this joystick adapter once: http://www.mictronics.de/projects/avr-usb-joystick/
>Tried it?
I did not have any part in developing the project. I just downloaded the files and built the device.
>Succeeded?
It did work. When plugged in to my XP computer, the joystick device appeared in Device Manager, and changing the input voltage would move the controls on screen. -- RoRo
Tim Wescott <tim@seemywebsite.com> writes:

> On Wed, 15 Feb 2012 22:18:01 -0600, Les Cargill wrote: > >> Tim Wescott wrote: >>> I came across this schematic (well, my son dragged it into my >>> attention): >>> http://www.otd.kr/data/file/ > pj_LIMKB/1964092542_24157b90_Aikon28LIMKB29- >>> SMD_Schematic.PNG >>> >>> This is for a universal keyboard controller. The thing that is really >>> catching my eye, though, is that the thing appears to be set up to bit- >>> bang the USB. >>> >>> Has anyone ever heard of doing this? Tried it? Succeeded? USB slow >>> is 1.5MHz, so there's a remote possibility that one might possibly have >>> enough time to do something if the processor isn't doing much else (the >>> processor in the above schematic is clocking at 12MHz), but I'm pretty >>> astonished that they're even managing that. >>> >>> >> >> That's from PD0(RXD) and PD2(INT0)? Are those configured then as just >> PIO (emphasis O)? >> >> Pretty crazy, but keyboard events are relatively infrequent - hundreds >> per second at most. > > I have absolutely no clue how it's configured -- the source code isn't > available. I'm still trying to get past bit-banged USB.
Not done it myself, but I know that there has been code around for ages for Atmel. Low speed USB is relatively.... low speed, and AIUI USB was designed to be relatively simple on the device side. -- John Devereux
On 2012-02-15, Tim Wescott <tim@seemywebsite.com> wrote:
> On Wed, 15 Feb 2012 22:51:50 -0600, Robert Wessel wrote: >> >> There have been a number of reports of people doing that over the years, >> although there always seemed to have been some caveats about error >> handling and such. The obvious Google search seems to lead to a number >> of those projects, although I've never (knowingly) seen such a beast in >> operation. >> >> One such claiming to work on a 12MHz AVR: >> >> http://vusb.wikidot.com/ > > I tried the obvious (to me) search on IxQuick, and didn't find anything. > What search phrase did you use? >
I was reminded of this project when I went looking for USB device MCUs in PDIP several weeks ago. I found it again just now by searching for "avr software usb" (without the quotes). Simon. -- Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP Microsoft: Bringing you 1980s technology to a 21st century world
On 2012-02-15, Tim Wescott <tim@seemywebsite.com> wrote:
> On Wed, 15 Feb 2012 22:18:01 -0600, Les Cargill wrote: >> That's from PD0(RXD) and PD2(INT0)? Are those configured then as just >> PIO (emphasis O)? >> >> Pretty crazy, but keyboard events are relatively infrequent - hundreds >> per second at most. > > I have absolutely no clue how it's configured -- the source code isn't > available. I'm still trying to get past bit-banged USB. >
:-) Well you never know what crazy stuff you can justify when you have the freedom to play with this stuff on your own time (and are funding it out of your own pocket) instead of having to charge per hour of your time. :-) Never underestimate the ingenuity of a hobbyist looking to save a few pounds/dollars by building their own device instead of using a preassembled widget. The cost versus time tradeoffs for someone like myself are completely different from those experienced by a embedded person like yourself who is doing this for a living. BTW, I'm amused that you are astonished by this and it did make me wonder what other things people building things out of their own pocket can justify which would astonish a person doing this for a living. :-) Simon. -- Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP Microsoft: Bringing you 1980s technology to a 21st century world