Using Arduino > Installation & Troubleshooting

Arduino uno rev3 board came unprogrammed; usb-serial interface malfunctionning?

(1/5) > >>

z80a:
Hi,

I was recently given a brand new Arduino Uno rev 3 board for tests.
Note that, although I have some experience with a few MCUs (mostly from Microchip), this is my first time with Arduino.

At first, nothing worked at all, I did not even have the ttyACM0 device (I am a linux user) on the computer where the Arduino was plugged. In fact, the device identified itself as "ATmega16u2 DFU". I came to the conclusion that the ATmega16u2 chip came unprogrammed. So I used dfu-programmer to program it with the Arduino-usbserial-atmega16u2-Uno-Rev3.hex firmware I found at
https://github.com/arduino/Arduino/tree/6e8e13d7b3679775dae70d9066f05e2f314fe1c1/hardware/arduino/firmwares/arduino-usbserial

Then I got the ttyACM0 device as expected, and the Arduino Uno board seemed to be seen as expected by the Arduino IDE. But when I try to upload a sketch (the Blink example), it fails with "avrdude: stk500_recv(): programmer is not responding". Investigating a bit, I read somewhere that the L led was supposed to blink a few times on startup, which did not happen. I thought that the atmega328p also came unprogrammed. So I found an AVRISP mkII programmer, to inject the arduino bootloader into the atmega328p chip, with "Tools/Burn Bootloader".

I now get the expected blinking, but I still cannot upload: I still get the same "avrdude: stk500_recv(): programmer is not responding" error.

I tried "Upload Using Programmer", and that works fine: I can upload sketches to the atmega328p through the AVRISP mkII programmer. So its seems to me that the atmega328p part is fine.

I followed the "Loop-Back Test Instructions", but did not get back the characters I typed. I plugged a scope to the loop between pins 0 and 1 and found out that, after the start bit (to logical level 0), only the first five bits (where first means least significant, as standard serial ports are LSB-first) get sent, instead of 8 bits... It looks to me that this would explain why the loopback test fails and why uploading fails.

Looking at the makefile in https://github.com/arduino/Arduino/blob/6e8e13d7b3679775dae70d9066f05e2f314fe1c1/hardware/arduino/firmwares/arduino-usbserial/makefile it seems that something should be written to the EEPROM of the atmega16u2 chip, but I could not find that data anywhere. Is that true? Where can I find that data? Can this explain why the usb-serial interface does not work as expected?

Any help is highly welcome.

Nick Gammon:
Your description suggests that the main processor is OK, which is why you can program via the ISP interface, but not the 16U2 processor.

I'm not sure that is the correct file to upload to the USB chip.

Isn't it: Arduino-COMBINED-dfu-usbserial-atmega16u2-Mega2560-Rev3.hex Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex

Also make sure the fuses are correct in the 16U2 chip. Mine are:


--- Code: ---LFuse = 0xEF
HFuse = 0xD9
EFuse = 0xF4
Lock byte = 0xCF
--- End code ---



--- Quote ---it seems that something should be written to the EEPROM of the atmega16u2 chip
--- End quote ---


I haven't heard of that. A quick check of my 16U2 EEPROM shows it not written to (all 0xFF).

z80a:

--- Quote from: Nick Gammon on May 27, 2012, 01:11 am ---
Your description suggests that the main processor is OK, which is why you can program via the ISP interface, but not the 16U2 processor.

--- End quote ---

100% agree

--- Quote from: Nick Gammon on May 27, 2012, 01:11 am ---
I'm not sure that is the correct file to upload to the USB chip.

Isn't it: Arduino-COMBINED-dfu-usbserial-atmega16u2-Mega2560-Rev3.hex Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex

--- End quote ---

I first tried the Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex through DFU, but it failed, apparently because DFU could not overwrite itself...
That's why I tried the Arduino-usbserial-atmega16u2-Uno-Rev3.hex one.
Note that, since I could have an AVRISP mkII programmer, I also tried to use it to program the Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex firmware. Programming it went fine, but I still couldn't upload...

--- Quote from: Nick Gammon on May 27, 2012, 01:11 am ---
Also make sure the fuses are correct in the 16U2 chip. Mine are:


--- Code: ---LFuse = 0xEF
HFuse = 0xD9
EFuse = 0xF4
Lock byte = 0xCF
--- End code ---


--- End quote ---

Hmmm, good to know.
I programmed the 16U2 processor with:

--- Code: ---
avrdude -p at90USB162 -F -P usb -c avrispmkii -U flash:w:Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex -U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m

--- End code ---

so it looks like my LFuse and Lock byte were wrong...

I just tried the same command, replacing those values with yours, but then programming the Lock byte fails:

--- Code: ---
avrdude: writing lock (1 bytes):

Writing |                                                    | 0% 0.00s ***failed; 
Writing | ################################################## | 100% 0.08s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0xCF:
avrdude: load data lock data from input file 0xCF:
avrdude: input file 0xCF contains 1 bytes
avrdude: reading on-chip lock data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
         0xcf != 0x0f
avrdude: verification error; content mismatch

--- End code ---

Do you know whether it matters?
Anyway, uploading a sketch still does not work (same error message)...

--- Quote from: Nick Gammon on May 27, 2012, 01:11 am ---

--- Quote ---it seems that something should be written to the EEPROM of the atmega16u2 chip
--- End quote ---


I haven't heard of that. A quick check of my 16U2 EEPROM shows it not written to (all 0xFF).

--- End quote ---

That's good to know.

Thanks for your help.

Nick Gammon:
I wouldn't worry about the lock byte.

Now how does the board identify itself?

You probably need to install the correct .inf file (are you using Windows?).

If that all checks out, run the upload in verbose mode (see Preferences) and paste what you see.

z80a:

--- Quote from: Nick Gammon on May 27, 2012, 02:23 am ---
I wouldn't worry about the lock byte.

--- End quote ---

Okay

--- Quote from: Nick Gammon on May 27, 2012, 02:23 am ---
Now how does the board identify itself?

--- End quote ---

Here's what I get in my kernel log:

--- Code: ---
usb 3-1: new full speed USB device using ohci_hcd and address 2
usb 3-1: New USB device found, idVendor=2341, idProduct=0043
usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=220
usb 3-1: Manufacturer: Arduino (www.arduino.cc)
usb 3-1: SerialNumber: 749373039363518071D1
usb 3-1: configuration #1 chosen from 1 choice
cdc_acm 3-1:1.0: ttyACM0: USB ACM device
usbcore: registered new interface driver cdc_acm
cdc_acm: v0.26:USB Abstract Control Model driver for USB modems and ISDN adapters

--- End code ---

That looks fine to my unexperienced eyes.

--- Quote from: Nick Gammon on May 27, 2012, 02:23 am ---
You probably need to install the correct .inf file (are you using Windows?).

--- End quote ---

I'm no Windows user, I use Debian GNU/Linux.

--- Quote from: Nick Gammon on May 27, 2012, 02:23 am ---
If that all checks out, run the upload in verbose mode (see Preferences) and paste what you see.

--- End quote ---

Here it is:

--- Code: ---
/usr/share/arduino/hardware/tools/avrdude -C/usr/share/arduino/hardware/tools/avrdude.conf -v -v -v -v -patmega328p -carduino -P/dev/ttyACM0 -b115200 -D -Uflash:w:/tmp/build3588799080207223124.tmp/Blink.cpp.hex:i

avrdude: Version 5.10, compiled on Jun 27 2010 at 00:40:48
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/usr/share/arduino/hardware/tools/avrdude.conf"
         User configuration file is "/home/z80a/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyACM0
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding

avrdude done.  Thank you.

--- End code ---

Nothing useful here, I'm afraid...

Navigation

[0] Message Index

[#] Next page

Go to full version