Help with DIY Aduboy

(This is basically a continuation of my previous updates and info from my schematic for a custom Arduboy)


I soldered everything up, checked the connections on the ATMega32U4 but I’m being thrown this error:
avrdude: Device signature = 0xffffff (probably .avr8x_mega) and avrdude: Yikes! Invalid device signature.

Here’s an additional error output with information:

         Using Port                    : COM5
         Using Programmer              : stk500v1
         Overriding Baud Rate          : 19200
         AVR Part                      : ATmega32U4
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  9000  9000 0x00 0x00
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : STK500
         Description     : Atmel STK500 Version 1.x firmware
         Hardware Version: 2
         Firmware Version: 1.18
         Topcard         : Unknown
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

I’m currently using an Arduino Uno (with ArduinoISP loaded) to both try burning the bootloader and uploading to it using ‘Sketch>Upload Using Programmer’ (suggested my MLXXXp). I’ve also checked the connections between the pins with a multimeter and all of it seems to be correct from my understanding.

I’m also using a bidirectional logic level shifter (5v to 3.3v) for the programming to prevent breaking anything or to use when I get the display.

1 Like

You need to upload ‘Arduino as ISP’ to your Arduino Uno select ‘Arduino as ISP’ as programmer.

2 Likes

As I said in our PM discussion, it may be best to try getting the 32u4 working with only it and its crystal circuit installed. If your board is still as it was in the photo you gave me, this would mean removing the W25Q128 flash chip. All the other passive components (resistors, capacitors, buttons, LEDs, connectors, switch) could be left on, assuming there are no shorts and they’re wired correctly.

It would then be safe to use the ICSP (Arduino UNO) at 5V. You wouldn’t need the level shifter, which would be one less possible source of problems. (Later, when the display and flash chip are installed, you could go back to using the level shifter if further ICSP programming is required.)

If you haven’t been following this document for ICSP programming, you should look it over.

2 Likes

I can’t seem to find a file called that, and many other websites suggest it’s just called ArduinoISP in examples. Isn’t ‘Arduino as ISP’ used when you burn the bootloader to the target through the programmer?

I’ll make sure to keep that in mind for any new ones so that I save the risk of damaging components or wasting time desoldering everything when something doesn’t work.

I’ve seen similar documents about bootloading but that one has a bit more depth.


I’ll give it another go tomorrow. I’ve also adjusted the PCB file to have the pads a bit further out so bridging is hopefully more visible. I’ve also included the ATMega32U4’s large solder pad that I presume may help with either heat dissipation, hold strength to the board, or even both.

MLXXXp might I ask why the 22pF capacitors are placed in such a way on the oscillator? I’ve seen many other designs suggesting to put it on the GND pins of the oscillator. I’m curious as to how it works.

Arduino as ISP is what you set the ‘Programmer’ field as under the Tools menu, for the CPU that will be programming the bootloader.

(This might be either an older or newer version of what @MLXXXp posted earlier.)

(But obviously in your case the bootloader you’ll be burning isn’t the standard one and you’ll need your 5v to 3v circuit in between. Those facts aside, everything else should be the same as in the guide as far as I’m aware.)

I’m having the same problem when I try to burn the Cathy3k bootloader. I’ve seen some sites say to lower the baud rate or connect an external power source, but I tried connecting another power source and it didn’t work. I don’t know about the baud rate however.

Yes, that’s the one. ArduinoISP is a program which must be uploaded to the master (in your case, the UNO).

Yes, you change the programmer to Arduino as isp.

1 Like

Oops I ment to say you need to select the programmer ‘Arduino as ISP’ like @Pharap mentioned.

2 Likes

I think I may have a fix! It worked for me so it may work for you too. Make sure you burn the bootloader while on a blank sketch, not the ArduinoISP one. Not sure if it’s really a fix, but it worked for me. On top of that, I flashed two boards, even after restarted the IDE. This probably sounds fake and like it doesn’t do anything, but it really did wonders for me, I can finally start working on my project. I doubt it was really a fix and might have been a coincidence but it’s best to try out everything :slight_smile: . Cheers!

