Can't flash my Arduino 2560

Cant get your radio to work? General Hardware issues?
Post Reply
Thierry72
Posts: 7
Joined: Fri Dec 13, 2019 4:59 pm
Country: -

Can't flash my Arduino 2560

Post by Thierry72 »

Hi,
I've been struggling for a long time trying to flash my Arduino 2560.
I am running Windows 10, I tried to install the USBAP driver and the Mega 2560, but with no success even with Zadig.
In fact I can't even say if the 2560 card has been flashed successfully (leds light on on the USBAP - but do not flash on the 2560), and I can't transfer the Opentx.hex file to the 2560 : the processus stops immediately.
At the moment I have suppressed the USBAP and Mega drivers. Maybe I should clean the Windows registry ?
If it can help, I have the possibility to bring back to life an old iMac with Mountain Lion and Debian.
Would somebody be kind enough to help me and guide me, please.
Regards
Thierry

User avatar
Kilrah
Posts: 11109
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Can't flash my Arduino 2560

Post by Kilrah »

Is this a genuine one? I had a clone 2560 that I could never flash, just faulty.
Thierry72
Posts: 7
Joined: Fri Dec 13, 2019 4:59 pm
Country: -

Re: Can't flash my Arduino 2560

Post by Thierry72 »

It's a genuine chinese card :?
I downloaded arduino sketches on it and it worked....
How can I know the USBAP is working normally ?
How can I know the card is being flashed ?
Thierry
User avatar
kalle123
Posts: 905
Joined: Sat Mar 29, 2014 10:59 am
Country: -
Location: Moenchengladbach

Re: Can't flash my Arduino 2560

Post by kalle123 »

The USBasp (USBAP?) can be tricky. If you have a second Arduino, use that one for flashing.
How can I know the card is being flashed ?
Flash the blink.ino with different ON/OFF timing and save the blink.hex file as blink1.hex and blink2.hex on your computer and try those.

Here ( I am using DEBIAN) the hex files can be found at

Code: Select all

/mnt/DATA/Anwendungen/arduino-1.8.10/hardware/tools/avr/bin/avrdude -C/mnt/DATA/Anwendungen/arduino-1.8.10/hardware/tools/avr/etc/avrdude.conf -v -patmega328p -carduino -P/dev/ttyACM0 -b115200 -D -Uflash:w:/tmp/arduino_build_139115/Blink.ino.hex:i 
/tmp/arduino_build_139115/Blink.ino.hex

br KH
Thierry72
Posts: 7
Joined: Fri Dec 13, 2019 4:59 pm
Country: -

Re: Can't flash my Arduino 2560

Post by Thierry72 »

Hi Kalle,
thank you for your answer.
Yes it's a USBasp, you're right.
But I'm sorry to tell you that I have not understood what I have to do :?
I'm far from being an expert..... I'm just a beginner.
I've just received an Arduino starter kit with a UNO and some stuff...
Thierry

User avatar
kalle123
Posts: 905
Joined: Sat Mar 29, 2014 10:59 am
Country: -
Location: Moenchengladbach

Re: Can't flash my Arduino 2560

Post by kalle123 »

Hi Thierry.

Have to understand, what you have in front of you.

You run WIN 10. You have a USBasp, one Mega and a Arduino starter kit?
You want to flash hex code onto the Mega? Which program for flashing?

I run mainly on DEBIAN Buster or Testing, but have a dualboot with WIN 10, which I hate and normally don't use. ;)
With the USBasp connected, you should see (under WIN 10)

Image

libusbK Device ready.

Under WIN 10 I use for flashing avrdude

Image

or that GUI for avrdude

Image

To give a hand, I need information.

Those statements of yours are NOT informative!
I tried to install the USBAP driver and the Mega 2560, but with no success even with Zadig.
How did you do that? What is in the WIN 10 device manager? Where did you get the driver? What did you do with zadig? ????

