Need help with Atmega32U4 project - Page 1
Forum section: electronics / projects

author: AlbertoR
author_rank: Newbie
timestamp: March 16, 2021, 10:39:56 pm
content: Hello everyone, I am new to the forum and would like some help with a project I am working on.I'm using an Atmega32U4 to use as an Arduino and a FE1.1S USB hub. I decided to only use one pin of the 32U4(I know, what a waste) to control some LEDs and use the FE1.1S hub so that I can use another board for buttons. It is my first time making a project with the 32U4 but I have used the USB hub in the past with success.I managed to flash the Arduino Leonardo bootloader to the MCU with an Arduino Uno but my problem is that I can only get it to work sporadically. It then stopped working and I could not upload any code, it would begin to upload but then disconnect. I did noticed that I connected pin 21 to the capacitor instead of pin 26 on the USB hub. I don't know if connecting the wrong pin to the capacitor is what is causing the problem or if I connected something wrong on the PCB.I will attach the pictures of the schematic and the layers of the board(Please excuse the amateur schematic and routing). Any help is greatly appreciated.

author: Electro707
author_rank: Contributor
timestamp: March 17, 2021, 07:28:51 am
content: As for the capacitor, pin21 is connected to pin26 thru a trace anyways.Is the 32U still programmable thru the ISP header after not being able to upload to it (I'm assuming when you said that you meant thru USB)A schematic would be nice (isn't included with the post)

author: AlbertoR
author_rank: Newbie
timestamp: March 17, 2021, 03:01:46 pm
content: I knew I forgot something. Sorry about that.I also forgot to mention that when I first connected the board(no Arduino bootloader) through USB, it kept connecting and disconnecting and saying that the previous device malfunctioned. I don't know if that is normal behavior or if that is also a problem.Yes, I was trying to upload code through USB. I can burn the bootloader through the ISP header but can't upload code through it, I keep getting an error.

author: Electro707
author_rank: Contributor
timestamp: March 18, 2021, 06:01:30 am
content: Alright I'm going to assume that the USB hub chip is wired all right on the schematic as you've said you've used it beforehand (I'm not personally familiar with that IC).The only thing that I can see with the ATmega32 is the ground connection to PE2. Just looking at the Arduino Leonardo schematic for reference they use a 10k pulldown, so thatmightbe a possibilty for some trouble (altough I doubt it).You said before you even uploaded the bootloader you computer was acting strange with the USB device, and I see some WS2812s on the side of your schematic. Perhaps a current draw issue (usb could only support 100-500mA supply nominally)?

author: AlbertoR
author_rank: Newbie
timestamp: March 18, 2021, 04:09:58 pm
content: Hmm, that could be a possibility but can four LEDs really draw that much current? I'm using PL9823 LEDs. From what I've read, it looks like they're just WS2812s but in a different package.Only thing I can think of now is that the USB hub chip got damaged when I was soldering it on or I just got a bad one. I'm gonna do another board with a new FE1.1S and without LEDs and see if it works. I'll report back. Thank you for the help.

author: djerickson
author_rank: Regular Contributor
timestamp: March 21, 2021, 01:49:21 pm
content: I too like the MEGA32U4. My LeoLed panel meter projecthttps://djerickson.com/leoled/uses it. You can view my PCB layout there, but it is in Diptrace.Your grounding and ground plane look good. But your power routing is not ideal. I suspect that is your problem. I don't like to see 10 thou traces for VCC, because they have high inductance. And for a digital design, star power (traces run back to a common point) is not necessary. For low current VCC on 2 layer boards, I generally use a single 20-30 thou trace that meanders around to connect all power loads. And bypassing should be near the IC, not over an inch of 10 mil traces away. It is a good idea to use one bypass cap per power pin.Try adding 1 or 2 bypass caps near the IC power pins and with short grounds.Hope this helps,Dave Erickson

author: AlbertoR
author_rank: Newbie
timestamp: March 21, 2021, 04:49:43 pm
content: I tested a new board without any LEDs, just the MCU and USB hub. It was still connecting and disconnecting when connected to USB but I was able to upload the bootloader with the Uno. When it finished uploading the bootloader, the MCU kept connecting and disconnecting as an Arduino Leonardo. I disconnected everything from the ISP header and connected it to USB but Windows says it doesn't recognize the device.I'm going to bypass the USB hub and see what I get.

author: AlbertoR
author_rank: Newbie
timestamp: March 21, 2021, 05:39:53 pm
content: Got an update. No connecting and disconnecting when I first plugged it into the computer and I was able to upload the bootloader just fine. Disconnected everything from the ISP header and connected it again to USB and it popped up as Arduino Leonardo. Soldered the LEDs to the board and uploaded code to it to make sure it works and it does! Everything is working fine now.It looks like I either connected something wrong on the USB hub or the MCU doesn't like being connected to the FE1.1S. I'm going to try and see why it's not working with USB hub. I'll report back if I find anything. Thank you to everyone for the help. I'm still going to revise the board and make changes to the routing and placement of components.