1 Like

I’m not sure what you’re asking about here. For each capacitor, one side is connected to one of the processor’s XTAL pins and the other side is connected to GND. The crystal itself goes across the two XTAL pins. If the crystal has its own pin(s) to ground its metal case (as yours appears to have), you connect them to GND, as well.

Your oscillator circuit:

ashteroide_xtal

is electrically identical to the Arduboy’s (although the Arduboy uses a crystal that has the capacitors included in its package):

arduboy_xtal

and the one given in the ATmega32U4 datasheet:

atmega_xtal

When laying out an oscillator circuit, you should try to place the crystal and capacitors close to the XTAL pins of the device containing the oscillator driver (which in this case is the ATmega32U4). All the oscillator circuit GND connections should be close to each other, as well.

3 Likes

I’ve seen mentions of connecting a separate power supply. Unfortunately both methods didn’t work.

I have the option chosen but unfortunately no changes.

Unfortunately no change.

I have seem some error logs saying Oscillator: Off so I had a suspicion about it.


Unfortunately no progress, I can only notice a difference between error messages when I connect it directly to 5v and using the logic level shifter, the errors being 0x000000 and 0xffffff and a mention of avr mega 8 or something similar. I also tried using the ISCP header on the Uno in case any of my wiring was incorrect but once again no progress.


I’ve just tried using another Pro Micro as an ISP but unfortunately I get the same error. After a bit of looking I believe there may be a connection error between MOSI or MISO since the fuses are only returning 0 values.

Perhaps a photo of your setup and a log of the error messages would help someone spot what the issue might be?

Just to check, did you remember to set the board to Arduino Uno when you uploaded the ArduinoISP program to your Uno? (And likewise set it to Pro Micro for uploading to the Pro Mirco.)

And did you remember to set it again to the target board (which I think is a Pro Micro in your case?) before burning the bootloader?

Also, are you using the three status lights (‘heartbeat’, ‘error’ and ‘programming’)?

1 Like

I’ll see what I can do, but I might have found the issue.

Yes.

No but I might give those a go, I doubt it’ll prove useful though.


As for my hunt for the issue, I have a backup of the gerber files and schematic from the file I sent to JLCPCB so I’ll have a look through. The MISO and MOSI pins are connected to the ‘W25Q128’ so perhaps that might be reporting something. That unfortunately doesn’t change anything, but I have the chip removed now so I can put it away. A look at the PCB traces and solder connections doesn’t show any bridging effects.

The fuse bits are set to 0 even on a working pro micro so I can rule that out. But their size is 1 compared to the typical 0 I’m getting.

Changing ArduinoIDE to 1.6.13 doesn’t help either.


Connecting the battery to the device (the Arduboy I’m trying to program) and connecting a USB to the port doesn’t give any connection notification. Surely that would work?


Running ‘Burn Bootloader’ without anything connected still gives the same error as having the target connected so something might not be powered.


I may have found the culprit. I switched the ISP programmer to an Arduino Nano and burning the bootloader to a working pro micro to eliminate the possibility that it was the Uno. I believe a GND pin may be shorting since it makes a disconnect sound when connecting the GND wire of the Arduboy. The L LED (built-in LED) also turns off [SUDDEN DRAMATIC LAPTOP SHUT DOWN AND BLUE SCREEN] well… it seems my computer didn’t like it and shut down, so something is doing something bad on my DIY Arduboy.

1 Like

My Thought Process is as Follows:

  1. Tried burning bootloader on both DIY and working pro micro with an Uno, no success on both (Might have been that the Reset was connected to the Unos reset instead of D10)
  2. DIY Arduboy won’t burn bootloader, might be the Uno, I’ll try an Arduino Nano
  3. I burned the bootloader to the working pro micro with the Nano (Connecting RST to D10 on it)
  4. I tried connecting the DIY Arduboy to the Nano (I believe my computer blue screened before this when I was using the Uno)
  5. built-in LED turns off when I connect the GND pin
  6. I tested every other pin to see if it turned on the built-in LED when disconnected, only the GND pin
  7. My computer suddenly shuts down (Though my battery settings may have put in hibernation because my laptop was at 18% when I last checked)

