Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: [1] 2  Send TopicPrint
Very Hot Topic (More than 25 Replies) Upload Fail (Read 24300 times)
Gil
Junior Member
**
Offline


Posts: 12
Joined: Mar 31st, 2014
Upload Fail
Mar 31st, 2014 at 1:42pm
Print Post  
I'm using Atmel Studio 6.2, Arduino IDE 1.0.r-r2, the last beta version of visual micro (1403.31).
The board is a Sparkfun pro micro 5V.
With the Arduino IDE everything is working like is the books, (compile, upload).

With AS 6.2 and Visual Micro, unable to upload to the binary via the USB bootloader. I get the following output message:

Binary sketch size: 6244 bytes (used 22% of a 28672 byte maximum) (0.30 secs)
Uploading to I/O board using 'COM16'
Upload failed. Did you select the correct upload method for this board?
Object reference not set to an instance of an object.


The command used is Project/Upload Last Sketch Build, not the Upload using Programmer.
After digging in every menus, preferences or other options, I did not find how to select the correct upload method for this board.  
Any help would be very welcome and appreciated.

  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12137
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Upload Fail
Reply #1 - Mar 31st, 2014 at 1:56pm
Print Post  
Hi,

That's probably a bug in upload last sketch if you have never uploaded successfully before. I expect you clicked Build just before that?

You do not need to do that. The normal upload command is "Debug>Start with or without debugging" F5 or Shift+F5

The build command just does a build to ensure the code is correct. 

All the start/debug commands build and upload. The blue and green arrows on the tool bar are the same as the menus and function keys so can be used as short cuts.

Thanks
  
Back to top
IP Logged
 
Gil
Junior Member
**
Offline


Posts: 12
Joined: Mar 31st, 2014
Re: Upload Fail
Reply #2 - Mar 31st, 2014 at 2:08pm
Print Post  
Thank you for your answer but I tried every commands, green arrow , the green arrow with small dashes, which correspond to debug/start without debugging or ctrl-Alt- F5 or debug/start debugging or F5, I get always the same result.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12137
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Upload Fail
Reply #3 - Mar 31st, 2014 at 2:40pm
Print Post  
Oh I see thanks.

Pleaser switch on tools>options>visual micro>compiler>verbose

Then compile and post the end of the output where it attempts upload.

Thanks

  
Back to top
IP Logged
 
Gil
Junior Member
**
Offline


Posts: 12
Joined: Mar 31st, 2014
Re: Upload Fail
Reply #4 - Mar 31st, 2014 at 3:07pm
Print Post  
Here is what I get with verbose on:

Compiling 'blink' for 'SparkFun Pro Micro 5V/16MHz'
Build folder: file:///C:/Users/Gil/AppData/Local/VMicro/Arduino/Builds/blink/promicro16
Summary: Header=1 Prototypes=3 Imports=0
Additional Defines: VISUALMICRO_COMPILER_VER=1;
Architecture Tools: C:\Program Files\Arduino\hardware\tools\avr\bin\
GCC: 4.3.2
Sketchbook: file:///E:/Electronics/Arduino
Include Path 'C:\Program Files\Arduino\hardware\arduino\cores\arduino'
Include Path 'C:\Program Files\Arduino\hardware\SF32u4_boards-master\variants\promicro'
Include Path 'C:\Program Files\Arduino\libraries'
Include Path 'C:\Program Files\Arduino\hardware\SF32u4_boards-master\libraries'
Include Path 'E:\Electronics\Arduino\libraries'
C:\Program Files\Arduino\hardware\tools\avr\bin\avr-g++ -c -g -Os -fno-exceptions -ffunction-sections -fdata-sections -Wall -mmcu=atmega32u4 -DF_CPU=16000000L -MMD -DUSB_VID=0x1B4F -DUSB_PID=0x9206 -DARDUINO=105 -I"C:\Program Files\Arduino\hardware\arduino\cores\arduino" -I"C:\Program Files\Arduino\hardware\SF32u4_boards-master\variants\promicro" -I"C:\Program Files\Arduino\libraries" -I"C:\Program Files\Arduino\hardware\SF32u4_boards-master\libraries" -I"C:\Program Files\Visual Micro\Visual Micro for Arduino\Micro Platforms\default\debuggers" -I"E:\Electronics\Arduino\libraries" -o "C:\Users\Gil\AppData\Local\VMicro\Arduino\Builds\blink\promicro16\blink.cpp.o"  "C:\Users\Gil\AppData\Local\VMicro\Arduino\Builds\blink\promicro16\blink.cpp"  -DVISUALMICRO_COMPILER_VER=1
C:\Program Files\Arduino\hardware\tools\avr\bin\avr-gcc -Os -Wl,--gc-sections -mmcu=atmega32u4 -L"C:\Users\Gil\AppData\Local\VMicro\Arduino\Builds\blink\promicro16" -o "C:\Users\Gil\AppData\Local\VMicro\Arduino\Builds\blink\promicro16\blink.elf" "C:\Users\Gil\AppData\Local\VMicro\Arduino\Builds\blink\promicro16\blink.cpp.o" "C:\Users\Gil\AppData\Local\VMicro\Arduino\Builds\blink\promicro16\core.a" -lm
C:\Program Files\Arduino\hardware\tools\avr\bin\avr-objcopy -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 "C:\Users\Gil\AppData\Local\VMicro\Arduino\Builds\blink\promicro16\blink.elf" "C:\Users\Gil\AppData\Local\VMicro\Arduino\Builds\blink\promicro16\blink.eep"
C:\Program Files\Arduino\hardware\tools\avr\bin\avr-objcopy -O ihex -R .eeprom "C:\Users\Gil\AppData\Local\VMicro\Arduino\Builds\blink\promicro16\blink.elf" "C:\Users\Gil\AppData\Local\VMicro\Arduino\Builds\blink\promicro16\blink.hex"
Binary sketch size: 6244 bytes (used 22% of a 28672 byte maximum) (0.50 secs)
Uploading to I/O board using 'COM16'
Upload failed. Did you select the correct upload method for this board?
Object reference not set to an instance of an object.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12137
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Upload Fail
Reply #5 - Mar 31st, 2014 at 3:14pm
Print Post  
Thanks we will try it in a while please confirm the following