and
In fact I can't even say if the 2560 card has been flashed successfully (leds light on on the USBAP - but do not flash on the 2560), and I can't transfer the Opentx.hex file to the 2560 : the processus stops immediately.
You flashed? With a program? With what settings? With what messages? ????

br KH :D
Thierry72
Posts: 7
Joined: Fri Dec 13, 2019 4:59 pm
Country: -

Re: Can't flash my Arduino 2560

Post by Thierry72 »

Hi Kalle.
Thanks for your help.
Until now I followed the instructions of a french guy. You can find his job here.
Following his instructions, you first have to initialise the 2560 with the help of the USBasp (it's automatic, I just could see command lines).

Then, you create an Opentx.hex file and with the help of Companion you transfer it to the 2560.
Let's forget this method and follow yours.

The USBasp driver seems to be correctly installed.
Image

I had never heard of AVRDUDE nor AVRDUDESS until now.

I have downloaded AvrDude and AvrDudess and It seems that I have the latest versions.
I have plugged the USBasp and read the fuses.
Image

Thierry
User avatar
kalle123
Posts: 905
Joined: Sat Mar 29, 2014 10:59 am
Country: -
Location: Moenchengladbach

Re: Can't flash my Arduino 2560

Post by kalle123 »

Thierry72 wrote: Sat Dec 14, 2019 8:13 pm .... and read the fuses.
[
That is VERY good Thierry.

I am typing now under DEBIAN and as avrdudess needs mono to work under linux and I don't want to install that c**p (mono), I'll switch later over to WIN 10 and give some more info, how to flash *.hex.

I'll concentrate on that here, but you have to understand, that opentx on Mega is another subject. I did some experiments myself on that, but that was last year and I did not continue on that.

Image

br KH
User avatar
kalle123
Posts: 905
Joined: Sat Mar 29, 2014 10:59 am
Country: -
Location: Moenchengladbach

Re: Can't flash my Arduino 2560

Post by kalle123 »

So, get your Uno, the Arduino IDE and the USB cable.

Modify the Arduino IDE settings
1.JPG
for add. information while uploading the code.

Now compile and upload 'blink' to the Uno.

You'll have the add. info now.
2.JPG
3.JPG
There is your blink hex file. Go to that folder on your WIN 10 and copy that hex file. I renamed that Blink.ino.slow.hex.

The I modified the code in the Arduino IDE 1000 > 100 in 'delay(1000)' ;and flashed the Uno again. Now I get a Blink.ino.fast.hex!

Then I start playing with avrdudess and those two hex files with my Uno. :D

With that direct flashing you killed the bootloader on the Uno. You can not directly use the Uno now with the Arduino IDE.

But with the USBasp you can reflash the bootloader :D

Use this option in the IDE.
4.JPG
br KH
Thierry72
Posts: 7
Joined: Fri Dec 13, 2019 4:59 pm
Country: -

Re: Can't flash my Arduino 2560

Post by Thierry72 »

Done :
"" avrdude: Version 6.3-20190619
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch

System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"

Using Port : COM5
Using Programmer : arduino
Overriding Baud Rate : 115200
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 MaxW 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 : Arduino
Description : Arduino
Hardware Version: 3
Firmware Version: 4.4
Vtarget : 0.3 V
Varef : 0.3 V
Oscillator : 28.800 kHz
SCK period : 3.3 us

avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: reading input file "C:\Users\thierry\AppData\Local\Temp\arduino_build_649787/Blink.ino.hex"
avrdude: writing flash (932 bytes):

Writing | ################################################## | 100% 0.16s

avrdude: 932 bytes of flash written
avrdude: verifying flash memory against C:\Users\thierry\AppData\Local\Temp\arduino_build_649787/Blink.ino.hex:
avrdude: load data flash data from input file C:\Users\thierry\AppData\Local\Temp\arduino_build_649787/Blink.ino.hex:
avrdude: input file C:\Users\thierry\AppData\Local\Temp\arduino_build_649787/Blink.ino.hex contains 932 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.12s

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

avrdude done. Thank you. ""


You wrote : "With that direct flashing you killed the bootloader on the Uno. You can not directly use the Uno now with the Arduino IDE.
But with the USBasp you can reflash the bootloader"
It means that the USBasp is not mandatory for the opentx project ?
Why do you say that I can't use the UNO any more with Arduino IDE ?
I can still load a program in it.

You wrote that "opentx on Mega is another subject" : does it mean that it's more complex than with another Arduino board ?
If there is an "easier" board, let me know, so I will change the 2560 for a better board.

Thierry
User avatar
kalle123
Posts: 905
Joined: Sat Mar 29, 2014 10:59 am
Country: -
Location: Moenchengladbach

Re: Can't flash my Arduino 2560

Post by kalle123 »

Thierry72 wrote: Sun Dec 15, 2019 4:59 pm So : direct flashing with Arduino IDE (and ArduinoISP) killed the UNO's bootloader.
But why do you say that I can't use the UNO any more with Arduino IDE ?
I can still load a program in it.
Please read this here https://arduino.stackexchange.com/quest ... loader-hex

This Blink.ino.hex package generated by the Arduino IDE has a bootloader enclosed, but a 'straight or pure' hex code will not have a bootloader. Mentioned it, just in case ....
Thierry72 wrote: Sun Dec 15, 2019 4:59 pm You wrote that "opentx on Mega is another subject" : does it mean that it's more complex than with another Arduino board ?
If there is an "easier" board, let me know, so I will change the 2560 for a better board.
I got the Mega with some keys and a display with openTX working here. Was curious to get it running.
But I don't have an old TX to upgrade. So I lost interest in that project.

Might be other projects around now, but not with openTX, as far as I know and you have to use the 2560.
The basic information is here (3 years old) https://github.com/opentx/opentx/tree/2.2/doc/Mega2560


Here you see the standard Mega and a small Mega board with same functionality.
IMG_20191215_191653.jpg
Was planning to use that ....

But now you can flash and I think, this thread is solved ;)

br KH
Thierry72
Posts: 7
Joined: Fri Dec 13, 2019 4:59 pm
Country: -

Re: Can't flash my Arduino 2560

Post by Thierry72 »

Hi Kalle.
I think I'm beginning to understand ;) (it takes time sometimes for me)

As I have not succeeded to load the opentx program on my 2560, do you think I have to open a new thread about it ?
According to the procedure I have read you must first load the opentx.hex file int he 2560 with the help of the USBasp, then use Companion to load the program in the 2560. But it does not work.
Anyway thank you for your help.
Regards
Thierry
User avatar
kalle123
Posts: 905
Joined: Sat Mar 29, 2014 10:59 am
Country: -
Location: Moenchengladbach

Re: Can't flash my Arduino 2560

Post by kalle123 »

Thierry, you can now flash a simple hex file wit the USBasp onto an Arduino. Whether it is an Uno, a Nano or a Mega. That was the goal of this thread here.
Flashing and preparing openTX on a Arduino Mega is quite another thing.
The description is here for doing so ... https://github.com/opentx/opentx/blob/2 ... cedure.pdf

We started a thread in German RC forum in 2017 and it took me some days to get it running (... in 2017). If I had to do it again, I would have to start at point zero.
Have a look at least for the pictures :D http://www.rc-network.de/forum/showthre ... -Mega-2560
But this thread is dead.

Then there is this thread here, still active and I think, this is your mother language (not mine :roll: ).
https://www.modelisme.com/forum/aero-ra ... 015-a.html
Maybe you join there and ask for assistance.

br KH
Thierry72
Posts: 7
Joined: Fri Dec 13, 2019 4:59 pm
Country: -

Re: Can't flash my Arduino 2560

Post by Thierry72 »

Thank you Kalle.
Thierry

Post Reply

Return to “Hardware”