GND should always be the first pin to connect. If not it may cause your reset or even cause damage.

3 Likes

I’ll keep that in mind, but I’m still unsure of what to try next with it. I’ll try connecting it again and see if turns off the LED again. Otherwise I’ll desolder it, clean up the PCB (or try another one), clean off a spare ATMega and try it out again.

A clear detailed photo of your board like @Pharap suggested may reveal something.

as for the atmega32u4 it could set to require an external clock. In that case you need to apply an external clock to pin XTAL1.

2 Likes

Here’s a photo of the board with soldered components (though the resolution and clarity might not be the best so I’ll take a new one tomorrow of both a soldered one and non-soldered one):

The backside contains all the ICSP points, which I’ve soldered some regular wires to. I might do a short circuit test with my multimeter on the wires to make sure they’re actually connected.

I’m not entirely sure what you want me to do, but should I try and upload that sketch attached to the message? I read through completely and I’ll try out connecting a wire to XTAL1 to Pin 9, though how will I actually put the sketch on there? Also how do I go about burning the fuse settings? (Even if that doesn’t work it’d be good to eliminate the possible cause)

If need be I could create a special board to solder the chips to and program them. Something similar to one of these:


(Though I could isolate the atmega to a section of PCB to prevent any heat transfer to other components, a reflow oven is something I really want to get but can’t unfortunately for a few months).

Also notice how the solder joints bridge outwards whereas on mine they’re completely hidden, which is why I’ll modify my design to move the pads outwards a bit. I’m also using a different style of oscillator too, hopefully that doesn’t change anything.


A rough idea but surely basic contact with some pads (maybe with a bit of solder to keep it from being level on the PCB) could work to make an electrical connection? Though they may need a bit of pressure and alignment to keep it connected and inline. I’d be very interested in attempting something like that. It removes the risk of overheating or breaking the component and would be quick to program the chips.

You upload the sketch to a pro micro which you then use to supply the 8MHz clock to your board. You use your Uno or nano as ISP programmer.

Burn the bootloader through the Arduino IDE it will also burn the correct fuse settings.

The default “clock source” fuse settings for the ATmega32U4 is for an external low power crystal oscillator. If the ATmega32U4 is “factory fresh” it should work with (and need) a crystal attached.

You may want to consider changing your board to use the TQFP44 package for the ATmega32U4 instead of the QFN44 package you’re currently using. The pins are quite a bit larger and farther apart, thus easier to solder.


@Ashteroide, here’s how I would proceed with trying to get your board working:
I’m assuming you don’t have an oscilloscope but have a multimeter that can measure voltage and resistance.

Assuming you have removed the W25Q128 flash chip, the level shifter for the ICSP isn’t required. I would leave it out and directly attach your ICSP (Nano) to your board. This will mean ICSP programming power and signals will be 5V.

For all the 32U4 pins, probe them directly using a sewing needle or something similar that allows you to probe the actual pin, not a trace on the board that the pin should be connected to.

Before connecting the ICSP to the board:

  1. Use the multimeter to measure the resistance between VCC and GND on the board to make sure they’re not shorted.
  2. Make sure all the VCC pins of the 32U4 are connected to the point on the board that you are wiring the ICSP VCC (5V) to. Do the same for 32U4 GND pins to the ICSP GND connection.
  3. Make sure there are no shorts between any of the ICSP board connection points (VCC, GND, RESET, SCK, MOSI, MISO).
  4. Make sure the 32U4 RESET pin (13) is connected to the point on the board that you are wiring the ICSP RESET signal to. The same goes for 32U4 SCK (9), MOSI (10) and MISO (11).

