Endless failures trying to use a USBASP board to program an Arduino Mega 25660

Hi folks

I have been fighting this for some time now, and am now totally DESPERATE !

I have used Zadig to instal a driver as suggested by one member, but that appeared to result in my gaining a new device entirely (in its own libusb-win32 devices category), BUT loosing the ABILITY TO CONNECT IT TO A COM PORT.

This means that I cannot use the Arduino standard sketch load procedure as there is no COM port attached to it, but I have just discovered that even using the "Sketch - Upload using Programmer doesn't work either (using USBASP as the board), as it requires a COM port ? "

So right now my expensive and very useful (nay - crucial to my project), Mega is persona non grata from my PC via Arduino standard uppoad or by using the recently purchased and installed USBASP. This came with a 10 pin to 6 pin adpator, so connecting it was pretty straightforward as I had already spent hours and hours checking pinouts for the ICSP header on the board. Ergo looking down top left pin is VCC, and it goes around from there.?

I , perhaps stupidly, assumed that using the USBASP board would NOT require a COM port - clearly I was wrong.

So my question on this Xmas day is - please, someone, tell me how in the hell I can send a sketch to my Mega ????????? This issue has totally ruined my Xmas so far, weighing down on me because I MUST upload my code the the mega, nothing else has the memory need, or indeed the pins needed for my particular appllcation.

I really do hope someone can answer my prayers and tell me what my problem is ? I am sure it si probably something stupid, but I will freely admit that I cannot work it out.

Many thanks folks, aND A VERY MERRY XMAS AND HAPPY NEW YEAR TO ALL.

Did you see this thread ?

You wont use a COM port with this.

Upload using programmer" Which you can do by holding the shift key while clicking the Upload button or Sketch > Upload using programmer.

