ATmega1284p-pu Avrdude.conf stk500v2 Baudrate signature byte upload problem

Greetings everyone, please forgive I'm a newbe.
Back in Feb 2016 I built a Mendel90 with Gen7 1.5v board and a blank ATmega1284p-pu chip . I downloaded Arduino IDE 1.0.5r2 version also Gen7 Arduino support package which only work in Arduino IDE 1.0.3 to 1.0.5 versions. I got the Gen7 bootloader to go up only after making a 9 pin serial board and I got the Marlin firmware to go up through the MCP2200 chip on the Gen7 board. All looked good at the time both heart bed and hot end came on plus the stepper motors turn. Then I noticed the stepper motors weren't turning right and it was going past the end stop. I then remembered in my haste I didn't set up the Marlin firmware before uploading. I figured that's ok I'll just upload the firmware again and that's when all the problems started. No mater what I did I could not upload the bootloader or firmware again and I tried everything I could find on the internet.

So this year I went out and bought 2 new ATmega1284p-pu chips and a Arduino Uno r3 which turned out to be made in China, what are you going to do. I tried uploading the bootloader to the new chip but it would not go up. I then read something about changing the signature byte in the avrdude.conf so I changed it.

From this: 0x1e 0x97 0x05 To this: 0x1e 0x97 0x06

I tried uploading the bootloader again and it went up. I figured all is fine right, wrong now the firmware will not go up. So I changed the signature byte back.

From this: 0x1e 0x97 0x06 To this: 0x1e 0x97 0x05

Then the Marlin 1.0.2 firmware went up, I figure all is fine again right, wrong because now I have two different programs with two different signature bytes and it's confusing the heck out of the chip. I believe you can only have 1 signature byte per chip.

Plus avrdude.conf seems to be overriding thing. The ATmega1284p needs the stk500v2 but arvdude overrides it and gives it the stk500v1 which there is no support. Also avrdude is overriding the baudrate so now I have no clue to the baudrate. I tried every baudrate in Pronterface but it will not connect.

Because there are 3 different ATmega1284 chips now I have know idea what the fuse settings should be, so if anyone can tell me that would be great.

Please Help Thank you, Kenn.

This is what it does when I upload the bootloader. As you can see it uses the stk500v1 instead of the stk500v2 and it overrides the baudrate to what I don’t know.


<C:\Documents and Settings\Kenn\My Documents\Arduino 1.0.5 r2\arduino-1.0.5-r2-windows\arduino-1.0.5-r2\hardware/tools/avr/bin/avrdude -CC:\Documents and Settings\Kenn\My Documents\Arduino 1.0.5 r2\arduino-1.0.5-r2-windows\arduino-1.0.5-r2\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega1284p -cstk500v1 -P\.\COM6 -b19200 -e -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xDA:m -Ulfuse:w:0xD6:m

avrdude: Version 5.11, compiled on Sep 2 2011 at 19:38:36
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch

System wide configuration file is “C:\Documents and Settings\Kenn\My Documents\Arduino 1.0.5 r2\arduino-1.0.5-r2-windows\arduino-1.0.5-r2\hardware/tools/avr/etc/avrdude.conf”

Using Port : \.\COM6
Using Programmer : stk500v1
Overriding Baud Rate : 19200
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
AVR Part : ATMEGA1284P
Chip Erase delay : 9000 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
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack


flash 65 10 256 0 yes 131072 256 512 4500 4500 0xff 0xff
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack


lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack


lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
/>

KennTech:
I tried uploading the bootloader to the new chip but it would not go up.

That's not a useful description of the problem. We need complete verbose output in order to know what is meant by "it would not go up".

KennTech:
From this: 0x1e 0x97 0x05 To this: 0x1e 0x97 0x06

0x1e 0x97 0x06 is the signature for the ATmega1284. 0x1e 0x97 0x05 is the signature for the ATmega1284P.

KennTech:
now the firmware will not go up.

That's not a useful description of the problem. We need complete verbose output in order to know what is meant by "will not go up".

KennTech:
now I have two different programs with two different signature bytes

Programs don't have signature bytes. The signature byte value in avrdude.conf is only used to compare to the signature value returned by the chip (or bootloader). The signature you set in avrdude.conf is not written to the chip or to the "program".

KennTech:
Because there are 3 different ATmega1284 chips now I have know idea what the fuse settings should be, so if anyone can tell me that would be great.

That will depend on your hardware. We are not generally 3D printer experts here so you can't expect us to know this simply from your "Mendel90 with Gen7 1.5v board". I would expect that the "Gen7 Arduino support package" you're using already has the correct fuse settings defined and that you should only mess with them if you know that the board you built is different from the one the support package was written for.

KennTech:
This is what it does when I upload the bootloader. As you can see it uses the stk500v1 instead of the stk500v2 and it overrides the baudrate to what I don't know.

That's a red herring. The stk500v1 and baudrate is for the communication between your computer and the "Arduino as ISP" programmer you're using for the Burn Bootloader process and is correct and expected.

Hi pert, thank you for the reply. I will try to put the bootloader complete verbose up in a hour or so.

I can understand that the signature byte is only used for chip verification.

When I upload the Gen7 bootloader I have to go into the avrdude.conf and change the signature byte to 0x1e 0x97 0x06 other wise it times out for 45 minutes.

When I upload the Marline firmware on the same chip I have to go back into the avrdude.conf and change the signature byte back to 0x1e 0x97 0x05 other wise the Marlin firmware will time out for 45 minutes.

This is telling me that the avrdude.conf is verifying two different signature bytes for the same chip. To me this throws up a red flag saying that should not be.

Thank you for your help. Kenn

.

I tried to upload the verbose output to this forum but it seems 146 pages is to large for the forum to handle.

This is the verbose output from the Burn Bootloader process? I can't imagine how it could be so long. Save the output to a .txt file and attach it to a reply here. If you click the "Reply" button, you'll see an "Attachments and other setting" link at the bottom of the "Reply" field.

This is the Gen7 Arduino support bootloader.

Gen7 bootloader log030319.txt (1020 KB)

This is to the Marlin firmware when I try to upload it with the Gen7 Arduino support bootloader on the chip. The file is so big that I can't copy and past the whole thing only the top and bottom. The time out error goes for 45 minutes and I don't have a orange button at the end to copy it with because this version of Arduino IDE 1.0.5r2 doesn't have it or at least I haven't seen one yet.


C:\Documents and Settings\Kenn\My Documents\Arduino 1.0.5 r2\arduino-1.0.5-r2-windows\arduino-1.0.5-r2\hardware/tools/avr/bin/avrdude -CC:\Documents and Settings\Kenn\My Documents\Arduino 1.0.5 r2\arduino-1.0.5-r2-windows\arduino-1.0.5-r2\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega1284p -cstk500v2 -P\\.\COM6 -b9600 -D -Uflash:w:C:\DOCUME~1\Kenn\LOCALS~1\Temp\build3442667152624572823.tmp\Marlin.cpp.hex:i 

avrdude: Version 5.11, compiled on Sep  2 2011 at 19:38:36
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "C:\Documents and Settings\Kenn\My Documents\Arduino 1.0.5 r2\arduino-1.0.5-r2-windows\arduino-1.0.5-r2\hardware/tools/avr/etc/avrdude.conf"

         Using Port                    : \\.\COM6
         Using Programmer              : stk500v2
         Overriding Baud Rate          : 9600
avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14] 
avrdude: Recv: 
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14] 
avrdude: Recv: 
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14] 
avrdude: Recv: 
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14] 
avrdude: Recv: 
avrdude: stk500v2_ReceiveMessage(): timeout



avrdude: Recv: 
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_command(): failed miserably to execute command 0x11
avrdude: stk500v2_disable(): failed to leave programming mode

avrdude done.  Thank you.

KennTech:
This is the Gen7 Arduino support bootloader.

