Go Down

Topic: Problem with programming per IDE (Read 868 times) previous topic - next topic

ManuelW77

Hey there,
i have a problem with flashing sketches per IDE.
I have try'd different programmers, but it ends in the same problem.

My last try with a Arduino Uno as ISP shows me the problem.
I try to flash a Atmega1248 with a Uno as ISP.
I get this error from the IDE

Quote
Arduino: 1.8.5 (Mac OS X), Board: "Sanguino, ATmega1284 or ATmega1284P (16 MHz)"

Der Sketch verwendet 122446 Bytes (94%) des Programmspeicherplatzes. Das Maximum sind 130048 Bytes.
Globale Variablen verwenden 3851 Bytes (23%) des dynamischen Speichers, 12533 Bytes für lokale Variablen verbleiben. Das Maximum sind 16384 Bytes.
/Users/manuel/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino9/bin/avrdude -C/Users/manuel/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino9/etc/avrdude.conf -v -patmega1284p -carduino -P/dev/cu.wchusbserial26240 -b115200 -D -Uflash:w:/var/folders/m5/36ddtyd90fz2nbwkw19c7m3m0000gn/T/arduino_build_567928/Marlin.ino.hex:i

avrdude: Version 6.3, compiled on Jan 17 2017 at 12:01:35
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/Users/manuel/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino9/etc/avrdude.conf"
         User configuration file is "/Users/manuel/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/cu.wchusbserial26240
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
         AVR Part                      : ATmega1284P
         Chip Erase delay              : 55000 us
         PAGEL                         : PD7
         BS2                           : PA0
         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  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    10   128    0 no       4096    8      0  9000  9000 0xff 0xff
           flash         65    10   256    0 yes    131072  256    512  4500  4500 0xff 0xff
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00

         Programmer Type : Arduino
         Description     : Arduino
         Hardware Version: 2
         Firmware Version: 1.16
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Beim Hochladen des Sketches ist ein Fehler aufgetreten
Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: Expected signature for ATmega1284P is 1E 97 05
         Double check chip, or use -F to override this check.

avrdude done.  Thank you.
So it looks like the IDE try to flash the ISP and not the target.
If i do it directly with avrdude it works fine. I did this with another ISP.

Quote
/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude -C /Applications/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf -p atmega1284p -c avrisp2 -P /dev/cu.usbmodem24361 -U flash:w:flash.hex:i -F
There must be something wrong in the IDE.

So maybe someone can help me with this.

Koepel

#1
Jan 22, 2018, 04:23 pm Last Edit: Jan 22, 2018, 04:25 pm by Koepel
The Arduino IDE is okay. Your connection to the Arduino Uno is okay.

Once you upload the sketch to make a programmer out of an Arduino Uno, that Arduino Uno is a programmer. You select the right  programmer from the menu and then it will use that programmer.
That programmer will be used when you burn the bootloader or upload a sketch via the programmer.

The target to flash (to burn a bootloader or program a sketch without bootloader) is the Atmega1248.

The avrdude gets confused, because somehow you choose the Arduino Uno (ATmega328P microcontroller) and also have the ATmega1284P as target.

If you can not fix it, please describe what is connected to what, with which pins, and which buttons or menu command or script you select and what programmer and board you have selected. Can you try it on a Windows computer ?

DrAzzy

#2
Jan 22, 2018, 05:33 pm Last Edit: Jan 22, 2018, 05:34 pm by DrAzzy
So you have an Uno with Arduino as ISP sketch on it, connected to the 1284p-based target?

Looks to me like you did "Upload", which attempts to do a normal upload direct to the 1284p using a serial bootloader - so it was trying to reprogram the Uno, and of course stopped when it saw that the chip didn't match what it expected. You are trying to upload with an ISP programmer, so you need to do "Upload using programmer", not the normal "upload".
ATtiny core for 841+1634+828 and x313/x4/x5/x61/x7/x8 series Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts (some assembled), mosfets and awesome prototyping board in my store http://tindie.com/stores/DrAzzy

ManuelW77

#3
Jan 22, 2018, 05:36 pm Last Edit: Jan 22, 2018, 05:41 pm by ManuelW77
Hi,

i have no Windows computer, so i only can do it with a mac.

I know, it looks as i haven't selected the right programmer, but i did.
And it also is the same problem with a avrisp.

But, i can flash ESP8266 without some problem with the IDE.

It look like the IDE ignores my programmer settings.

Yes, i have flashed the ISP Sketch to the UNO.

I try to burn a bootloader from this howto
http://www.instructables.com/id/Flashing-a-Bootloader-to-the-CR-10/

Koepel

When you click "Burn bootloader" it should not give this:
Code: [Select]
avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: Expected signature for ATmega1284P is 1E 97 05

ManuelW77

So i made a log of the error while try to burn the bootloader.

Quote
Arduino: 1.8.1 (Mac OS X), Board: "Sanguino, ATmega1284 or ATmega1284P (16 MHz)"

/Users/manuel/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino9/bin/avrdude -C/Users/manuel/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino9/etc/avrdude.conf -v -patmega1284p -cstk500v1 -P/dev/cu.wchusbserial1410 -b19200 -e -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xDE:m -Ulfuse:w:0xFF:m

avrdude: Version 6.3, compiled on Jan 17 2017 at 12:01:35
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/Users/manuel/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino9/etc/avrdude.conf"
         User configuration file is "/Users/manuel/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/cu.wchusbserial1410
         Using Programmer              : stk500v1
         Overriding Baud Rate          : 19200
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x15
         AVR Part                      : ATmega1284P
         Chip Erase delay              : 55000 us
         PAGEL                         : PD7
         BS2                           : PA0
         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  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    10   128    0 no       4096    8      0  9000  9000 0xff 0xff
           flash         65    10   256    0 yes    131072  256    512  4500  4500 0xff 0xff
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00

         Programmer Type : STK500
         Description     : Atmel STK500 Version 1.x firmware

avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x14

avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x02

avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x10
         Hardware Version: -1447661740
         Firmware Version: -1073745544.444305
         Topcard         : STK502
         Vtarget         : 1.8 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: stk500_initialize(): (b) protocol error, expect=0x10, resp=0x01
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x10

avrdude done.  Thank you.

Fehler beim Brennen des Bootloaders.

Koepel

I think that the "programmer" part is okay. The problem is when trying to communicate with the ATmega1284P target.
Could you check the wiring once more ? How do you know that the ATmega1284P is running at all ? I needs to run, and it needs to have a clock. Perhaps it has the wrong fuses and is bricked. Is something wrong with the circuit, for example a capacitor from /RESET to GND ? Did you buy or make the ATmega1284P board ?

ManuelW77

#7
Jan 22, 2018, 11:13 pm Last Edit: Jan 22, 2018, 11:27 pm by ManuelW77
The Atmega1284P is running, i can see it on its connected display and it is not bricked, because it works and i can flash them per commandline. But i won't try to burn the bootloader per commandline because i don't know how and won't brick them.

A capacitor from Reset to Ground? I haven't one there, because in the tutorial its not described like this.

The Atmega is the Mainborad of my 3D Printer.

It is wired like this
MISO ----> MISO
5V --------> 5V
SCK -----> SCK
MOSI ---> MOSI
RESET -> Digital Pin 10
GND ----> GND

Koepel

That seems right. Then I have no clue what could be wrong :(

The only thing that is wrong, is the communication between the "programmer" and the ATmega1284P.
There could be something wrong with that, but also with the ATmega1284P board itself. When it runs normal, it could run just barely, and programming it could raise the problems.
Is the 5V noisy ? Is the ATmega1284P missing decoupling capacitors from Vcc to GND ? Are the wires too long or in a cable ? Is the voltage 4.5V instead of a good 5.0V for the ATmega1284P ? Is the circuit of the ATmega1284P not good, for example a long ground path for the X-tal and the 22pF capacitors.

As a last resort, you can try the Nick Gammon ISP sketch as an alternative: https://www.gammon.com.au/bootloader

ManuelW77

I don't think that it is a hardware problem, because flashing with avrdude in commandline works fine.
I'll have a look to the Nick Gammon ISP.

Koepel

#10
Jan 23, 2018, 12:23 am Last Edit: Jan 23, 2018, 12:23 am by Koepel
The Arduino IDE uses avrdude as well. Can you compare the command lines ? Perhaps a clock or timing is set lower. Perhaps a different version of avrdude is used.

ManuelW77

That might be the problem, i see that the IDE uses another avrdude as its own.

This is my working shell command for flashing.
/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude -C /Applications/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf -p atmega1284p -c avrisp2 -P /dev/cu.usbmodem1411 -U flash:w:flash.hex:i -F

and this is what the IDE uses
/Users/manuel/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino9/bin/avrdude -C/Users/manuel/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino9/etc/avrdude.conf -v -patmega1284p -cstk500v1 -P/dev/cu.wchusbserial1410 -b19200 -e -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xDE:m -Ulfuse:w:0xFF:m

ignore the usbmodem, but the path to the used avrdude is different.But, how can i change this in the IDE?

Koepel

The "Arduino15" folder contains the updated code. That means that the Arduino has downloaded a newer version or new addition.
My Arduino IDE 1.8.5 has avrdude 6.3.

Your avrdude uses the -F flag. The "force" flag is an indication that something is wrong. It should not be needed.

What about the other options ?
You: -c avrisp2
IDE: -cstk500v1

My avrdude uses: "arduino-1.8.5/hardware/tools/avr/etc/avrdude.conf" (I'm using linux).
That defines the default for almost all processors, also the "m1284p".
The default options can be overridden by the command line.

The "programmers" in the menu are defined in: "arduino-1.8.5/hardware/arduino/avr/programmers.txt".
The "arduinoasisp" uses "stk500v1" and "19200" baud, that matches the command line by the IDE.

The options for the basic Arduino boards are in the file "arduino-1.8.5/hardware/arduino/avr/boards.txt".

However, you have downloaded a package for the ATmega1284P. That is in the "Arduino15" folder.
Therefor you have to search first in the "Arduino15" folder for those configuration files.

Could the package have a bug and set the wrong programmer protocol for the Arduino IDE ? Somewhere is a mismatch.

Sorry for being slow :-[ you already wrote in the first post that you had avrdude working. At last we have an indication what could be wrong. All the hardware and software is okay, it is the avrdude, either the version or the command line options or a configuration file.



ManuelW77

I can't get it work :(

I copied the in the shell working avrdude and config to the ide path, but it won't work also.
Now i get programmer not in sync while trying to burn the bootloader.

I don't know whats wrong with the IDE.

Koepel

It is not the Arduino IDE. It is a setting/configuration somewhere.

The problem is already in this part:
Using Programmer              : stk500v1
 Overriding Baud Rate          : 19200
 avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x15


I don't know enough why that happens, and I don't have a "ATmega1284P".

For a programmer I use USBasp. In the past I sometimes had to fix a few things, but I did not have such problems.

My intuition tells me that the downloaded extra ATmega1284P code does not match the settings of the Arduino IDE. You could try to find others that use the ATmega1284P or start a new question with "ATmega1284P" in the subject and find a way to get "Coding Badly"s attention.
When you start a new subject be clear what you do and refer with a link to this thread.

Go Up