Atmel’s ATtiny10 is their smallest microcontroller in terms of physical size – it’s an SOT-23-6 package, or about the same size as surface mount transistors. The hardware inside this extremely bare-bones; three I/O lines, 1kB of Flash, 32 bytes of RAM, and a reduced AVR core with 16 registers instead of 32. With such a minimal feature set, you would think the only thing this micro would be good for is blinking a LED. You’d be right, but [cpldcpu] can blink a LED with the ‘tiny10 over USB.
The V-USB interface usually requires about 1.5kB of Flash in its most minimal implementation, and uses 50 bytes of RAM. This just wouldn’t do for the ‘tiny10, and although [cpldcpu] is working on a smaller, interrupt-free V-USB, there were still some hurdles to overcome.
The biggest issue with putting code on the ‘tiny10 is its reduced AVR core – on the ‘big’ 32-register core, direct memory access is two words. On the ’10, it’s only one word. AVR-GCC doesn’t know this, and no one at Atmel seems to care. [cpldcpu] worked around this problem using defines, and further reduced the code size by completely gutting V-USB and putting it in the main loop.
It’s not much, but now [cpldcpu] can blink an LED with a ‘tiny10 over USB. If you’re wondering, 96.4% of the Flash and 93.8% of the SRAM was used for this project.
26 thoughts on “USB On The ATtiny10”
Cool, very cool… +1
But why even produce a chip so crippled? Who is it targeted at?
Probably what Atmel used for their low end Q-Touch parts. They want the lowest cost *smallest* part.
There are many applications where you just have to control signals on one or two lines. No need to go for a bulky device with complex firmware. Obviously they did not create the device with anything like USB in mind.
I think Microchip was first with their SOT23 PICs, but Atmel response (ATtiny 4/5/9/10) is much more powerful.
“I think Microchip was first with their SOT23 PICs, but Atmel response (ATtiny 4/5/9/10) is much more powerful.”
True concerning PIC10F2xxx but not for the PIC10F322 which is quite powerfull.
Looks like a pretty nice device. I like the configurable logic unit.
But, with only 4 MIPS this one is not going to do USB :)
just like the PIC10, it can be a complex logic gate. conditionals, memory, etc. Many of the arduino projects featured here can easily be done in these “useless” versions of the ICs
Certainly they can be done but easily?
Personally, I say yes. But it likely means no prefab libs and possibly using pure ASM
Sometimes it’s worth it to spend a few months of developer time to use a cheaper chip. 10 cents saved on a chip, on a product with a volume of 100.000 a year. That’s 10k right there. You can put a developer on that for a month easy.
I remember seeing my first PIC “in the wild”, it was in a paper shredder. It basically told the motor to run for a second or two after the “paper present” switch re-opened to allow the motor to clean the remaining paper from the shear rollers. No need for a USB, and yes, the next comment will probably say, “I can to that with a 555, a resistor and a capacitor”.
I can to that with a 555, a resistor and a capacitor.
(sorry, I couldn’t resist!)
congratulation! The kind of hack I like.
Nice to see this here!
I’d like to add that it does not just blink the LED. To the computer, the device looks like little-wire (http://www.littlewire.cc) and you can set the color of the WS2812 LED using the little-wire host software.
Does that mean you could use it as a status LED for… something?
Sure, it could be used as an indicator LED similar to the Blinkstick or Blink1.
I was wondering about this when I edited it. I had read your original post when you first published it.
I have it in the back of my mind that I need to look at your code but I can’t figure out how you managed to fit in the timing necessary to drive WS28xx LEDs with what you have leftover in code space. Amazing!
Well, the explanation is in the second image. µ-wire basically “steals” the time required to write to the WS2812 LED from USB by letting some packets time out and resynchronizing at a later time.
Very cool project!
As an aside, SOT-23-6 is smallest Atmel uC? ATtiny20-UUR disagrees.
< 2.2 mm^2
Actually the UUR (12U-1) is 1.403mm*1.555mm… what a weird footprint too.
Yep it sure is, and 1.403 * 1.555 = 2.181665 mm^2, or < 2.2mm^2
I’ve used these types of microcontrollers to make LFSR digital noise sources for prototyping/breadboarding circuits. It was actually easier than wiring up an analog circuit in terms of development time
Working with attiny10 is hard enough already without these memory issues. Although the AVR toolchain shipped with Atmel Studio can handle this target just fine, the support for the attiny10 architecture has not been merged into mainline gcc. Therefore, the avr-gcc packages in many Linux distributions do not support this microcontroller at all.
The modified sources for the toolchain are available from Atmel as large tarballs, unfortunately not as separate patches for integration: http://distribute.atmel.no/tools/opensource/
Just finished my take on a usb-connected rgb driver using AtTiny10 : https://github.com/mihaigalos/fun/tree/master/attiny10_rgb
On the usage side : Flash – 550 bytes (53%), RAM : 8bytes (25%).
text data bss dec hex filename
550 0 8 558 22e attiny10_rgb.elf
Please be kind and respectful to help make the comments section excellent. (Comment Policy)