Go Down

Topic: Problems with the IDE and communicating with the bootloader (Read 577 times) previous topic - next topic

EMKLI

Oct 31, 2014, 07:04 pm Last Edit: Oct 31, 2014, 07:10 pm by EMKLI Reason: Some additions
Hello there!

I seem to have a serious problem with the Arduino IDE (using both either the current stable or beta version).

I have the following setup here:

1. Computers: I have 3 computers here, 2 64-bit machines and a Chromebook with an ARM processor. The two 64er's are running Windows 7 and Arch Linux. The ARM Chromebook also runs Arch Linux.

2. Programmers: I have a USBtinyISP and a USBasp, also 2 FTDI-Adapters; one of them brings out the DTR line, the other brings out the RTS line.

2. Boards: I have an Arduino Uno, a "One square inch of goodness" from Jeremy Saglimbeni (which is also based on a 328p), and tree bare 328p's. I also have an Arduino Due.

I didn't use my Arduino for a longer time - guess, about half a year or so. When I tried to program it a few days before, I immediately ran into the infamous

Code: [Select]
avrdude: stk500_getsync(): not in sync: resp=0x00

error. So I started fiddling, with no success. I get the same error message with the two FTDI adapters as well - on EVERY machine, regardless of the running OS.
On the Square Inch of Goodness, I can see that the board switches to "bootloader mode" (the pin 13 LED stops flashing) and on the FTDI programmer, the TX LED flashes one or two times - and that's it.

So I thought: "Well, maybe it's a bootloader problem on the Arduino?" and tried to "reflash" the chip within the Arduino IDE. Well, no success as well. With the USBtinyISP, i get

Code: [Select]
avrdude: sending control message failed, win error: A device attached to the system is not functioning.

(Expexted 136, got -5)


on Windows. On Linux, i got a different message I cannot reproduce, but it failed anyway. ;) It was the same for the bare 328p's I have.

The USBasp isn't working as well. I got the message that avrdude wasn't able to set the SCK period, which is related to the programmer's firmware and is another - well documented - problem I don't want to follow up here.

So, I was pretty frustrated. None of my computers seem to be able to communicate with those 328p's...

I've decided to try using avrdude directly. First of all, I tried to burn a simple sketch on the 'ino. I've come across this forum thread at sparkfun and tried out the code which was posted there. And... it worked! So, with that success in mind, I tried to flash the Arduino bootloader on the device with avrdude - and it worked! BUT: I'm still not able to upload new sketches to the bootloaded chip. Same error as before, with some blinking but nothing else. The USB port of the UNO also doesn't work (and I guess it's not a problem with the 16u4...).

This is the output that avrdude gave me while burning the bootloader. Maybe there's something wrong with the chip(s)?


Code: [Select]
C:\Program Files (x86)\Arduino\hardware\arduino\avr\firmwares\atmegaxxu2>avrdude
 -p m328p -C C:\Dev\WinAVR-20100110\bin\avrdude.conf -c usbtiny -F -e -U UNO-dfu
_and_usbserial_combined.hex -v

avrdude: Version 5.11-Patch#7610, compiled on Aug 31 2011 at 08:02:19
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "C:\Dev\WinAVR-20100110\bin\avrdude.conf"

         Using Port                    : lpt1
         Using Programmer              : usbtiny
avrdude: usbdev_open(): Found USBtinyISP, bus:device: bus-0:\\.\libusb0-0001--0x1781-0x0c9f
         AVR Part                      : ATMEGA328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page
      Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  Max
W   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : USBtiny
         Description     : USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/
avrdude: programmer operation not supported

avrdude: Using SCK period of 10 usec
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.04s

avrdude: Device signature = 0x1e950f
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DE
avrdude: safemode: efuse reads as 5
avrdude: erasing chip
avrdude: Using SCK period of 10 usec
avrdude: reading input file "UNO-dfu_and_usbserial_combined.hex"
avrdude: input file UNO-dfu_and_usbserial_combined.hex auto detected as Intel Hex
avrdude: writing flash (7440 bytes):

Writing | ################################################## | 100% 9.50s



avrdude: 7440 bytes of flash written
avrdude: verifying flash memory against UNO-dfu_and_usbserial_combined.hex:
avrdude: load data flash data from input file UNO-dfu_and_usbserial_combined.hex:
avrdude: input file UNO-dfu_and_usbserial_combined.hex auto detected as Intel Hex
avrdude: input file UNO-dfu_and_usbserial_combined.hex contains 7440 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 7.02s



avrdude: verifying ...
avrdude: 7440 bytes of flash verified

avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DE
avrdude: safemode: efuse reads as 5
avrdude: safemode: Fuses OK

avrdude done.  Thank you.


After burning the bootloader manually, I also can redo this from within the IDE, so I guess, the bootloader was just messed up. But as I said, it's not possible for me to bring new sketches to the board with any of the mentioned tools.

Another thing I've noticed is that after flashing the bootloader, the pin13 LED is flashing two times when the board gets power, then goes off for a second and then back on forever. Is that normal?

So - is there something wrong with the IDE or my chips? Any ideas? Is there any possibility to communicate with the bootloader without the IDE?

BTW: i did this all with an external power supply connected to the 328's, so I guess, it's not a power issue or something related to that.

And the Arduino Due works perfectly fine with the IDE! The problem is only related to the ATMega stuff.

Thanks for your help! I'm totally frustrated after two weeks of playing "try and fail"...

Greetings,
Markus

Go Up