Arduino Zero Fuses

I can't seem to program the fuses on my genuine Zero or my custom board. I can upload the program just fine using Atmel Studio and the Arduino IDE (1.6.3 and 1.6.5).

I am using the Atmel-ICE.

What's going on?

I still can't get it to work. Is there some special order I should be doing the fuse programming? Do these chips come locked and I need to unlock a special fuse first? Can someone send me a link to a fuse map? The datasheet does not seem to have a central easy description of each fuse.

Thank you for any help!

EDIT:I also can't set the fuses using the EDBG on the Zero....

So apparently the fuses I was trying to set can only be set by the Atmel factory....I wish Atmel Studio would tell me that...

Anyways, I was trying to match the fuses on my custom board with the Zero because once I try to upload a program over USB, I lose the comport and nothing happens. Once I re-upload the bootloader, the comport comes back.

It seems that the bootloader is being overwritten, but I don't know which fuses to set to solve this.

When is it you lose the comport?

I was having a similar issue with one of the prototypes of my Neutrino, where after burning the bootloader, I would upload a sketch only to have the board disconnect from the PC, and the sketch fail to execute.

It turned out the problem was that the PCB manufacturer had flipped the capacitors for the crystal sideways. This caused the crystal to not oscillate. Which is fine when uploading the sketch because the fuse settings in the bootloader don't use the crystal, they use the internal resonator. But when the sketch runs, all these fuses are reset and the external crystal is then used.

So if you rolled your own board, I'd check that your crystal and fuses are wired up right.

Thank you for the reply,

Are you talking about the 32khz crystal? I thought this was just used to get an accurate time? I left it out of my design...

Yes. If you don't have the crystal, you'll have to modify startup.c which contains the fuse settings that are run when your sketch begins after the bootloader executes. By default, the crystal is used to enhance the accuracy of the cpu clock. It's not just used for timekeeping.

See this thread for details: http://forum.arduino.cc/index.php?topic=331052.0

That looks to be a daunting task, I'm going to try to solder a crystal on there some how...

The first PCB always has something wrong with it. :o

So I have my new PCB assembled with the crystal. I can upload something every once in a while.

When I upload the arduino.org zero bootloader, the USB connection resets at a constant rate of ~1Hz, never stopping. I assume the uC is resetting on connect for some reason.

99% of tries results in a verify error. I can read the fuses just fine, and erase the chip...

I have figured out a way to program the uC, and I know for sure the flash is written properly by reading it back in AS. I have uploaded the bootloader and I get no USB activity.

Perhaps you reversed the pins on the USB data lines? Or you haven't installed the appropriate drivers so the board is recognized? Do you have a Zero that CAN be programmed with USB? Did you use the bootloader that comes with the Arduino IDE you have or did you use the Zero Pro / M0 bootloader, which is different?

scswift, thanks for the reply.

I have switched out the uC for a new one and I can upload reliably now. I also get a USB device if I upload the arduino.cc or the arduino.org bootloader. However, I get errors when trying to program over USB using Atmel studio (with arduino plug-in), arduino.org IDE, or arduino.cc IDE. Uploading the below code in AS using the ICE results in instant loss of USB connection. Is this correct?

void setup() { SerialUSB.begin(57600); while (!SerialUSB); }

void loop() { SerialUSB.println("Hello");

}

EDIT: So I can upload the arduino.cc bootloader to the Zero using arduino.cc IDE and it works flawlessly. When I upload the bootloader to my board, I can here the USB connection "ding" repeat at around 1 Hz. It seems like the board is continually resetting.

EDIT2: Works now lol. Final problem was a loose connection on the reset resistor (0402)