Micro chip questions

leone edaté

New Tinkerer
Nov 9, 2024
5
0
1
I'm trying to develop a custom keyboard using the atmega32u4 micro chip like so many other people but I want my keyboard to have 2 or 3 more USB ports for a mouse and or some flash drives. Can the previously stated micro controller do that? I'm still pretty new when it comes to development so it's hard to put into words so I can even find what I'm looking for in the data sheet
 

YMK

Active Tinkerer
Nov 8, 2021
358
285
63
Can the previously stated micro controller do that?

No. You would need an MCU with multiple USB host ports for that. If you want to integrate a hub into your keyboard, there are specialized ICs for that purpose. No need to reinvent that wheel. Your 32U4 would then occupy one of the ports of the hub IC.

The MCU functionality you're describing is "USB host" or "OTG".

Having a Total Phase Beagle for USB development is a great help.
 
  • Like
Reactions: JDW

phipli

Tinkerer
Sep 23, 2021
118
117
43
I'm trying to develop a custom keyboard using the atmega32u4 micro chip like so many other people but I want my keyboard to have 2 or 3 more USB ports for a mouse and or some flash drives. Can the previously stated micro controller do that? I'm still pretty new when it comes to development so it's hard to put into words so I can even find what I'm looking for in the data sheet
As YMK says, you wouldn't implement a hub like that.

If I was doing it on a budget, I'd perhaps buy a pre-existing board, remove the connectors or use extension cables internally and call it a day. Something like this might do as a USB 2.0 hub.

1731501914313.png


Just search for CJMCU-204 on eBay or AliExpress. They're pretty cheap.

If you want to integrate that onto your own design, the chip it uses is... the FE1.1S and is available from a few places, if you enjoy buying from AliExpress, there are a number of sellers including this one (not a recommendation, just a random listing) :


I haven't been able to find the specific part available from western electronics providers, although I think LCSC stock it here :

That's good, because if you get your board made and then assembled by JLCPCB, they'll be likely able to fit the part at the factory.

Webpage for the part is here :

The chip datasheet is here :

If you do your own design, you'll have to work out the circuit. If you're lazy and willing to accept any design decisions or errors they made without understanding... you could... cough... buy one of the other boards and measure the parts and beep out the circuit... Or you could read and understand the linked datasheet (a quick look, it doesn't include a reference design).

This post isn't telling you how to do what you're trying to do - this is just a board that I had seen before and never used, and the chip that was on it when I squinted at the photos.

Good luck.
 

phipli

Tinkerer
Sep 23, 2021
118
117
43
AdaFruit has USB hub breakout boards, in 2 ports and 4 ports variants.
They're nice!

The AdaFruit documentation actually includes a schematic, so you could integrate the design, although it might be nice to ask them if it isn't just a straight up reference design from the datasheet (also below, and includes reference designs)


 

leone edaté

New Tinkerer
Nov 9, 2024
5
0
1
As YMK says, you wouldn't implement a hub like that.

If I was doing it on a budget, I'd perhaps buy a pre-existing board, remove the connectors or use extension cables internally and call it a day. Something like this might do as a USB 2.0 hub.

View attachment 18601

Just search for CJMCU-204 on eBay or AliExpress. They're pretty cheap.

If you want to integrate that onto your own design, the chip it uses is... the FE1.1S and is available from a few places, if you enjoy buying from AliExpress, there are a number of sellers including this one (not a recommendation, just a random listing) :


I haven't been able to find the specific part available from western electronics providers, although I think LCSC stock it here :

That's good, because if you get your board made and then assembled by JLCPCB, they'll be likely able to fit the part at the factory.

Webpage for the part is here :

The chip datasheet is here :

If you do your own design, you'll have to work out the circuit. If you're lazy and willing to accept any design decisions or errors they made without understanding... you could... cough... buy one of the other boards and measure the parts and beep out the circuit... Or you could read and understand the linked datasheet (a quick look, it doesn't include a reference design).

This post isn't telling you how to do what you're trying to do - this is just a board that I had seen before and never used, and the chip that was on it when I squinted at the photos.

Good luck.
Is there any way to program both chips through one USB c port or even better is there a single chip I can use for both applications
 

YMK

Active Tinkerer
Nov 8, 2021
358
285
63
The USB hub chips need no programming.

The 32U4 is programmed through its ISP interface using an adapter like the AVRISP. It may have a bootloader that can pull in firmware over USB, but that's usually only for evaluation purposes and not for production.
 

phipli

Tinkerer
Sep 23, 2021
118
117
43
Is there any way to program both chips through one USB c port or even better is there a single chip I can use for both applications
As YMK says, you don't need to program the USB hub chip - it just does its thing.

If you're doing this as a hobby thing and not a commercial enterprise, there isn't really any issue in programming the 32U4 over USB. Even for small volume sales it could be a feature for the homebrew community - flash your own firmware etc.

On that subject, are you making something for yourself? Yourself and friends? Or to sell?

If you're just making something for yourself I'd just put sockets on your board for an Arduino Pro Micro (uses your chip) and use the Adafruit 4 way hub chip @François linked.
 

YMK

Active Tinkerer
Nov 8, 2021
358
285
63
Also, make sure the 32U4 has enough pins for your application.

ATXMega parts are more powerful and have more pins, but use an entirely different USB controller.
 

phipli

Tinkerer
Sep 23, 2021
118
117
43
Also, make sure the 32U4 has enough pins for your application.

ATXMega parts are more powerful and have more pins, but use an entirely different USB controller.
They could probably just use 74xx165s. All they're doing is checking the status of a matrix. I'd assume they're not planning on running every key to a pin.
 

leone edaté

New Tinkerer
Nov 9, 2024
5
0
1
As YMK says, you don't need to program the USB hub chip - it just does its thing.

If you're doing this as a hobby thing and not a commercial enterprise, there isn't really any issue in programming the 32U4 over USB. Even for small volume sales it could be a feature for the homebrew community - flash your own firmware etc.

On that subject, are you making something for yourself? Yourself and friends? Or to sell?

If you're just making something for yourself I'd just put sockets on your board for an Arduino Pro Micro (uses your chip) and use the Adafruit 4 way hub chip @François linked.
At the moment I'm just kinda prototyping. I'm pretty new to how USB works as well as the coding side of it and I'm definitely going to need a lot of practice to be good at making pcb's. But at some point I hope to sell a polished product
 

leone edaté

New Tinkerer
Nov 9, 2024
5
0
1
At the moment I'm just kinda prototyping. I'm pretty new to how USB works as well as the coding side of it and I'm definitely going to need a lot of practice to be good at making pcb's. But at some point I hope to sell a polished product
And I'm not even sure where to post about this but I've been trying to hire someone, preferably in Pennsylvania but not a biggie to do some more in depth PCB work and prototyping. They don't need to be a professional cuz I'm not a professional I'm just looking for someone with skills I can hire to start a business if you know anyone I'm totally interested