I see why it's so long. You are using the very very very verbose output. That's no problem. That output looks fine and shows the process was successful.

KennTech:
The time out error goes for 45 minutes and I don't have a orange button at the end to copy it with because this version of Arduino IDE 1.0.5r2 doesn't have it or at least I haven't seen one yet.

OK, I haven't used 1.0.5r2 for a long time and I know the IDE has changed a lot.

I don't see any indication that your problem is caused by the signatures. When you burn the bootloader, I believe the signature bytes are read right off the chip. I find it strange that you would need to change the signature to the ATmega1284 for that process, unless you actually have ATmega1284 chips.

When you upload via the bootloader, some bootloaders will just report the signature bytes that the bootloader was compiled for, rather than actually what is on the chip. If that is the case, an ATmega1284 with an ATmega1284P bootloader on it will appear to avrdude to be an ATmega1284P. However, I don't think any of that could cause the problem you're having uploading.

Please post a link to where you got the Gen7 Arduino support package from.

Hi pert, thanks for the reply. I get the Gen7 Arduino support from the RepRap page. I use version 2.1 as it works with the Arduino IDE 1.0.5 version.

By the way I’m uploading the bootloader and Marlin firmware using a laptop with Windows XP service pack 3.

https://reprap.org/wiki/Gen7_Arduino_IDE_Support

This is were I got the ATmega1284p chip from.

https://www.mouser.com/ProductDetail/Microchip-Technology-Atmel/ATMEGA1284P-PU?qs=K8BHR703ZXgaD0L1rKdwiQ%3D%3D&gclid=EAIaIQobChMIzvOx-9no4AIVjp6fCh07LA4tEAAYASAAEgK0ZfD_BwE

This is the Gen7 1.5v board that I made back in 2016.

https://reprap.org/wiki/Gen7_Board-AVR_1.5

What do you think about this idea?

The Gen7 version 1.5 document page says you can use Sanguino bootloader and it should work with the Marlin firmware, if so then I should be able to use the Arduino IDE 1.6.4 version. This might get the avrdude to recognize the correct signature byte.

All I need to do is get a chip to function on the Gen7 1.5v board.

In your upload command:

KennTech:

C:\Documents and Settings\Kenn\My Documents\Arduino 1.0.5 r2\arduino-1.0.5-r2-windows\arduino-1.0.5-r2\hardware/tools/avr/bin/avrdude -CC:\Documents and Settings\Kenn\My Documents\Arduino 1.0.5 r2\arduino-1.0.5-r2-windows\arduino-1.0.5-r2\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega1284p -cstk500v2 -P\\.\COM6 -b9600 -D -Uflash:w:C:\DOCUME~1\Kenn\LOCALS~1\Temp\build3442667152624572823.tmp\Marlin.cpp.hex:i

baud rate is set to 9600. But I just downloaded the "Gen7 Arduino IDE Support v2.1" file from Gen7 Arduino IDE Support - RepRap and none of the boards in that package use an upload baud rate of 9600. Which board do you have selected from the Tools > Board menu?

Hi pert, it says overriding baudrate 9600.

The only thing set to 9600 is the usb2 port.

I set the avrdude.conf and board.txt to 115200 baudrate. So were that's coming from I don't know.

What happens when I upload the Marlin firmware it will say override baudrate 115200 which is a problem because that's not the usb2 baudrate.

In the Arduino IDE menu "tool>board" I select Gen7 ATmega1284p 20mhz.

The Gen7 ATmega1284p bootloader or library to my knowledge has never been updated. I don't know if they would work right on new chips.

What do you think about me going to the Sanguino bootloader or Mighty bootloader at least they have been updated?

I would recommend using MightyCore. It is well documented and maintained and I can personally confirm that it works fine. You can find the installation instructions here:

Please let me know if you have any questions.

Okay so I installed Arduino IDE 1.6.7 and installed the Mighty Core into it.

I then uploaded the Mighty Core bootloader to the ATmega1284p 20mhz chip that uploaded fine.

Now I can only use the Gen7 Arduino support package and Sanguino in Arduino IDE 1.0.3 to 1.0.5 they will not install in the Arduino IDE 1.6.7.

Using the Arduino IDE 1.0.5r2v and the Arduino as ISP, I tried to upload the Marlin firmware with the Gen7 support but only got time out errors. I tried every setting and baudrate but it would always time out.

The only time I had successes was when I used the Sanguino bootloader and the Marlin firmware with Gen7 support. So I think I’ll go back to that and see what I can do with it. Plus I think I’ll try Arduino IDE 1.0.3 this time and see what I get.

Thank you, Kenn

KennTech:
Now I can only use the Gen7 Arduino support package and Sanguino in Arduino IDE 1.0.3 to 1.0.5 they will not install in the Arduino IDE 1.6.7.

You don't need those anymore. MightyCore replaces them.

KennTech:
Using the Arduino IDE 1.0.5r2v and the Arduino as ISP, I tried to upload the Marlin firmware with the Gen7 support but only got time out errors. I tried every setting and baudrate but it would always time out.

Since you have the MCP2200, you might as well do a standard upload.

Please follow these instructions exactly:

  • Join the rest of us in the year 2019 and install Arduino IDE 1.8.8 (unless you have a really good reason for using 1.6.7).
  • Start the Arduino IDE.
  • Tools > Board > ATmega1284
  • Tools > Pinout > Sanguino pinout
  • Tools > Clock > 20 MHz external (From your last reply, I'm assuming you have a 20 MHz crystal connected to your ATmega1284P. If you have the 16 MHz instead then chose that option).
  • Connect the Arduino as ISP to your Gen7 board.
  • Plug the Arduino as ISP into your computer.
  • Tools > Port > select the port of the Arduino as ISP
  • Tools > Programmer > Arduino as ISP
  • Tools > Burn Bootloader
  • After the Burn Bootloader process finishes successfully, unplug the Arduino as ISP from your computer.
  • Disconnect the Arduino as ISP from your Gen7 board
  • Plug the USB cable of the Gen7 board into your computer.
  • Tools > Port > select the port of the Gen7 board.
  • File > Open > select the Marlin sketch > Open
  • Sketch > Upload
  • Wait for the Upload process to complete successfully.

KennTech:
I think I'll try Arduino IDE 1.0.3 this time and see what I get.

Noooooooooo!

Hi pert, Thank you for the reply.

Try to understand you can not install the Gen7 Arduino support package into Arduino IDE 1.6.7 even if you manually put it into the hardware folder.

The Arduino IDE 1.6.7 refuses to see the Gen7 package and because of this you get wrong board selected errors.

RepRap never developed a Gen7 with Arduino support for the newer versions of Arduino IDE.

If you go back to the Gen7 Arduino support wiki page you will see they say it only works in Arduino IDE 1.0.3 to 1.0.5 versions.

https://reprap.org/wiki/Gen7_Arduino_IDE_Support

I even tried the Sanguino but Arduino IDE 1.6.7 will not install that support package as well so I get wrong board selected errors.

If you know of a support package that is for a board similar to the Gen7 board that will install into the newer versions of Arduino IDE I would be happy to try it.

I would love to get into the newer versions of Arduino IDE but for now I'm stuck in a catch 22 situation.

Thank you, Kenn

KennTech:
Try to understand you can not install the Gen7 Arduino support package into Arduino IDE 1.6.7 even if you manually put it into the hardware folder.

I already explained this to you. MightyCore is a complete replacement for the Gen7 Arduino support package.

KennTech:
I even tried the Sanguino but Arduino IDE 1.6.7 will not install that support package as well so I get wrong board selected errors.

...and I already explained that MightyCore is a complete replacement for Sanguino.

KennTech:
If you know of a support package that is for a board similar to the Gen7 board that will install into the newer versions of Arduino IDE I would be happy to try it.

Yes. It's MightyCore!

NOTE: I missed one important step in the instructions in my previous reply (selecting Tools > Pinout > Sanguino pinout). I have now corrected the instructions.