If everything above is OK:

  1. Connect only the VCC and GND wires from the ICSP to the board. Just to be safe, make sure GND and VCC still aren’t shorted.
  2. Power up the ICSP and make sure all the actual 32U4 VCC pins are at 5V using an actual 32U4 GND pin for GND.
  3. Power down the ICSP and connect all the other ICSP wires (RESET, SCK, MOSI, MISO).

To further confirm that all the ICSP signals are properly wired to the 32U4:

  1. Program the sketch included at the end of this reply into the Arduino you’re using as an ICSP. This sketch will toggle (only) one of the ICSP signals on for 4 seconds then off for 4 seconds, repeatedly.
  2. With the unchanged sketch loaded, power up the ICSP with it attached to your board. The “pin 13” LED on the ICSP should be toggling on for 4 seconds then off for 4 seconds.
  3. Use the multimeter to measure the voltage between a GND pin on the 32U4 and the 32U4 SCK pin (9). It should toggle between 5V for 4 seconds then 0V for 4 seconds, matching the LED on the ICSP.
  4. Measure voltage between a 32U4 GND and each of the other ICSP signal pins (RESET, MOSI, MISO). They should all remain at 0V while SCK is toggling.
  5. Modify the sketch (by commenting and uncommenting lines 5-8) to toggle the MISO pin and upload it to the ICSP. The LED won’t toggle, so use the multimeter to make sure the MISO pin on the ICSP is toggling between 0V and 5V.
  6. Check that 32U4 MISO (11) is toggling and all other 32U4 ICSP signals are at 0V on the 32U4, as was done above for SCK.
  7. Do the same sketch change and voltage tests for the MOSI and RESET pins.

If all the above looks OK you should be able to burn a sketch or bootloader into the 32U4 using the ArduinoISP sketch in the ICSP. Otherwise, likely either the crystal circuit has wiring problems (miswired, opens, shorts) or the 32U4, crystal, or one of the 22pF capacitors is damaged. There’s also the possibility, as @Mr.Blinky said, that the 32U4 has its fuses set for an external clock instead of a crystal.

//  Pin toggle for ICSP connection testing
//  Turns a pin on for 4 seconds, then off for 4 seconds, repeatedly.

// Uncomment one of these and comment out the other 3 to select a pin to test
#define TEST_PIN 13 /* ICSP SCK. The LED will toggle only for this one */
//#define TEST_PIN 12 /* ICSP MISO */
//#define TEST_PIN 11 /* ICSP MOSI */
//#define TEST_PIN 10 /* ICSP RESET */

#define TOGGLE_TIME 4000 /* 4000ms = 4 seconds */

void setup() {
  // Set all ICSP pins as low outputs
  pinMode(13, OUTPUT);
  digitalWrite(13, LOW);
  pinMode(12, OUTPUT);
  digitalWrite(12, LOW);
  pinMode(11, OUTPUT);
  digitalWrite(11, LOW);
  pinMode(10, OUTPUT);
  digitalWrite(10, LOW);
}

void loop() {
  digitalWrite(TEST_PIN, HIGH);
  delay(TOGGLE_TIME);
  digitalWrite(TEST_PIN, LOW);
  delay(TOGGLE_TIME);
}
1 Like

I understand the 8Mhz clock now, I use a separate pro micro. I’ll give it a go and if it doesn’t work I’ll try out MLXXXp’s methods.

The pro micros I was given would’ve been cheap clones with the Arduino Leonardo bootloader installed.

I have looked into those before, but I found that the chip is really big and would take up a lot of PCB space. I can try moving the pins outwards (I’d even be willing to make a test PCB about how far out they are, even adjusting the width of the pads).

Correct, is that a tool I should add to my arsenal of electrical tools?

I’ll get to it today, I’ve been busy for the past 2 days so I haven’t had time to sit down for a while.

Unlikely since the pro micros were desoldered and all the components were put in the same bag. But you never know, it might be the case.