Go Down

Topic: Error uploading code to Feather 32u4 using programmer Arduino as ISP (Read 151 times) previous topic - next topic

grpinto

Hi,

I can't upload code to Feather 32u4 using programmer Arduino as ISP or any programmer available. I can upload code if i use upload directly, i canĀ“t if i try to upload using a programmer.

Is it normal with Feather 32u4?

pert

Do you have an actual ISP programmer attached to your Feather 32U4?

grpinto

Hi,

ok, i've been studying the toturials and now i realized i don't have an isp programmer Attached.

I still don't understand very well what an ISP Programmer is for, but I will continue to study.

Thanks

pert

When you do a regular upload over the USB cable of your Feather 32U4, your computer is communicating with a special program in the memory of the ATmega3U4 microcontroller which receives data and writes it to the flash memory of the microcontroller. This program is called the "bootloader".

But when you buy an ATmega32U4 fresh from the factory, the flash memory is empty. There is no bootloader. So how do you get the bootloader on the chip? Using an ISP programmer. This is a piece of hardware that is able to directly to the microcontroller to write to flash without the need for any program running on the microcontroller. Adafruit programmed your Feather 32U4 using an ISP programmer before they shipped it to you. So ISP programmers are necessary to do what we call "burn bootloader".

Your Feather 32U4 has a microcontroller with a native USB interface, and a USB socket wired to that microcontroller. This allows the microcontroller to communicate directly with your computer. But some microcontrollers don't have this capability. It is possible to use a separate chip as a USB interface, but if you have a project that doesn't need a USB interface, that just adds unnecessary complexity and cost. The solution is to use an ISP programmer to upload your program to the microcontroller. It's less convenient to connect an ISP programmer if you're doing development work and constantly need to be uploading new sketches, but once you get to the point where the program is reasonably stable, you will only need to upload it to the final project once, or infrequently, so it's no big deal to get out the ISP programmer.

The bootloader uses up some of your flash memory. On your Feather 32U4, it is using 2 of the 32 kB of flash memory. If you are only uploading a program once, or infrequently, that's a lot of memory to lose to code you don't even use. This is especially true for the microcontrollers with more limited memory resources (e.g., ATtiny), where the bootloader might use up a significant amount of the flash memory.

The average Arduino user has no need for an ISP programmer. Most Arduino users would only use one to try to recover their board if something went wrong. But I have found the circumstances that would break the bootloader without permanently damaging the hardware are quite rare. Often when people spend a lot of time trying to use an ISP programmer to fix their board, it's just a vain attempt to put the "magic smoke" back in the chip after it's been fried.

There are some cool alternative bootloaders that give special powers to your Arduino board. For example the Ariadne bootloader allows you to upload to your Arduino through an Ethernet connection. You need an ISP programmer to change the bootloader on your Arduino board.

You can turn a spare Arduino board into an "Arduino as ISP" programmer:
https://www.arduino.cc/en/Tutorial/ArduinoISP



grpinto

Now I understand.  Very clarifying explanation. 

I am taking the first steps and these pushes are very important.

Thank you for your help.

pert

You're welcome!

Alternative bootloaders and the other powers an ISP programmer gives you are fun to play around with. I certainly couldn't live without my trusty USBasp programmer. But for someone just getting started with Arduino I would recommend not messing with programmers yet because likely none of that is essential, and could end up being a tangent that distracts from achieving their immediate goals.

One thing to note is that the Arduino IDE's Tools > Programmer menu is only used when you do a Tools > Burn Bootloader or a Sketch > Upload Using Programmer. People tend to waste time trying every single Tools > Programmer menu option when they are having an error with a standard Upload, when really the Tools > Programmer menu selection is completely ignored when you do that.

Go Up