1) Arduino ide version? Did you mean 1.0.5-r2?

2) "Tools>Visual Micro>Upload Using Programmer" is un-ticked?

3) Link to the sparkfun product page for the exact board

Thanks
« Last Edit: Mar 31st, 2014 at 3:15pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Gil
Junior Member
**
Offline


Posts: 12
Joined: Mar 31st, 2014
Re: Upload Fail
Reply #6 - Mar 31st, 2014 at 3:26pm
Print Post  
Yes sorry, Arduino IDE is 1.0.5-r2
Upload using programmer is unticked
and the link to the board https://www.sparkfun.com/products/12640
The Arduino addon for the board is installed, an working properly  (it does not work with Arduino 1.5 IDE directories are different)
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12137
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Upload Fail
Reply #7 - Mar 31st, 2014 at 3:29pm
Print Post  
Thanks, yes I see a note on sparkfun that the 1.5 version is available but the 1.0.x version should work.

You can see all normal arduino boards + the sparkfun in Atmel Studio right?

Thanks

  
Back to top
IP Logged
 
Gil
Junior Member
**
Offline


Posts: 12
Joined: Mar 31st, 2014
Re: Upload Fail
Reply #8 - Mar 31st, 2014 at 3:45pm
Print Post  
Yes, I can select the board with the associated COM port, the compilation works. 
I can upload the code using the hex file and  a standard ISP programmer (AVR ISP and some wires soldered on the board).

With the Arduino IDE I can upload the code using the usb bootloader, (AVRISP does not work  from Arduino IDE, it needs a different driver)


  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12137
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Upload Fail
Reply #9 - Mar 31st, 2014 at 5:28pm
Print Post  
Hi,

Can you please tell me if "tools>options>visual micro>communications>port discovery error" contains any text?

Thanks
  
Back to top
IP Logged
 
Gil
Junior Member
**
Offline


Posts: 12
Joined: Mar 31st, 2014
Re: Upload Fail
Reply #10 - Mar 31st, 2014 at 5:31pm
Print Post  
No, its blank
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12137
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Upload Fail
Reply #11 - Mar 31st, 2014 at 5:46pm
Print Post  
Thanks.

Would you please install this update http://www.visualmicro.com/downloads/arduinoforvisualstudio.msi

It contains better error info at the point where your upload reports a problem.

Then try again and post the trace output from "Uploading to I/O board using 'COM16'" onward.

Thanks
  
Back to top
IP Logged
 
Gil
Junior Member
**
Offline


Posts: 12
Joined: Mar 31st, 2014
Re: Upload Fail
Reply #12 - Mar 31st, 2014 at 5:51pm
Print Post  
Uploading to I/O board using 'COM16'
Upload failed. Did you select the correct upload method for this board?
System.NullReferenceException: Object reference not set to an instance of an object.
   at processing.app.debug.AvrdudeUploader.uploadUsingPreferences(String buildPath, String className, Boolean verbose, Boolean ProgrammerUploadUsing, String mcuProgrammerOverrideName)
   at processing.app.SketchEditor.Upload(Boolean verbose)
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12137
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Upload Fail
Reply #13 - Mar 31st, 2014 at 5:54pm
Print Post  
Thanks, the error isn't much use. I'll add some more trace messages and make a new update shortly.
  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12137
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Upload Fail
Reply #14 - Mar 31st, 2014 at 7:16pm
Print Post  
The link has been refreshed with an update. There are new uploader messages when verbose compile is enabled.

Please post the trace again

Thanks
« Last Edit: Mar 31st, 2014 at 9:08pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Gil
Junior Member
**
Offline


Posts: 12
Joined: Mar 31st, 2014
Re: Upload Fail
Reply #15 - Apr 1st, 2014 at 5:23am
Print Post  
Binary sketch size: 6244 bytes (used 22% of a 28672 byte maximum) (1.31 secs)
Uploading to I/O board using 'COM16'
Uploader started for board SparkFun Pro Micro 5V/16MHz
Uploader sometimes uses programmer name: arduinoisp
Upload method will be: bootloader
Uploading via Bootloader 
C:\Program Files\Arduino\hardware\tools\avr\bin\avrdude -C"C:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf" -v -v -v -v -patmega32u4 -cavr109 -P\\.\COM16 -b57600 -D -V nk.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:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf"

         Using Port                    : \\.\COM16
         Using Programmer              : avr109
         Overriding Baud Rate          : 57600
avrdude: ser_open(): can't open device "\\.\COM16": Accès refusé.


avrdude: Send: E [45] 
avrdude: ser_send(): write error: sorry no info avail
  
Back to top
 
IP Logged
 
Gil
Junior Member
**
Offline


Posts: 12
Joined: Mar 31st, 2014
Re: Upload Fail
Reply #16 - Apr 1st, 2014 at 5:43am
Print Post  
Here is what Aeduino IDE is doing :

Binary sketch size: 6,244 bytes (of a 28,672 byte maximum)
Forcing reset using 1200bps open/close on port COM16
PORTS {COM1, COM16, } / {COM1, COM16, } => {}
PORTS {COM1, COM16, } / {COM1, COM16, } => {}
PORTS {COM1, COM16, } / {COM1, COM16, } => {}
PORTS {COM1, COM16, } / {COM1, COM16, } => {}
PORTS {COM1, COM16, } / {COM1, COM16, } => {}
PORTS {COM1, COM16, } / {COM1, COM16, } => {}
PORTS {COM1, COM16, } / {COM1, COM16, } => {}
PORTS {COM1, COM16, } / {COM1, COM16, } => {}
PORTS {COM1, COM16, } / {COM1, } => {}
PORTS {COM1, } / {COM1, } => {}
PORTS {COM1, } / {COM1, COM18, } => {COM18, }
Found Leonardo upload port: COM18
C:\Program Files\Arduino\hardware/tools/avr/bin/avrdude -CC:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega32u4 -cavr109 -P\\.\COM18 -b57600 -D .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:\Program Files\Arduino\hardware/tools/avr/etc/avrdude.conf"

         Using Port                    : \\.\COM18
         Using Programmer              : avr109
         Overriding Baud Rate          : 57600
         AVR Part                      : ATmega32U4
         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


Apparently, the forced reset is not completed with visual micro and the board does not switch to the bootloader on PORT 18
  
Back to top
 
IP Logged
 
Gil
Junior Member
**
Offline


Posts: 12
Joined: Mar 31st, 2014
Re: Upload Fail
Reply #17 - Apr 1st, 2014 at 6:28am
Print Post  
Well, now its working, but (frustration..) I don't know why.
I tried Arduino IDE to get the last output posted, then 
I deleted the Debug directory, to check something else
And tried again to upload successfully this time.

Why I deleted the debug directory has nothing to do with the upload problem. I use AVRISP MKII for ISP programming and I noticed that the .hex or .elv file in the debug directory, is not the last version. I have to compile to times to get the very last one. Any Idea ?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12137
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Upload Fail
Reply #18 - Apr 1st, 2014 at 12:25pm
Print Post  
The elf and hex in the specified project output folder is a new feature. please switch on "tools>options>visual micro>compiler>show build folder" this will give you a link to the real build folder.

When the elf files are of the wrong time please compare with the ones on the build folder and let me know if they are different.

Thanks
  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12137
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Upload Fail
Reply #19 - Apr 1st, 2014 at 2:07pm
Print Post  
Hi,

Quote:
device "\\.\COM16": Accès refusé


The error suggested that the com port was not available. Did you still have the arduino ide open with the terminal window open?

Either way this was a windows/avrdude problem with the usb port. 

Visual Micro runs the same upload program (avrdude) that the arduino ide uses and with the trace we can see the params are near enough the same. So an "access" error can only be some internal issue due to the port being in use or windows being temporarily confused but we don;t normally see confusion.

I am pleased it is working now please report is you have further problems.
  
Back to top
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint