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 Send TopicPrint
Hot Topic (More than 8 Replies) Upload-error in VS with VM, but works OK in Arduino IDE (Read 5062 times)
gj
Junior Member
**
Offline


Posts: 42
Joined: Feb 12th, 2016
Upload-error in VS with VM, but works OK in Arduino IDE
Nov 18th, 2019 at 8:20pm
Print Post  
I have this simple sketch that uploads perfectly using Arduino IDE V1.8.9, but gives error in VS2017 (Community, V15.9.17) using Visual Micro (v19.0).
I'm using a Nano with the CH340-chip. I have the driver from CH341SER.EXE installed.

Since the uploading works flawlessly in the Arduino IDE, but not in VS/VM I'm assuming the problem is not with the hardware but with VM.

Code (C++)
Select All
const int pin = 12;

void setup() {
  pinMode(pin, OUTPUT);
}

void loop() {
  digitalWrite(pin, HIGH);
  delay(random(100, 2000));
  digitalWrite(pin, LOW);
  delay(random(100, 500));
}
 



Error:
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x09
« Last Edit: Nov 18th, 2019 at 8:29pm by gj »  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Upload-error in VS with VM, but works OK in Arduino IDE
Reply #1 - Nov 18th, 2019 at 8:30pm
Print Post  
Please try with compile and upload with the tool bar set to Release instead of Debug.

If that still fails you can see the upload command at the end of the trace

Does it work fro the cmd prompt?

Code
Select All
"D:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avrdude" "-CD:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf" -v -V -patmega328p -carduino "-PCOM6" -b57600 -D o.hex:i" 

  
Back to top
WWW  
IP Logged
 
gj
Junior Member
**
Offline


Posts: 42
Joined: Feb 12th, 2016
Re: Upload-error in VS with VM, but works OK in Arduino IDE
Reply #2 - Nov 18th, 2019 at 8:49pm
Print Post  
Code
Select All
C:\Users\****>"D:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avrdude" "-CD:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf" -v -V -patmega328p -carduino "-PCOM6" -b57600 -D ino.hex:i"

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

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

         Using Port                    : COM6
         Using Programmer              : arduino
         Overriding Baud Rate          : 57600
avrdude: ser_open(): can't open device "\\.\COM6": Access is denied.


avrdude done.  Thank you. 



« Last Edit: Nov 18th, 2019 at 9:02pm by gj »  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Upload-error in VS with VM, but works OK in Arduino IDE
Reply #3 - Nov 18th, 2019 at 8:51pm
Print Post  
That failed because the port is open and being used. Maybe arduino ide or vs has serial monitor open?
  
Back to top
WWW  
IP Logged
 
gj
Junior Member
**
Offline


Posts: 42
Joined: Feb 12th, 2016
Re: Upload-error in VS with VM, but works OK in Arduino IDE
Reply #4 - Nov 18th, 2019 at 8:57pm
Print Post  
Code
Select All
C:\Users\****>"D:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avrdude" "-CD:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf" -v -V -patmega328p -carduino "-PCOM6" -b57600 -D ino.hex:i"

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

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

         Using Port                    : COM6
         Using Programmer              : arduino
         Overriding Baud Rate          : 57600
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x43
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x43
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x43
^C
C:\Users\****> 

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


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Upload-error in VS with VM, but works OK in Arduino IDE
Reply #5 - Nov 18th, 2019 at 9:00pm
Print Post  
Thanks that shows avrdude is failing. 

I think you have verbose upload enabled in the arduino ide. Please upload and copy/paste the upload command into this thread. You can highlight and copy the output from arduino using mouse to highlight and keyboard to copy.
  
Back to top
WWW  
IP Logged
 
gj
Junior Member
**
Offline


Posts: 42
Joined: Feb 12th, 2016
Re: Upload-error in VS with VM, but works OK in Arduino IDE
Reply #6 - Nov 18th, 2019 at 9:08pm
Print Post  
Code
Select All
D:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CD:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -carduino -PCOM6 -b115200 -D -Uflash:w:C:\Users\****\AppData\Local\Temp\arduino_build_653940/Test.ino.hex:i  



I ran this from the command-line:
Code
Select All
C:\Users\****>"D:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude" "-CD:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf" -v -patmega328p -carduino -PCOM6 -b115200 -D -Uflash:w:C:\Users\****\AppData\Local\Temp\arduino_build_653940/Test.ino.hex:i

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

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

         Using Port                    : COM6
         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: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: reading input file "C:\Users\****\AppData\Local\Temp\arduino_build_653940/Test.ino.hex"