[usbasp windows 10 no com port? - Installation & Troubleshooting - Arduino Forum](http://Did you see this thread ? You wont use a COM port with this. Upload using programmer" Which you can do by holding the shift key while clicking the Upload button or Sketch > Upload using programmer. usbasp windows 10 no com port? - Installation & Troubleshooting - Arduino Forum)

The usb asp does not present as a serial adapter, there is no com port associated with it, . As it does not involve a serial port, the use completely ignores the selected com port when usbasp is selected as the programmer and you tell it to upload using programmer.

chopperaddict:
I have used Zadig to instal a driver as suggested by one member, but that appeared to result in my gaining a new device entirely (in its own libusb-win32 devices category)

You should use the libusbK driver, not libusb-win32.

chopperaddict:
So right now my expensive and very useful (nay - crucial to my project), Mega is persona non grata from my PC via Arduino standard uppoad or by using the recently purchased and installed USBASP.

Why are you using a USBasp instead of just doing a normal upload to the Mega via the USB cable?

chopperaddict:
Hi folksI had already spent hours and hours checking pinouts for the ICSP header on the board. Ergo looking down top left pin is VCC, and it goes around from there.?

Here's the pinout of the ICSP header:

Pin 1 is marked on the silkscreen of the Mega's PCB with a little "1" right next to the pin". There will also be a mark on the USBasp's connector to indicate pin 1, just match the two.

OK guys, I have now tried almost everything suggested. Yep, I have carefully read the mentioned previous thread, and I have seen similar error in my various attempts.

I have uploaded a bootloader to the Mega, no difference whatsoever using standard USB or USBASP.

I can upload this same code, with a few special #defines to limit the code size to something acceptable for the Uno, and it runs on that happily, at least in so far asd my enforced 'define limits allow it to perform.

Buit as soon as I bring out ther Mega, all hell seems to break out. I have now reached a new LOW with it, as described below by the error code from the log :

Replying the the most recent post, I HAVE installed the libusbK driver, not libusb-win32 using Zadig, and yes, my ICSP header is connected correctly, although in desperation I have even tried reversing it ! Still the same results. Equally I have to use the USBASP because the Mega now appears in its own device category as a libusbk device, and does not have access to a COM port. Around and around we go again.....

Hopefully this log may show something to you all ? It is the same using standard upload or USBASP

Arduino: 1.8.5 (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\olwen\AppData\Local\Arduino15\packages -hardware C:\Users\olwen\Documents\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\olwen\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\olwen\Documents\Arduino\libraries -fqbn=arduino:avr:mega:cpu=atmega2560 -vid-pid=0X2341_0X0043 -ide-version=10805 -build-path C:\Users\olwen\AppData\Local\Temp\arduino_build_544110 -warnings=more -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Users\olwen\Documents\Arduino\Railway_slave_point_controller\Railway_slave_point_controller.ino

**** what is this *** ??? Panic does not sound good to me ?

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0xc pc=0x4a75b7]
goroutine 1 [running]:
panic(0x54ef00, 0x127c6030)
/home/jenkins/go/src/runtime/panic.go:500 +0x331
arduino.cc/builder.(*SetupBuildProperties).Run(0x614ef0, 0x12824000, 0x0, 0x0)
/home/jenkins/workspace/arduino-builder-all-cross/src/arduino.cc/builder/setup_build_properties.go:84 +0xfa7
arduino.cc/builder.(*ContainerSetupHardwareToolsLibsSketchAndProps).Run(0x614ef0, 0x12824000, 0x0, 0x0)
/home/jenkins/workspace/arduino-builder-all-cross/src/arduino.cc/builder/container_setup.go:59 +0x2b6
arduino.cc/builder.runCommands(0x12824000, 0x127cbdc0, 0x3, 0x3, 0x1, 0x0, 0x0)
/home/jenkins/workspace/arduino-builder-all-cross/src/arduino.cc/builder/builder.go:191 +0xe2
arduino.cc/builder.(*ParseHardwareAndDumpBuildProperties).Run(0x127cbdec, 0x12824000, 0x0, 0x0)
/home/jenkins/workspace/arduino-builder-all-cross/src/arduino.cc/builder/builder.go:180 +0xdc
arduino.cc/builder.RunParseHardwareAndDumpBuildProperties(0x12824000, 0x0, 0x0)
/home/jenkins/workspace/arduino-builder-all-cross/src/arduino.cc/builder/builder.go:227 +0x35
main.main()
/home/jenkins/workspace/arduino-builder-all-cross/src/arduino.cc/arduino-builder/main.go:329 +0xf78
C:\Program Files (x86)\Arduino\arduino-builder returned 2
Error compiling for board Arduino/Genuino Mega or Mega 2560.
Invalid version found: v1.1.3
Invalid version found: v1.1.3

Well, not sure why, but it seems I have everyone in the forum stumped ?

I have continued to fight my way along with both USB connections and USBASP connections to my Mega2560, STILL to no avail. I continue to get

Sketch uses 26,712 bytes (10%) of program storage space. Maximum is 253,952 bytes.
Global variables use 304 bytes (3%) of dynamic memory, leaving 7,888 bytes for local variables. Maximum is 8,192 bytes.
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
Invalid version found: v1.1.3
Invalid version found: v1.1.3

This is with Gammons Atmega_board_detector code !

In my desperation, reading just about everything I can find on the web about this, I came to the conclusion that I have not yet seen a single sound reason for the problem, or any single suitable answer to this problem, or how to overcome it..

Now, I will be honest, I have NO idea how to use AVRDUDE in it's raw form from the command line, I assume (maybe wrongly) that the Arduino interface knows how to do this ? If not then I would suggest that the whole Arduino environment is in deep dodoo basically, as that is the whole point of the software, to allow code to be written and then UPLOADED to a recognized Arduino board ?.

Many users like myself are happy and competent C programmers, and not even averse to plugging in these "USBASP" devices to our supposedly "working" arduino boards, although the instructions available on what settings we need to change, and to what exactly they should be are still pretty hard to find, but beyond that, we ARE LOST. I have just reinstalled Arduino 1.65 in another desperation move, but that made no difference either, apart from somehow loosing my long exisitng SD library header file.

I got out my magnifying glass (I am a retired pensioner) and carefully studied the TWO DIFFERENT USBASP boards that I happen to have here. The most interesting thing I noticed, having the ongoing CLK errors firmly in the front of my poor mind, was that both the USBASP boards use a 12Mhz crystal, but my Mega 2560, and indeed my Uno etc, have 16Mhz crystals on board.

To my mind (as a 'simple' mechanical engineer of 45 years standing) that equals a major crystal speed mismatch that should not therefore work correctly??

Can this be the (hopefully simple) root of problem that is causing ALL THIS AGGRAVATION. ???????????????????

I have followed the hallowed GAMMON THREADS, and even split my new 10 pin to 6 pin cable to pull out wire 5 (RST) and soldered a breadboard pin on to it so I can do as he suggests and put that in the RESET pin on the boards I am trying to program, rather than the normal SPI RST pin for the board.

It still does not work, I continue as ever to get the same error every time.

I can provide pictures of both my USBASP devices if helpful, one is silk screened as being "EvUSBASP", the other has no formal identity on it as such. Both are new, as are the 10 wire cables and 6 pin adaptor cables.

The mega has never, so far, had a program uploaded to it successfully, or indeed, even a bootloader. The mega continues to have NO COM PORT assigned because it appears in DM as a device in it's own class - linusbk USB devices. I used Zadig to install that driver for it as suggested in several forums. When I connect my Mega via the std USB connector, the Windozze DM shows it again as libusk USB device, so again - NO COM PORT

I am now at my wits end with this, and cannot believe it can be this difficuilt to program some simple code on to what is after all quite an expensive example of the arduino (Mega) breed.

PLEASE SOMEONE - put me out of my misery and give me a working solution to this increasingly ridiculous situation.

THANK YOU ALL SO MUCH FOR ANY ANSWERS !

If none are forthcoming, I can see myself giving up Arduinos for ever. :-(((((

chopperaddict:
avrdude: warning: cannot set sck period. please check for usbasp firmware update.

This is normal. Ignore it.

chopperaddict:
Invalid version found: v1.1.3

This means one of your libraries has its library.properties version property set to a non-semver value. Unfortunately the warning doesn't tell us which library it is.

Hi Pert

"This is normal. Ignore it."

I wish I could, but the upload stops dead there, so how can I make it continue.

The version error has always been there, I do ignore that.

What about the panic errors in my meesage above ?

chopperaddict:
I got out my magnifying glass (I am a retired pensioner) and carefully studied the TWO DIFFERENT USBASP boards that I happen to have here. The most interesting thing I noticed, having the ongoing CLK errors firmly in the front of my poor mind, was that both the USBASP boards use a 12Mhz crystal, but my Mega 2560, and indeed my Uno etc, have 16Mhz crystals on board.

To my mind (as a 'simple' mechanical engineer of 45 years standing) that equals a major crystal speed mismatch that should not therefore work correctly??

Think about it, if the 'missmatch' were an issue then you would need specific USBASP boards to program 16Mhz or 8Mhz processors, and you dont.

chopperaddict:
"This is normal. Ignore it."

I wish I could, but the upload stops dead there

Maybe so, but it has nothing to do with the warning so my advice stands.

Please do this:

  • File > Preferences > Show verbose output during: > compilation (uncheck) > upload (check) > OK
  • Try the upload
  • After the upload fails you'll see a button on the right side of the orange bar "Copy error messages". Click that button.
  • Paste the error messages in a reply here USING CODE TAGS (</> button on the toolbar).

chopperaddict:
What about the panic errors in my meesage above ?

They were there in the one reply but then it the next you didn't post them so I'd have to assume they went away. It was something related to compilation but this:

chopperaddict:
Sketch uses 26,712 bytes (10%) of program storage space. Maximum is 253,952 bytes.
Global variables use 304 bytes (3%) of dynamic memory, leaving 7,888 bytes for local variables. Maximum is 8,192 bytes.

shows that compilation was successful so I guess we don't need to worry about that any more.

Hi Gentleman, and a very happy New Year to one and all.

I have gone back to basic principles, really by force majeur, over the last few days. I have done so in desperation, as I was rapidly collecting a bunch of various types of Arduinos (mostly clones) that ALL FAILED TO ALLOW ME TO UPLOAD TO THEM. The straw that broke my back was the delivery of 2 brand new Sainsmart Mega2650 Arduinos. I immediately tested them both to see if they would allow me to upload sketches to them.

The first one did - Yippee I thought, only to have my hopes well and truly dashed when the 2nd one returned the same old timeout messages on upload. Now these were both using the same USB cable from my PC, and they both came up with different COM port #s, which I changed in the same sketch I was using to test them with.

I Googled endlessly, I read everything I could on these problems, but to be honest, nobody seems to have actually answered the problem correctly, even though there are a huge number of other hobbyists like myself encountering the same or very similar problems, and just about as many unproven suggestions on how to fix it. None worked in my case

I watched endless UTube videos, even those terrible ones produced in India or similar where there is no soundtrack, just on screen typing on a Notepad window, which drove me nearly nuts.

But finally, I watched a video by an Australian who at first discussed the various (trather neat actually) adpators he had made to connect stand alone chips to a USBASP, and I was just about ready to turn it off as it was not covering what I needed, when he said something that got my attention. He mentioned Nick Gammon, and more interestingly, how he had used Nicks's bootloader sketch to load special bootloaders to his own Arduinos.

I watched on with far more interest, and then paused it at a suitable point, dug out a spare brand new Nano, and uploaded Nicks code onto it, making it my MASTER programming machine.

I thern followed this videos instructions on how to wire the 2 arduinos together, by plopping my apparently faulty new Mega2560 on the other end of the wires as the recipient (SLAVE) You know Mosi, Miso, Clk and Cs, including remembering to connect both GROUNDS, and attach the CS to the RESET inputs on the slave machines.

With great trepidation, I brought up the Monitor window of the Master, followed the instructions provided by Nick software, and when I pressed G, miracle of miracles, it reported that it had worked and put a new bootloader on my brand new but not working mega2560.

Yoweeeee I thought, grabbing it quick and ramming the original and same USB connector into it as used previously (yes, I have lots of USB ports floating around), and clicked the Upload button on the same original sketch.

Yes, you guessed it, the sketch uploaded perfectly, and subsequently ran as it should.

Overjoyed at this success, I put all the other Arduinos that had failed me before (about 8 in all of various types, Mega, Uno and Nanos) in a pile on my desk, connected them one by one as slaves to my new "programming" Nano, and yes, it brought EVERYONE OF THEM BACK TO SOLID WORKING LIFE, just like that.

Apart from installing the CH340 driver because my programming Nano showed up as such a device, these was no fiddling with USBASP, no installing any additional drivers with Zadig,etc etc

So, and with no offence meant to anyone in this forum, as I have no idea why this relatively simple method worked when all other suggestions failed, I can only say that I am eternally grateful to Nick Gammon for his bullet proof code, without which I doubt I would haver ever got my Arduinos to program again.

So many thanks again for all your pre New Year inputs, and I felt you might like to know I am back up and running at fullspeed ahead into this new year, and can get on with my several Arduino based projects again, after several weeks of despondency and inability to get on with my work, and indeed, how I achieved that (with the anonymous australians video help as well of course).

I am again a happy puppy in the world of Arduinos.

Ian