1

First of all, I am not an expert on electronics, so forgive me for asking something which is trivial for probably the most of you.

I am trying to get my Arduino (Micro) code running on a custom PCB with the Atmega32U chip on it. The person who made the PCB copied parts of the schematics of the Arduino Micro onto a custom PCB. What he did, is place the Atmega chip on it, and also copied the wiring for the micro USB connector.

That way, I can hook up the PCB to my USB port but now Windows does not recognize the chip as a "Arduino hosted via a COM port", but just as a atmega chip.

I learned that installing Atmel Studio 7 will also provide the correct drivers so that Windows recognizes the chip correctly via USB:

enter image description here

The next step for me was to get my code running on the atmega chip. So with some help from the internet I came to the following steps:

  • open my sketch in Arduino IDE
  • compile with verbose output
  • find the location where the ".HEX" file is stored

But how can I flash this .HEX to the Atmega chip?

2 Answers 2

2

To get your chip to respond to the Arduino environment over USB you need a booloader (some extra code) to be running on the Atmega32.

To install the bootloader you can use another Arduino as a programmer to the ICSP pins (or any other AVR ICSP programmer).
This procedure and description from Sparkfun for the Arduino Pro will help you.

This may help you understand the ICSP aspect, again from Sparkfun.

1
  • Very helpful link, I have an Arduino so will attempt to go for that. I will accept the answer when I got it working. Don't hold your breath waiting, as I said, I am really new on this stuff so it will take me a while :)
    – bas
    Apr 14, 2017 at 19:01
0

You can flash the .hex file to the chip with avrdude.

First, you have to add avrdude to your PATH variables.
This can be done by adding the folder of avrdude.exe to the PATH variables, described in this method.
An example path to your avrdude.exe can be this:
C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\.

Then go to your project where the .hex file lies, and use avrdude to flash the .hex file to the chip.

Example commands can be found on the avrdude website, the description of avrdude flashing can be found here.

My example command that I use in Atmel Studio with an Arduino Mega clone that has an ATmega2560 chip (slightly modified to fit the question:
avrdude.exe -v -p atmega2560 -c wiring -P COM3 -b 115200 -D -U flash:w:<hexfile.hex>:i

4
  • This will only work when the ATmega chip is recognized as a COM port isn't it? (avrdude.exe ........ -P COM3)
    – bas
    Apr 14, 2017 at 18:49
  • Yes, as the other answer pointed out, you are more than likely need to install a bootlader on it and use a programmer to program the device. The Atmel chip cannot function as a COM device while simultenously is being programmed. I use an Arduino Mega clone, I will edit my answer to clear up confusion.
    – domenix
    Apr 14, 2017 at 18:52
  • A programmer can be an USBASP, or an Atmel AVRISP MkII programmer, or another Arduino board if you have one laying around, as the other answer suggested.
    – domenix
    Apr 14, 2017 at 18:56
  • thanks for the commenting, currently reading the links shared by Jack (and learning a lot ! :))
    – bas
    Apr 14, 2017 at 18:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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