Hello all,
Short version: Custom atmega32u4 board has intermittent issues with connecting via serial after a day of working properly with multiple sketch uploads. Issue persists regardless of sketch onboard.
Long version: I have an Atmega32u4 based board that I designed to function as a Joystick. I had the board produced and SMT assembled (PTH components were not assembled - rotary switches, push button switches, and connectors) and I received them a few days ago, at which point I began testing them.
For testing, I uploaded a number of different small sketches to test each of the functions of the board individually before I develop the complete sketch for the project. This included things like: reading shift registers and interpreting them as button presses via Joystick library (GitHub - MHeironimus/ArduinoJoystickLibrary: An Arduino library that adds one or more joysticks to the list of HID devices an Arduino Leonardo or Arduino Micro can support.), doing analog readings of the voltage at the resistor ladder circuits, and testing the LEDs and their communication with a program called SimHub (https://www.simhubdash.com/). This testing was happening off and on over the course of a day.
Everything was going great until the board began having trouble connecting via serial. At first it was disconnecting and reconnecting randomly and eventually got to the point where it wouldn't connect at all. I tried a tons of things to get it back working over the course of another day and a half and eventually got a basic sketch uploaded by holding RESET, starting the sketch upload via USBasp programmer (AVRISP mkII did not work with the same procedure), and then releasing RESET when the compile finished.
At this point I thought all was well and I left it alone for a little bit. Then I came back to it tonight, uploaded the latest version of my project sketch (combining those elements mentioned before) and the connection issues returned. I followed the same procedure to get a basic sketch back on it and it was successful, only now the board with that basic sketch is exhibiting the same connection issues.
So now I am convinced that I either damaged the board during testing or there is an inherent hardware issue that is causing the problem.
Also, I tested my latest project code on a Pro Micro with an 8 LED WS2812B strip and it both appeared as a Joystick and the LEDs worked appropriately with SimHub (bare in mind the other components that the code reference were not connected). So between that and the fact that the issue is persisting regardless of what sketch is uploaded, I am pretty confident my code is not the issue.
Can anyone offer some advise on what may be happening here? I have 4 more of these boards available to me, but I am scared to start messing with them before I know if I killed it or if it is actually a hardware problem. At the end of the day, I need at least 2 fully functioning boards as I am building one for myself and one for my brother - and of course backups would be nice.
I have attached the schematic for the board as well as some other images of the layout/routing. A couple things to note:
- The board has a 5V input which comes from an external power supply. This is for powering the LEDs only. The microcontroller as well as the other components are all powered via 5V from USB instead.
- The board is 4 layers with the internal layers being GND and 5V from the external supply (not USB 5V - USB 5V and external 5V are not connected).
- There are actually two boards attached. One has the microcontroller and a number of other components. The other is just a breakout with additional components, but no controller. They were split this way to aid assembly of the Joystick. Much of the debugging since the issue started has been done without the breakout attached and without 5V external power supply connected. I did verify that the breakout worked prior to the issues starting though.
- There is an SL2.1 USB hub onboard the mainboard. I have tried bypassing this to see if it is interfering and the microcontroller behaves the same as through the hub. I have also demonstrated that the hub works via a separate port with a different USB device.
One last thing, the board says, "Marsh Motorsport" on it. This is not a real company. This is the made up name I put on my DIY sim racing projects for fun. I am in no way planning to sell this or develop it as I consumer product. Just wanted to mention that in case someone feels weird about helping me because of it.
Any help would be greatly appreciated.
UPDATE 1: added schematic images to the main post for better visibility.
breakout.pdf (560.9 KB)
mainboard.pdf (665.6 KB)





