0
\$\begingroup\$

I've made a PCB which contains an Atmega32u4, and just finished soldering it up today. Now, I realised that I bought the wrong Atmega32u4 version - I bought the version which does not by default use its internal oscillator, but which does by default use the USB bootloader. So, I want to change the fuses of the microcontroller to instead use the internal oscillator, since I didn't include an external one on the PCB.

To do so, I downloaded MPLAB, and opened up the MPLAB IPE, then selected the device as "ATmega32U4", and the tool as "Snap" - it detected my SNAP programmer, as it tells me what its serial number is. I went into settings and set the interface to ISP, as this is the interface I included on my PCB (I'll show the schematic later in the post). Then, I went back to the Operate tab, and tried to verify the microcontroller with the Verify button. This returned the following message:

Configuring firmware mode...
Data transmission failed. Error code -112 returned while trying to send USB datat.

A communication error with the debug tool has occurred. The tool will be reset and should re-enumerate shortly.
Connection Failed.
Verify Failed

So it appears that the reason it's failing to verify is something to do with the communication between the computer and the SNAP programmer, rather than between the programmer and the PCB. Does this seem correct? I'm running the IPE on Linux, and have made sure to restart to allow any udev rules to work.

Here's the schematic:

Schematic

The ISP header is J2. Are there any issues with this schematic?

The way I've connected the ISP header, J2, to the SNAP programmer board is as follows:

  • J2 pin 1 -> SNAP pin 4 (MISO)
  • J2 pin 2 -> SNAP pin 2 (VTG
  • J2 pin 3 -> SNAP pin 5 (SCK)
  • J2 pin 4 -> SNAP pin 7 (MOSI)
  • J2 pin 5 -> SNAP pin 6 (RESET)
  • J2 pin 6 -> SNAP pin 3 (GND)

I believe these connections are correct according to page 37 of the SNAP user guide.

Is there anything that could be going wrong here? I really hope I haven't made a mistake somewhere in the PCB!

Important info from comments:

The specific microcontroller I have on the board is the Atmega32u4-AU. The different models are described on page 422 of this document.

I've been thinking about this, and I think the question can boil down to should the Atmega32u4 be able to be programmed over the ISP header even if the MCU itself cannot run on its own clock. Is the ISP still able to program it and set its config bits to make it run on the internal clock?

\$\endgroup\$
8
  • \$\begingroup\$ I don't know, but somehow the naming of PB2 and PB3 triggers me (PB2 is a MOSI and PB3 is a MISO) but they are labeled as a clock line and what ever row 4 is, plus the way they are connected in the schematic gives me the creeps, please tidy it up. \$\endgroup\$ – Sorenp Jun 14 at 17:40
  • \$\begingroup\$ Are you sure about the mcu not having a default internal oscillator ? .. What is the name of your MCU and what is the RCC registers reset value ? \$\endgroup\$ – Sorenp Jun 14 at 17:46
  • \$\begingroup\$ @Sorenp well my understanding of the microcontroller is that all models of the atmega32u4 contain an internal clock, and the product number is just whether by default it uses it or if it tries to use the external clock. Given this, is it impossible to program it over ISP? I thought ISP would be able to program it regardless of this. Maybe not. And yes I'll admit my schematic isn't the cleanest haha \$\endgroup\$ – Jacob Garby Jun 14 at 17:46
  • \$\begingroup\$ @Sorenp The exact name of the microcontroller is the ATMEGA32U4-AU. \$\endgroup\$ – Jacob Garby Jun 14 at 17:47
  • \$\begingroup\$ @Sorenp also, page 422 of this document shows the different models: ww1.microchip.com/downloads/en/DeviceDoc/… \$\endgroup\$ – Jacob Garby Jun 14 at 17:48
1
\$\begingroup\$

See chapter 28.8 of the linked document: The device needs a clock. If yours is set up to use an external clock and you don't provide it, it cannot be programmed. Not even the configuration bits.

\$\endgroup\$
4
  • \$\begingroup\$ Ah, that's unfortunate. I guess my options are soldering on a clock to the atmega's pins (not fun to do), or desoldering the whole atmega and soldering the correct one on (also not fun...). Any advice with that? Thanks for the answer \$\endgroup\$ – Jacob Garby Jun 15 at 14:06
  • \$\begingroup\$ Additonally, it seems that the atmega32u4rc-au is not in stock anywhere on the internet \$\endgroup\$ – Jacob Garby Jun 15 at 14:14
  • \$\begingroup\$ Since you need to do this just once (per PCB, how many will it be?) you could try clip a small probe tip instead of soldering. Another idea is to use a IC probe that gives you access to each pin. \$\endgroup\$ – the busybee Jun 15 at 14:17
  • \$\begingroup\$ To begin with, just one PCB for personal use. I was considering making a small batch but for that I can just buy the correct atmega32u4. That's a good idea, though, I will definitely try that. Thanks! \$\endgroup\$ – Jacob Garby Jun 15 at 14:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.