µ-Wire – USB on an ATtiny 10

(cpldcpu.com)

114 points | by mofosyne 2 days ago

8 comments

  • alhidade 9 hours ago
    I love ATtinys. They are in a sweet-spot where you have a set of features with which you get stuff done while still being able to keep the whole architecture in your head.

    You can memorize the whole instruction set and write assembly if you wish, but can also program C, C++ and even Rust now. The tooling is accessable and the chips are cheap and easily sourced.

    I once used a bitbanged USB on a t85 and thought it was barely possible, but this is another level. Impressive!

    • dragontamer 7 hours ago
      Note that the modern ATtiny is the AVR DD, DA, DB, EA, EB, etc. etc. series. You can still buy modern and better versions of them.

      There is even the AVR DU with official USB support now.

      AVR remains as simple and easy to understand as ever. Just with an updated coat of fresh paint. Faster ADC, DAC, dual power supply, 1.8V operation at full speed, same 5V support as ever, etc. etc.

      • kevin_thibedeau 6 hours ago
        The key is that the modern tinys have more features than classic ATMegas (other than limited pin count) and are no longer crippled with gimped peripherals. They're really the only AVRs that are cost competitive against Cortex-M0+ when you don't need the resources of an ARM core.
        • dragontamer 3 hours ago
          ATMega vs ATTiny no longer exists.

          Microchip, for some reason, decided to rebrand like in 2022.

          They are called AVR DD, DA, DB, EA, EB, and DU now.

          They are better than both ATtiny and ATmegas of old. But the rebranding seems to have been a mistake IMO. I feel like a lot of hobbyists missed the name switch.

          The AVR DD is cheaper, lower power and (if you buy VFQN packages) smaller than any ATtiny ever was. They are good products IMO if you only need an 8-bitter still in 2026.

          ---------

          The Cortex M0+ parts have dropped down below $1 however, but they still seem to have worse peripherals than an AVR DD or AVR EA. The ADC, AC, DAC and LUTs offered by AVR remains legendary.

          But if you want something like a 2014 era ATMega or ATTiny but 32-bit, well yeah those Cortex M0+ chips are possibly a superior choice. Comparable peripherals to the 8-bitters of the 2010s but with more SRam and Flash.

          I would say that the standout Cortex M0+ chip line is TI's MSPM0+ line, which come in with ATMega328 like peripherals but like 50cents and modern 32-bit ... Or you can buy the more expensive ones with OpAmps.... Even fancy OpAmps like chopper OpAmps or self-zeroing OpAmps (or regular rail to rail OpAmps, etc. etc).

          • kevin_thibedeau 3 hours ago
            The tiny branding still exists as the 0/1/2 series. Same AVR core and mostly the same peripherals as the new XX AVRs but in smaller packages. In some instances the tinys are superior with a better ADC or voltage reference.
            • dragontamer 2 hours ago
              Microchip doesn't even offer a marketing link to the 0/1/2 series on their webpage.

              I'm not saying ATtiny is dead. I'm saying that it's new name is AVR EA. Or even AVR LA (the newest release this year) is basically an ATTiny in all the ways that matters.

              Microchip just rebranded the ATTiny series. They call them AVR LA now.

              And what used to be called ATmega is basically AVR DA or AVR DB, or AVR DU.

              AVR DD, AVR EA, and AVR EB are somewhere between ATMega and ATtiny.

              It's just a massive rebranding effort that seems to have fallen flat.

              You get the AVR assembly and AVR GCC support your want, newer better versions of every peripheral, lower power usage, more SRam more Flash. And in the case of AVR LA, they are like 50 cents. It's basically an ATtiny but with 2026 tech.

              Don't get hung up on the name too much. (Or alternatively, if you are a product manager please handle rebranding better than what Microchip has done here. This is the fault of Microchips marketing teams for making this so confusing and killing off the name of a good brand).

              The chips live on. Just with a new name.

          • alnwlsn 3 hours ago
            >missed the name switch

            I certainly did. Never heard of these before right now. In my mind the tiny 0- 1- 2- series are still "the new one"

    • sitzkrieg 8 hours ago
      i agree, for some reason got an ungodly amount of similar pic12s a while back. been putting them in all sorta of stuff, used a few for flickering red leds in pumpkins this halloween for example. cheap enough to throw out with the alkaline cell lol.

      i can easily get years of runtimes in LF parts too. while its peripherals are not particularly great at low power vs say, a msp430 or efm8sb, it simply has so few it comes out way ahead

  • donquichotte 49 minutes ago
    In a similar vein: bit-banging Ethernet on an ATTINY85 by the genius that is CNLohr: https://www.youtube.com/watch?v=mwcvElQS-hM
  • seletskiy 7 hours ago
    Oh that brighten my mood. When I was in between jobs, I bought a bunch of ATTiny13A with similar specs and was genuinly surprised how much power such a little device has, given its ridiculously low energy consumption. I had zero HW experience prior to that, so to educate myself I started to implement firmware from scratch in zig, and advanced from UART to SPI to I²C and ended up on USB implementation, which I didn't finish because I got hired.
    • jayemar 5 hours ago
      Just out of curiosity how did you choose zig?
      • seletskiy 3 hours ago
        No particular reason. I've liked high-level capabilities that would translate into very low level code and amount of control, but on the other hand I couldn't use existing AVR backend because it produced very verbose code, so I ended up using Zig-to-C and avr-gcc, but it also produced subpar machine code which I was unhappy with. E.g. for loops that were bound by less than 255 iterations — 1 byte — it produced 4 instructions while 3 were enough, if I remember correctly). And for protocol implementations where timings are strict I've simply ended up with sprinkling code with ASM insets here and there to match timings. I also liked the fact that I could set ATTiny fuses straight in zig's comptime, but then they updated zig and that particular edge-case stopped to work.
  • serious_angel 12 hours ago

        > Update 2014-01-07:
        > It actually works on a ATtiny 10 now, yay!...
        > 
        > Update 2014-03-19:
        > I published a more detailed write-up...
        > 
        > Source: https://github.com/cpldcpu/u-wire
    
        ---
    
        > Flash: 988 of 1024 bytes used (96.4%)
        > SRAM: 28 (variables)+2 (stack) of 32 bytes used (93.8%)
        > 
        > This is most likely the most complex firmware ever loaded into an ATtiny10!
        > 
        > Source: https://cpldcpu.com/2014/03/19/%c2%b5-wire-usb-on-an-attiny-10
    
    It felt like it was devalued by a sorrowful LLM/AI, but no… The person achieved the whole code manually.

    Considering recent times… This is an authentic, real achievement that may inspire and support someone else and is to be kept treasured in the history with genuine glory, honor, and dignity.

    Thank you… Thank you heartfelt for being an actual engineer, developer with authentic experience to be actually proud of, and held up as an example!

    • ignilux 8 hours ago
      Doubly impressive considering the ATtiny 10 has no on-chip debugger peripheral!
      • 05 8 hours ago
        I don't think it makes a big difference - the mcu has a subset of AVR RISC instruction set so just running firmware on a beefier mcu of that family would allow you at least printf based debugging to uart, which should be enough here. It's not like stopping in debugger would help you with a timing sensitive protocol anyhoo, you would use logging either way.
  • rchard2scout 6 hours ago
    (2014)
  • mesm7903 11 hours ago
    [flagged]
  • oakfrog 12 hours ago
    [flagged]
    • MOARDONGZPLZ 6 hours ago
      Really do wish I could block people on this site. This is getting out of hand.
      • pona-a 4 hours ago
        There's some extensions