Author Topic: Some questions about USB 3.1 currents and ATmega32u2 Power draw.  (Read 1821 times)

0 Members and 1 Guest are viewing this topic.

Offline Blitzschnitzel

  • Thread Starter
  • Posts: 32
  • Location: Bremen
Some questions about USB 3.1 currents and ATmega32u2 Power draw.
« on: Sat, 13 October 2018, 07:20:42 »
So, I started an Interest Check for a very early stage concept: https://geekhack.org/index.php?topic=97647.0
It didnt get a lot of feedback yet but the feedback it got is very positive. Since this is a modular design I need to know how many boards can be theoretically daisy-chained and if there is some breathing room for key backlights. The ATMEGA32u2 documentation states a max current draw of 21mA but is this really what is to be expected in use in a keyboard? How much current does it draw when booting/typing/idle? Or is there a difference at all? If someone with one of these USB multimeters could give a reading from a 32u2 or 32u4 board that would be fantastic. ;)

My other question was about USB 3.1. Now, there is all the fancy higher voltage digital handshake in the new standard but Wikipedia also states 2A at 5V. Is this 2A just readily available or does it also need the digital handshake and gives otherwise just the 900mA of USB 3?
« Last Edit: Tue, 16 October 2018, 11:32:53 by Blitzschnitzel »

Offline Blitzschnitzel

  • Thread Starter
  • Posts: 32
  • Location: Bremen
Re: Some questions about USB 3.1 currents and ATmega32u2 Power draw.
« Reply #1 on: Tue, 16 October 2018, 11:33:11 »
bump

Offline bakageta

  • Posts: 204
Re: Some questions about USB 3.1 currents and ATmega32u2 Power draw.
« Reply #2 on: Wed, 17 October 2018, 15:06:16 »
If the system actually follows usb3.1 specs 900mA is the max you'll be able to draw, since unlike the usb2.0 specs there is a max current defined. With 2.0, it was defined as supplying at least 5 units (100mA per unit) and many manufacturers allowed much more than that. Are you actually going to be using usb3.1 and superspeed though? Most boards that use usb-c just run it in 2.0 mode, and I don't think the atmega series can handle 3.1 natively, so if you want 3.1 support your hub will have to handle all of that. I'd certainly like some info either way on your hub plans, I'd love to add a hub into one of my designs but I haven't looked into designing one at all.

As for power draw measurements, if someone else hasn't taken any for you by the end of this weekend I'll see if I can get some. I've got a filco tkl with an HID Liberation Device on qmk, it uses a 32u4.

Online Findecanor

  • Posts: 3944
  • Location: Stockholm, Sweden
  • Does not take bull****
Re: Some questions about USB 3.1 currents and ATmega32u2 Power draw.
« Reply #3 on: Wed, 17 October 2018, 15:35:30 »
The AVR do the low-level USB protocol stuff in hardware and the low-level protocol changed for Interrupt transfers (which USB HID uses) between 2.0 and 3.0 so I doubt that the ATmega32u2 would be capable of HID with the USB 3.x, even if it uses only the old lines and speeds.

In other words, I don't think you can just change the Device- and Configuration descriptors and expect it to work.
Smoking is assault. I defend myself.
Daily driver: Phantom (Lubed Cherry MX Clear, Lasered Cherry PBT keycaps with Row A. Plastic "Frankencase". Custom firmware, Swedish layout)

Offline bakageta

  • Posts: 204
Re: Some questions about USB 3.1 currents and ATmega32u2 Power draw.
« Reply #4 on: Wed, 17 October 2018, 15:46:24 »
You'd need a usb3.1 chip handling the hub, separate from the keyboard circuitry and atmega. From there, you could just run the atmega power and data lines and the appropriate CC resistors to one of the hub's downstream ports, and the hub would fall back to 2.0 for the board but still allow 3.1 devices to plug into the other port. That'd be a fairly complex design though, and would need all pins wired on the usb-c connectors, but it'd be glorious. Maybe integrate something like this?

Offline Blitzschnitzel

  • Thread Starter
  • Posts: 32
  • Location: Bremen
Re: Some questions about USB 3.1 currents and ATmega32u2 Power draw.
« Reply #5 on: Thu, 18 October 2018, 02:28:01 »
Thanks that helps a lot. :)
As far as I can tell there is no hardware limitation to the current in USB 2.0. Just the written spec. So, you should be able to pass through 900mA if you plug a 2,0 chip in a 3.0 port. I was going to use the open source 2 port 2.0 nanohub from the same guy.^^ https://muxtronics.nl/nanohub.html
So, no super speeds but the chip is smaller cheaper and draws way less power. I think 3.1 gen2 (Who came up with that naming scheme?) chips are not yet obtainable for us mere mortals. It seems I was wrong about the 2Amps. It's either 1.5A or 3A and it seems to be part of the USB-C standard rather than USB 3.1 ... gen2. So confusing.
I saw your numpad design. If you are going to put a USB hub in there then we are going to do pretty much the same thing at different form factors. Wanna team up?
Only I want to solder a 32U2 directly on to the board. Already ordered a 30 smd heat gun.^^ Im pretty new to pcb design and I wonder at what point my millions of vias become more expensive than getting a 4 layer board. :)) 

Edit: they changed the names. What used to be 3.0 is now 3.1 gen1 and 3.1 is now 3.1 gen2. Just to screw with people. What you are linking is still a 3.0 speed hub.
« Last Edit: Thu, 18 October 2018, 09:35:08 by Blitzschnitzel »

Offline vvp

  • Posts: 741
Re: Some questions about USB 3.1 currents and ATmega32u2 Power draw.
« Reply #6 on: Thu, 18 October 2018, 06:52:23 »
As far as I can tell there is no hardware limitation to the current in USB 2.0. Just the written spec. So, you should be able to pass through 900mA if you plug a 2,0 chip in a 3.0 port.
You may be able to do it or sometimes not. USB host may not be able to provide 900 mA if the connection is not super speed and there was no power delivery (PD) negotiation. Actually, before USB 2 descriptor is provided you may be able to get only 100 mA without PD.
It is a mess. USB is becoming one of the most complicated standards ever :)

Offline Blitzschnitzel

  • Thread Starter
  • Posts: 32
  • Location: Bremen
Re: Some questions about USB 3.1 currents and ATmega32u2 Power draw.
« Reply #7 on: Thu, 18 October 2018, 08:10:30 »
Oh my god. In the end I will have to run the thing from 3 ports simultaneously.

Offline vvp

  • Posts: 741
Re: Some questions about USB 3.1 currents and ATmega32u2 Power draw.
« Reply #8 on: Thu, 18 October 2018, 16:31:28 »
If you want to run 3 keyboards from one USB then it is definitely doable. My K84CS is taking 30 mA at most and that is including 5 LEDs.
Well, it uses ATxmega128A4U. Not sure about ATmega32u4. In the worst case, use an MCU which is not so power hungry ... if ATmega32u4 is as power hungry as you are afraid. I do not know, I do not have any ATmega32u4 based keyboard around.

You can easily design a keyboard which will run below 10 mA (probably even significantly below 1 mA) without LEDs. And you have 500 mA without a problem. That will do even a lot of LEDs. Use push-pull signalling when possible. If you need pull up/down then use resistors of at least 20 kΩ with 3.3V logic or about 40 kΩ with 5V logic. Those are about the values of internal pull up/down resistors. Prefer internal pull up/down resistors. Do not clock MCU peripherals which you are not using. Halt/sleep MCU when possible.

Offline Blitzschnitzel

  • Thread Starter
  • Posts: 32
  • Location: Bremen
Re: Some questions about USB 3.1 currents and ATmega32u2 Power draw.
« Reply #9 on: Sun, 21 October 2018, 11:21:54 »
Thank you that helps a lot. :)
I have one last question about the max capacitance. USB allows 10P but the opensource USB hub design already uses 15p of decouplers which will multiply when I chain the boards together. If I understand it correctly this is just an issue when the first connection us made. Should I perhaps put a transistor on the Vcc line? So, that the boards get power only when the previous board is finished booting up.

On another note. I ran a reaction diffusion algorithm over the cut outs of my pcb. I think this is going to be the silk screen for the switch side:
205880-0
« Last Edit: Sun, 21 October 2018, 11:24:01 by Blitzschnitzel »

Offline vvp

  • Posts: 741
Re: Some questions about USB 3.1 currents and ATmega32u2 Power draw.
« Reply #10 on: Sun, 21 October 2018, 13:51:34 »
I once broke the 10 μF in parallel with 44 Ω USB limit. I had 20 F capacitor there. It did work. It is possible/probable it would not work when more devices would be hooked to the same USB bus (at once?).
I obey the capacitance limit now.

It is not a big deal. You can use some ICs to limit the inrush current, e.g. NCP380. I did not use them myself. I kept the capacitance below 10 F.

Offline suicidal_orange

  • * Global Moderator
  • Posts: 3147
  • Location: England
Re: Some questions about USB 3.1 currents and ATmega32u2 Power draw.
« Reply #11 on: Mon, 22 October 2018, 04:19:20 »
On another note. I ran a reaction diffusion algorithm over the cut outs of my pcb. I think this is going to be the silk screen for the switch side:
(Attachment Link)

I hope you're using a sane matrix and the back will be blank - attempting to advise newbies where they need to jumper with that craziness would be ... fun? :))
                               
Ducky Zero, MX Reds    JD40, Jailhouse Blues           GH60
Soarer controller