Why 127 max USB devices?

Why can there only be 127 USB devices connected to a computer? And what’s the signifigance of 127?

It is one less than 128.

The real question, is can you find 127 devices you’d want to hook up to your computer?

IANAU (USB expert), but the number 127 strongly suggests that 7 bits of a binary byte or word was allocated for device assignment.

Probably on the (then) logical observation that “who would ever want to connect more than 127 devices to a computer?”

Sorta like, “Who would ever need more than 640K of RAM? Ever??”

Why do you ask? Are you running out of connection possibilities already?

See Project Hydra: the USB Multiheaded Monster

USB packets look like this:

Token:
Packet ID: 8 bits
Address: 7 bits
Endpoint: 4 bits
CRC: 5 bits

Start of frame:
Packet ID: 8 bits
Frame Number: 11 bits
CRC: 5 bits

Data Packet:
Packet ID: 8 bits
Data: 0-1023 bytes
CRC: 16 bits

Handshake:
Packet ID: 8 bits

The exact details of how this is all put together is a bit beyond the technical level of this post, but since the address is only 7 bits, you can only have 128 devices on the entire bus (with 7 bits that can each be on and off, there are only 128 total different combinations of bits possible). This includes your computer, so that leaves 127 other things you can attach to it.

As for why they only chose to allot 7 bits to the address field, keep in mind that this bus was designed to run the keyboard, mouse, printer, and a few accessories attached to your computer (like maybe a scanner or a digital camera). Most people never have more than half a dozen devices attached to their system, so 128 devices is far more than the average person needs.

Address 0 is reserved devices coming out of reset not the computer. For example say you have a hub with 5 devices plugged into it. on reset the hub will listen to address zero. The PC will then send a request to the hub at address 0. This request will ask the hub what it is. The hub will respond that it is a hub. Until the hub is configured it will not pass the requests to the down stream ports. The PC will then assign a non zero address to the hub. The PC will then turn on the first hub port to which something is attached and send a request to address 0 to find out what is attached to that port. Then that device will be assigned a non zero address. This process repeats until all devices are configured.

Hehehe. 640K of Ram? Hi there 2004. 10 years later we don’t even measure in kilobytes anymore, we use gigabytes now. I, at the time of this post, have 16gigs of Ram in my computer and use about 8 during a game and more when multitasking. Don’t ever under estimate how technology will advance. Who knows maybe some day we will have networks where someone will need that many usb connections. Certainly someday someone will make an account on here for fun to make fun of me for the current specs of 2014. I have no doubt that someday there will be terabyte ram, usb networks, and beyond.

lots of fans to cool your overheating computer.

I measure things in individual bytes all the time.

Musicat was referencing a famous quotation from Bill Gates in the 80s. Even in 2004, PCs would use much, much more RAM than that.

1984 to 1989… in 1992 I got a 80386 with 8 megabytes.

c. 1981 even. Though Bill Gates denies ever saying anything like that. More.

I had a 68020 machine with 8GB of RAM in 1987…

You probably meant to type an M there, which would still have been a monster machine for 1987. The 486dx2 I used in the early 90s had that much RAM, and the chip itself was only available in 1992.

A fully loaded ETA10, a beast of a supercomputer in 1987 (with 10 gigaflops of performance! 8 CPUS! liquid nitrogen cooling) could have 2 gigabytes of RAM.

Yeah, M.

I remember a friend who had a conversation with a tech support guy who absolutely would not believe her when she told him she had 32M of RAM in her machine - he thought she didn’t know the difference between RAM and Disk. But, these were Macs used by graphics designers, and they had lots of RAM for Photoshop.

The limit is not 127 devices per computer, but 127 devices per bus. Computers often have multiple USB busses, plus the ability to add more through expansion cards.