avrdude: writing flash (1546 bytes):

Writing | ################################################## | 100% 0.36s

avrdude: 1546 bytes of flash written
avrdude: verifying flash memory against C:\Users\****\AppData\Local\Temp\arduino_build_653940/Test.ino.hex:
avrdude: load data flash data from input file C:\Users\****\AppData\Local\Temp\arduino_build_653940/Test.ino.hex:
avrdude: input file C:\Users\****\AppData\Local\Temp\arduino_build_653940/Test.ino.hex contains 1546 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.34s

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

avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: safemode: Fuses OK (E:00, H:00, L:00)

avrdude done.  Thank you. 


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


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Upload-error in VS with VM, but works OK in Arduino IDE
Reply #7 - Nov 18th, 2019 at 9:16pm
Print Post  
Well let's ignore that last issue in arduino for now because it is unrelated.

The issue you have with vm and infact with the external avrdude program might be one of two things.

Arduino sometimes has a random upload bug due to some program size mangic number. Did you confirm the issue happens in Visual Micro in release mode. Your initial post was in debug mode. That can be one way to alter the program size.

I also note that you have a chinese usb driver installed instead of the one that is installed by the arduino ide. Is that intentional? This type of issue is closly related to usb driver.

tip: The usb drivers are in a sub folder called \drivers below the arduino ide. When the board is connected you can use device manager to update the usb driver from that location.
  
Back to top
WWW  
IP Logged
 
gj
Junior Member
**
Offline


Posts: 42
Joined: Feb 12th, 2016
Re: Upload-error in VS with VM, but works OK in Arduino IDE
Reply #8 - Nov 18th, 2019 at 9:33pm
Print Post  
Compiling in either Debug or Release shows:
Code
Select All
D:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avrdude "-CD:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf" -v -V -patmega328p -carduino "-PCOM6" -b57600 -D o.hex:i"
The specified executable is not a valid application for this OS platform.
 



The chinese driver CH341SER was advised by many people across forums having the same (or similar) issue.
« Last Edit: Nov 18th, 2019 at 9:38pm by gj »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Upload-error in VS with VM, but works OK in Arduino IDE
Reply #9 - Nov 18th, 2019 at 11:07pm
Print Post  
That would probably work but it's missing the quotes around the avrdude program at the start

I know this issue can be an inherent problem for some users and sadly it's unrelated to visual micro or we could do something about it.

I think in the past a few things have been established by some users...

1) Sometimes hitting a magic program size number. Adding a little more code can solve the issue.

2) Sometimes using a different avr version can resolve the issue. For example installing the latest arduino 1.8.10 might solve the issue or even using one of the the zip downloads for an older arduino ide such as 1.8.6 might solve the issue. You can use the zips from arduino.cc to install as many arduino versions as you want to try.

3) Sometimes a different usb cable can help but the fact that it works from the arduino ide suggests it's a slightly different end result program size.

It might be useful to note that visual micro uses the avr toolchain that is installed with the arduino IDE and each provides a slightly different avr version. I doubt it really matters which you use. 

  
Back to top
WWW  
IP Logged
 
gj
Junior Member
**
Offline


Posts: 42
Joined: Feb 12th, 2016
Re: Upload-error in VS with VM, but works OK in Arduino IDE
Reply #10 - Nov 20th, 2019 at 11:17am
Print Post  
Ok, I uninstalled Arduino IDE and VS2017.
Then reinstalled VS2017, VM-extension and Arduino IDE.
And it's uploading.
No idea as to why this suddenly stopped working.

Thanks for your support. You guys (and gals?) are so quick to respond. Really good. Cheesy

And that's just one of the reasons I chose to buy your product in the past.

So, now back to the original project I was working on when upload-stuff started to break down on me.  Smiley
« Last Edit: Nov 20th, 2019 at 11:19am by gj »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Upload-error in VS with VM, but works OK in Arduino IDE
Reply #11 - Jan 6th, 2020 at 9:06pm
Print Post  
Thanks, I suspect that when you installed the arduino ide it was a newer version. They have been at arduino adding new toolchains. I guess the newer avrdude.exe uploader tool is happier with your usb driver/cables/something.

Code
Select All
C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avrdude  


  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint