How Do You Swich What Board Your Uploading to in Arduino

It probably isn't bricked

I've got quite a few Arduinos, and over the terminal few years have merely ever "bricked" ane, and I recall that was by zapping it with static electricity. Unfortunately that item one had a SMD (surface mounted) processor chip, then it isn't easy to try swapping it with another chip.

Stay at-home, and try the following steps ...


Example board

An "Arduino Uno" is not just one affair that might fail. Information technology has multiple major components, and possibly only one has failed (if any). Encounter this reference photo:

Arduino Uno major components

Major components are:

  • Atmega16U2 processor - this handles the interface to the USB connection
  • Atmega328P processor - this is the "master" processor which has your sketch on it
  • Voltage regulator - this converts incoming power from the power jack to five V
  • Power LED (green) - marked "On"
  • Indicator LED (yellow) marked "L" - connected via an op-amp to digital pivot 13
  • Rx and Tx LEDs (yellowish) - these indicate if the USB scrap (Atmega16U2) is receiving or transmitting

Note that the Rx and Tx LEDs are not connected directly to digital pins 0 and 1 on the board (marked Rx and Tx). They only illuminate if y'all are doing serial communications via USB, non if you have something (like a GPS) plugged direct into digital pins 0 and i.

Also note that since the "L" LED is connected via an op-amp, it may illuminate if pin thirteen is gear up to an input in your sketch. This is normal. It doesn't hateful that something is erroneously sending data.


Check the ability

USB ability

  • Plug the board into your computer with the USB cable and check that the dark-green "On" LED lights up.

  • Utilise a multimeter and a couple of jumper leads to test between the 5V pin and the GND pin (arrowed at the lesser). You should become a reading of effectually v.0 V (I got 5.04 Five on mine).

(Y'all can buy a cheap multimeter for effectually $10 if you don't accept one, but y'all are ameliorate off getting a better one for around $50 - bank check all the electronics web sites and stores.)

  • Likewise test between the three.three Five pin and the GND pivot - y'all should get 3.3 V.

If you do not get 5 V with the USB cable plugged in brand sure the other end is connected to your computer. Also attempt a different cable.

Power jack

  • If you are using, or planning to utilize, the power jack (marked "power in" on the photo) disconnect the USB, and plug in a power supply - which should be 7 to 12 V DC with positive on the center pin.

  • Mensurate the five V and three.three 5 pins as higher up. Y'all should still meet the aforementioned voltages on them.

If y'all become 5 Five with the USB continued, but not with the power supply and then the voltage regulator (marked on the photograph) is probably damaged. Or, possibly the power supply has failed. Try a different ability supply to confirm which it is.


Bank check the power-on LED wink

If you have the Optiboot bootloader (the Uno normally ships with that) then if you press and release the Reset button, or unplug and plug the USB or power cablevision back in, the "L" LED should flash quickly 3 times. The "on" and "off" times are 50 ms each, the 3 flashes should exist over inside about one/3 of a 2d.

If it doesn't, you may take a problem with the bootloader, or the chief processor flake (Atmega328P).


Try uploading a sketch

Important: If you are having trouble uploading sketches remove any connected devices (like shields). As well remove jumper wires plugged into the board sockets. In particular, there should be nothing plugged into digital pins 0 and 1 (Rx and Tx) because that will interfere with communicating with the uploading computer.

Choose ane of the unproblematic instance sketches (eg. Blink) and try to upload it. This is what you should come across:

  • The "50" LED should flash 3 times. This is because the main chip is existence reset past a command from the uploading process.

  • The "Rx" LED should wink chop-chop. This is the instructions from the uploading process trying to activate the bootloader.

  • The "Tx" LED should flash quickly. This is the processor acknowledging the uploaded data.

You may encounter the to a higher place, even if the uploading procedure fails. This could be because the wrong board type is selected.

If only the "Rx" LED flashes, it could exist considering of a problem with the bootloader, or the main processor flake (Atmega328P). Someone is knocking, but no-one is at habitation!

Check the board blazon

If the LEDs flash, but yous get a message like this:

          avrdude: stk500_recv(): programmer is not responding                  

Check the board type:

Board type menu

If you have the incorrect lath blazon selected it volition probably send the wrong uploading instructions, and fourth dimension-out or otherwise fail. If you are like me and have unlike boards lying around it is easy to forget that the concluding upload y'all did was for a different lath type.

Cheque the comm port

If the LEDs don't flash at all, you lot may have the wrong comm port selected.

Bank check the comm port:

Comm port menu

Endeavor a different PC / Mac if possible

Attempt your Arduino on a different PC/Mac if you lot have one to mitt. This can narrow down whether or not you lot have an issue with the particular estimator y'all take plugged it into, or computers in general.

Do a loopback exam

  • Disconnect all shields and other wires
  • Remove the lath from the ability
  • Connect a jumper wire from RESET to GND (orange wire in photo)
  • Connect a jumper wire from Rx to Tx (white wire in photograph)

Wiring:

Loopback test

  • Plug in the USB cable, and first up a terminal program - such as the Final Monitor in the Arduino IDE. Type something and ship it (eg. hit Enter in the Final Monitor).
  • Everything y'all type should be echoed back.

If everything is echoed dorsum: That confirms yous have the right comm port, the USB cablevision is OK and the USB interface scrap (Atmega16U2) is probably OK.

If nil is echoed dorsum, check:

  • You have the correct comm port.
  • Try a different cable. Some cheap USB cables but take power wires and non data wires.
  • Cheque the device commuter for the Arduino is installed. You probably don't need to practice this if that board worked previously on this computer, but it can exist worth doing if this is the commencement time you plugged this board into this computer.

Test the Atmega16U2 flake

If your lath fails the loop-back test, and y'all are certain the USB cable is OK, then you lot can exam the Atmega16U2 fleck itself. There is an ICSP (In Circuit Serial Programming) header on the board, adjacent to the Atmega16U2 chip, and almost the USB socket.

Disconnect the power offset (unplug the USB cable and whatsoever power cable).

And so you tin can connect the ICSP header via 6 jumper wires to a known good Uno, as shown in the photo:

Test the Atmega16U2 chip

The pivot-outs for the ICSP header are (from the acme):

ICSP header

Pin i on the ICSP header nigh the Atmega16U2 chip is marked with a small white dot, nigh the "F" in "AREF". Pin 1 on the ICSP header near the ATmega328P chip is marked with a small white dot, below the "Northward" in "ON".

Connect up:

          Proficient board         Target Uno    MISO                MISO    (pin with dot - pivot 1)   VCC                 VCC   SCK                 SCK   MOSI                MOSI   D10                 /RESET   GND                 GND                  

Double-bank check your wiring.

And then on the "known skillful" board install the "Atmega_Board_Detector" sketch as described on the Atmega bootloader programmer page. The code is at GitHub - nickgammon/arduino_sketches. If yous click the Download button on that folio you will get a number of useful sketches. The one you desire is chosen "Atmega_Board_Detector".

Once installed, open the serial monitor, set information technology to 115200 baud, and yous should see something like this:

          Atmega chip detector. Written by Nick Gammon. Version ane.17 Compiled on Jul  ix 2015 at 08:36:24 with Arduino IDE 10604. Attempting to enter ICSP programming way ... Entered programming fashion OK. Signature = 0x1E 0x94 0x89 Processor = ATmega16U2 Wink retentivity size = 16384 bytes. LFuse = 0xEF HFuse = 0xD9 EFuse = 0xF4 Lock byte = 0xCF Clock calibration = 0x51 Bootloader in employ: No EEPROM preserved through erase: No Watchdog timer always on: No Bootloader is 4096 bytes starting at 3000  Bootloader:  3000: 0x4B 0xC0 0x00 0x00 0x64 0xC0 0x00 0x00 0x62 0xC0 0x00 0x00 0x60 0xC0 0x00 0x00 3010: 0x5E 0xC0 0x00 0x00 0x5C 0xC0 0x00 0x00 0x5A 0xC0 0x00 0x00 0x58 0xC0 0x00 0x00 3020: 0x56 0xC0 0x00 0x00 0x54 0xC0 0x00 0x00 0x52 0xC0 0x00 0x00 0xEE 0xC4 0x00 0x00 ... 3FE0: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 3FF0: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF  MD5 sum of bootloader = 0xD8 0x8C 0x70 0x6D 0xFE 0x1F 0xDC 0x38 0x82 0x1E 0xCE 0xAE 0x23 0xB2 0xE6 0xE7 Bootloader proper noun: Arduino-dfu-usbserial-atmega16u2-Uno-Rev3  First 256 bytes of program memory:  0: 0x90 0xC0 0x00 0x00 0xA9 0xC0 0x00 0x00 0xA7 0xC0 0x00 0x00 0xA5 0xC0 0x00 0x00 ten: 0xA3 0xC0 0x00 0x00 0xA1 0xC0 0x00 0x00 0x9F 0xC0 0x00 0x00 0x9D 0xC0 0x00 0x00 xx: 0x9B 0xC0 0x00 0x00 0x99 0xC0 0x00 0x00 0x97 0xC0 0x00 0x00 0x48 0xC4 0x00 0x00 30: 0x0C 0xC4 0x00 0x00 0x91 0xC0 0x00 0x00 0x8F 0xC0 0x00 0x00 0x8D 0xC0 0x00 0x00 ...                  

However if y'all become a message like this:

          "Failed to enter programming mode. Double-check wiring!"                  

That would appear to betoken that your ATmega16U2 is not working.


Test the ATmega328P chip

Disconnect the power from the "known skilful" Arduino Uno and rewire the ICSP jumpers as per this photo, to connect them to the "main" processor on your Uno:

Test the ATmega328P chip

The pin-outs for the ICSP header are (from the meridian):

ICSP header

Pin 1 on the ICSP header about the ATmega328P chip is marked with a minor white dot, below the "N" in "ON".

The wiring is the same as before, except y'all are connecting to the other ICSP header - the 1 at the stop of the board, furthest from the USB socket.

          Good lath       Target Uno    MISO                MISO    (pin with dot - pin 1)   VCC                 VCC   SCK                 SCK   MOSI                MOSI   D10                 /RESET   GND                 GND                  

Once continued, open the serial monitor, set it to 115200 baud, and you should see something similar this:

          Atmega chip detector. Written by Nick Gammon. Version one.17 Compiled on Jul  9 2015 at 08:36:24 with Arduino IDE 10604. Attempting to enter ICSP programming fashion ... Entered programming mode OK. Signature = 0x1E 0x95 0x0F Processor = ATmega328P Wink memory size = 32768 bytes. LFuse = 0xFF HFuse = 0xDE EFuse = 0xFD Lock byte = 0xEF Clock scale = 0x83 Bootloader in use: Yes EEPROM preserved through erase: No Watchdog timer always on: No Bootloader is 512 bytes starting at 7E00  Bootloader:  7E00: 0x11 0x24 0x84 0xB7 0x14 0xBE 0x81 0xFF 0xF0 0xD0 0x85 0xE0 0x80 0x93 0x81 0x00 7E10: 0x82 0xE0 0x80 0x93 0xC0 0x00 0x88 0xE1 0x80 0x93 0xC1 0x00 0x86 0xE0 0x80 0x93 ...  MD5 sum of bootloader = 0xFB 0xF4 0x9B 0x7B 0x59 0x73 0x7F 0x65 0xE8 0xD0 0xF8 0xA5 0x08 0x12 0xE7 0x9F Bootloader proper name: optiboot_atmega328  First 256 bytes of plan retention:  0: 0x0C 0x94 0x35 0x00 0x0C 0x94 0x5D 0x00 0x0C 0x94 0x5D 0x00 0x0C 0x94 0x5D 0x00 ten: 0x0C 0x94 0x5D 0x00 0x0C 0x94 0x5D 0x00 0x0C 0x94 0x5D 0x00 0x0C 0x94 0x5D 0x00 20: 0x0C 0x94 0x5D 0x00 0x0C 0x94 0x5D 0x00 0x0C 0x94 0x5D 0x00 0x0C 0x94 0x5D 0x00 30: 0x0C 0x94 0x5D 0x00 0x0C 0x94 0x5D 0x00 0x0C 0x94 0x5D 0x00 0x0C 0x94 0x5D 0x00 ...                  

In this case it confirms that the principal processor is working, and has the Optiboot bootloader on information technology.


Things you can fix

Failed voltage regulator

This isn't easy to replace, but information technology is just needed if you use the power jack. If you run from USB then it is not required. Alternatively y'all could conform for a 4 to five V supply (eg. iii 10 AA batteries) and connect them to the 5 V socket on the lath directly.


Failed ATmega16U2 chip

This is merely required for uploading sketches via the USB port, and serial debugging. Information technology isn't specially easy to supersede considering it is a SMD (surface mounted device). All the same you tin manage without it.

You can upload sketches via the ICSP header, if you buy a ICSP programming device.

Examples of such devices plugged into the ICSP socket:

USBtinyISP

AVRISP

(Those photos were taken of a Ruggeduino, just the concept is the same).


Y'all can also become an FTDI cable, like this:

Connect FTDI to Arduino

Connect it to your board'south serial ports like this:

FTDI cable

          FTDI    Arduino Uno  GND       GND  (black wire on FTDI cable, bluish jumper wire) CTS       not connected VCC       5V TxD       D0 (RX) RxD       D1 (TX) RTS       To RESET with a 0.i µF capacitor in series with it (greenish wire)                  

Now you lot tin can upload sketches directly to the main processor, bypassing the USB fleck.


You can also utilise my Atmega chip stand-lonely programmer to upload .hex files - this lets you copy the .hex file for a sketch onto an SD card, so programme the board via the ICSP header.


Failed ATmega328P scrap

The chief processor tin be replaced fairly easily if it is mounted in a socket. Become a replacement chip from somewhere like Adafruit for around $US half dozen. Alternatively, endeavor eBay. Try to go a chip which has the Optiboot bootloader already on it, to save hassle.

Advisedly prise the existing chip out of the socket, and install the new one, taking note of the location of pivot 1. Pivot i has a notch on the bit, and its correct orientation is noted on the outset photo in this mail with a yellow dot (closest to the edge of the board). You will probably need to straighten the legs slightly. Hold the chip by the ends and gently push down onto a apartment surface, like a desk, until the are pushed inwards a bit. Try to not touch on the metal pins, yous may zap them with static electricity.


ATmega328P responds but has no bootloader

I take a sketch at Atmega bootloader programmer which will replace the Optiboot bootloader. The wiring is the same as for the chip detector sketch. The code is at GitHub - nickgammon/arduino_sketches. If you click the Download button on that folio yous volition get a number of useful sketches. The one yous want is called "Atmega_Board_Programmer".

Install the sketch on your "known good" Uno, and connect it to the target lath with the wiring shown earlier.

Test the ATmega328P chip

Open the Serial Monitor on your "skillful" Uno and y'all should see this:

          Atmega chip programmer. Written by Nick Gammon. Version 1.35 Compiled on Jul  9 2015 at 15:06:58 with Arduino IDE 10604. Attempting to enter ICSP programming way ... Entered programming manner OK. Signature = 0x1E 0x95 0x0F Processor = ATmega328P Flash retention size = 32768 bytes. LFuse = 0xFF HFuse = 0xDE EFuse = 0xFD Lock byte = 0xEF Clock scale = 0x83 Type 'L' to use Lilypad (viii MHz) loader, or 'U' for Uno (16 MHz) loader ...                  

Type "U" for the Uno (Optiboot) loader.

          Using Uno Optiboot 16 MHz loader. Bootloader address = 0x7E00 Bootloader length = 512 bytes. Type 'Q' to quit, 'V' to verify, or 'G' to program the flake with the bootloader ...                  

Type "Thou" to program the scrap.

You should come across:

          Erasing chip ... Writing bootloader ... Committing page starting at 0x7E00 Committing folio starting at 0x7E80 Committing page starting at 0x7F00 Committing page starting at 0x7F80 Written. Verifying ... No errors plant. Writing fuses ... LFuse = 0xFF HFuse = 0xDE EFuse = 0xFD Lock byte = 0xEF Clock calibration = 0x83 Washed. Programming way off. Type 'C' when ready to continue with some other chip ...                  

This takes about one second. Now the bootloader is installed.


Watchdog timer problems

The watchdog timer (off past default) tin can be configured to reset the processor later a certain time. The intention is to recover from a "hang" for a processor deployed in the field. However if the timer is set up for a short period (like xvi ms) then the processor tin reset again earlier the bootloader has a chance to practice annihilation.

The symptoms are that y'all cannot upload any new sketches. Some modern bootloaders (like Optiboot) take steps to terminate this problem as ane of the first things they practice. However others do non.

This tin exist difficult to recover from, considering in one case the sketch runs, you lot have the trouble of it resetting, and if you accept the problem you lot can't supplant the sketch. People often report that they have to burn a new bootloader to recover. However that is just considering, equally a side-effect, burning a bootloader erases the electric current sketch.

In that location is a way of recovering. Take these steps:

  • Ability off the lath completely (remove the USB cable).
  • Concord down the Reset push button, and keep it held down (or, run a jumper wire from the RESET pin to the GND pin). This stops the problem sketch from starting, and thus activating the watchdog timer
  • Withal property down Reset, reconnect the USB cablevision.
  • Outset uploading a sketch that does non have this problem (eg. Glimmer)
  • Once the IDE reports "Uploading" release the Reset button (or remove the jumper wire).
  • It should now upload OK - equally the sketch which activated the watchdog timer never started.

Problems with the Mega2560 upload

I mention this here, even though this postal service is actually targetting the Uno board, because it is quite common.

Some versions of the Mega2560 bootloader look for "!!!" in the incoming upload from the PC, and if they see that, drop into debugging mode. This causes the upload to fail.

Instance code:

          Series.println ("Furnace overheating!!!");                  

Solutions:

  • Install a more recent bootloader. My "bootloader uploader" sketch mentioned earlier in this reply should install a bootloader that does non have that effect.

Or (more simply):

  • Practice not apply "!!!" in your sketch.

Problems uploading to the Leonardo / Micro / Esplora etc.

Boards with the ATmega32u4 equally their main (and just) processor can be trickier to upload to. This is because the aforementioned bit has to handle uploads and also run your code.

In that location is a modest window of opportunity, after the board is reset, when it looks for a new sketch to be uploaded. The technique for uploading to these boards is:

  • Compile your sketch without errors.
  • Start the upload
  • Every bit before long as the IDE reports "Uploading" printing and release the Reset push.

You lot simply take a second or then to exercise this, before the old sketch starts running. Don't exist discouraged if you accept to repeat this process a couple of times. That is normal.


References

  • Solving problems with uploading programs to your Arduino
  • Sketch to detect Atmega scrap types
  • GitHub site with fleck detector / bootloader developer
  • Atmega bootloader programmer
  • Atmega chip stand-alone developer to upload .hex files
  • Engbedded Atmel AVR® Fuse Computer
  • Arduino Uno Rev3 pinouts photo

hardinspromilt77.blogspot.com

Source: https://arduino.stackexchange.com/questions/13292/have-i-bricked-my-arduino-uno-problems-with-uploading-to-board/

0 Response to "How Do You Swich What Board Your Uploading to in Arduino"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel