Welcome, Guest. Please Login or Register
Arduino IDE for Visual Studio
 
 
When Logging a Support Issue in the Forum, please ensure you have also:-
  • Enabled vMicro > Compiler > Show Build Properties and Verbose
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
Support requests without the output above may be impossible to answer, so please help us to help you
 
  HomeSearch Tutorials & Wiki visualmicro.com LoginHelpRegister  
 
Page Index Toggle Pages: 1
Send Topic Print
Unable to upload (Read 6002 times)
perigalacticon
Junior Member
**
Offline



Posts: 41
detroit area
Unable to upload
Jul 30th, 2017 at 7:00am
 
I have an Atmega328PBXplained board and I get errors when trying to upload to it.  I tried the basic Arduino Blink sketch and it compiles.  Here is the uploader output:

Code (C++):
Uploading 'test_blink_debug' to 'Atmel atmega328pb Xplained mini' using 'COM11'
Uploader started for board Atmel atmega328pb Xplained mini
Upload method will be: bootloader
Uploading via Bootloader
C:\Users\Perigalacticon\AppData\Local\arduino15\packages\arduino\tools\avrdude\6.3.0-arduino9\bin\avrdude "-CC:\Users\Perigalacticon\AppData\Local\arduino15\packages\arduino\tools\avrdude\6.3.0-arduino9/etc/avrdude.conf" -v -patmega328p -carduino -PCOM11 -b57600 -D "-Uflash:w:C:\Users\Perigalacticon\AppData\Local\Temp\VMicroBuilds\test_blink_debug\atmel-avr-xminis_atmel-avr-xminis_avr_atmega328pb_xplained_mini/test_blink_debug.ino.hex:i"
avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch
         System wide configuration file is "C:\Users\Perigalacticon\AppData\Local\arduino15\packages\arduino\tools\avrdude\6.3.0-arduino9/etc/avrdude.conf"
         Using Port                    : COM11
         Using Programmer              : arduino
         Overriding Baud Rate          : 57600
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0xe0
avrdude done.  Thank you.
Upload failed 



I see the board on COM11 as named "mEDBG Virtual COM Port (COM11)" on the Device Manager using Win64).  There is a light that blinks on the board several times when it is attempting.  There are no connections to the board other than the usb cable.  I am able to open the serial port on COM11 and there is a code pre-programmed on the board that echos serial port sends and it functions correctly.  I have tried the "AVRISP mkii" and "Atmel mEDBG" uploader options but the errors are the same.

Can you help me get the right upload settings?

Thanks.
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10532
United Kingdom
Re: Unable to upload
Reply #1 - Jul 30th, 2017 at 3:15pm
 
Hi,

I am going to guess that the explained boards don't use the Arduino serial bootloader by default.

If this is true then you probably need to use the "Atmel mEDBG" programmer option.

If you have selected the "Atmel mEDBG" programmer and you see the same error message when uploading then you have not checked the "Always use programmer for upload" menu/checkbox (just below the programmer selection)

You will see a different uploader message when you have correctly selected a programmer.

Notice the message changes from "using COM11" to "using 'Atmel mEDBG'"

Code:
Uploading 'Sketch34' to 'Atmel atmega328p Xplained mini' using 'Atmel mEDBG' 



If you still have an issue the error will be different so please post it.

more...

The above is an Arduino compatible answer. When using Atmel studio and  "mEDBG" you probably have some nice extra options. I will explain those once we see where we are with normal upload.
Back to top
 
WWW  
IP Logged
 
perigalacticon
Junior Member
**
Offline



Posts: 41
detroit area
Re: Unable to upload
Reply #2 - Jul 31st, 2017 at 3:24am
 
EDIT:

I managed to program the board per the Atmel instruction sheet for the board:  http://www.atmel.com/Images/Atmel-42287-ATmega328P-Xplained-Mini-User-Guide_User...
on pages 4 and 5.  It says: "select the connected mEDBG as Tool with Device as ATmega328P and Interface to ISP".  It worked, but I don't think the debugger is working.  The manual says:  " Click the "Project" tab and select the project "properties", click the "Tools" tab and select mEDBG as debugger and debugWIRE as interface."  but I don't see these options anywhere.  I see a dropdown menu for "selected debugger/programmer" but the only options are "Simulator" or "Custom Programming Tool", and then below the menu it says "Programming Only."  If I choose "Start Debugging and Break" under the AS7 Debug toolbar menu I believe it tries to upload to the board using the bootloader and fails to get a response.  This is the first time I've tried to use the AS7 programmer / debugger, I'm sure I've got something wrong!
Back to top
« Last Edit: Jul 31st, 2017 at 2:14pm by Visual Micro »  
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10532
United Kingdom
Re: Unable to upload
Reply #3 - Jul 31st, 2017 at 2:16pm
 
Please confirm upload is working as per the visual micro atmel studio page and then open a new thread if you want to discuss debug.

http://www.visualmicro.com/page/Arduino-for-Atmel-Studio-7.aspx
Back to top
 
WWW  
IP Logged
 
perigalacticon
Junior Member
**
Offline



Posts: 41
detroit area
Re: Unable to upload
Reply #4 - Jul 31st, 2017 at 2:46pm
 
If I choose "Atmel mEDBG" as programmer and "Always use programmer" I get the following output:

Code (C++):
Uploading 'test_blink_debug' to 'Atmel atmega328pb Xplained mini' using 'Atmel mEDBG'
Uploader started for board Atmel atmega328pb Xplained mini
Uploader will use programmer name: medbg
C:\Users\Perigalacticon\AppData\Local\arduino15\packages\arduino\tools\avrdude\6.3.0-arduino9\bin\avrdude "-CC:\Users\Perigalacticon\AppData\Local\arduino15\packages\arduino\tools\avrdude\6.3.0-arduino9/etc/avrdude.conf" -v -patmega328p -cstk500v2 -Pusb "-Uflash:w:C:\Users\Perigalacticon\AppData\Local\Temp\VMicroBuilds\test_blink_debug\atmel-avr-xminis_atmel-avr-xminis_avr_atmega328pb_xplained_mini/test_blink_debug.ino.hex:i"
avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch
         System wide configuration file is "C:\Users\Perigalacticon\AppData\Local\arduino15\packages\arduino\tools\avrdude\6.3.0-arduino9/etc/avrdude.conf"
         Using Port                    : usb
Error during upload using programmer
Upload failed

         Using Programmer              : stk500v2
Upload failed
avrdude: usbdev_open(): did not find any USB device "usb" (0x03eb:0x2104)
The uploader returned an error
avrdude done.  Thank you. 

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



Posts: 10532
United Kingdom
Re: Unable to upload
Reply #5 - Jul 31st, 2017 at 3:05pm
 
The programmers are arduino programmers, atmel studio can cause usb driver issues so you should use atmel studio tools.

If you are in atmel studio selected the Visual Micro programmer called "Atmel Studio Device Programming". Visual Micro will then stop trying to do things the arduino way and hand over to atmel when required. This means your atmel studio project properties >device become important.

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



Posts: 41
detroit area
Re: Unable to upload
Reply #6 - Jul 31st, 2017 at 4:23pm
 
Ok that worked.  I think I had to enable the DWEN fuse for it to work because of an error it gave at first.  I put a breakpoint in, but I don't seem to have the option to step by one line at a time.  Also there was an error window that says that it doesn't support breakpoints.  Should this be working?
Back to top
« Last Edit: Jul 31st, 2017 at 4:24pm by perigalacticon »  
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10532
United Kingdom
Re: Unable to upload
Reply #7 - Jul 31st, 2017 at 4:56pm
 
If upload is working you can switch on vMicro>debugger>atmel studio debugging

Then ensure you have a project_name.cpp with empty project_name.ino, there are some bullets on this page to give tips and also you should see a  note in the build output with link to a project_name.cpp that you can use.

http://www.visualmicro.com/page/Arduino-for-Atmel-Studio-7.aspx
Back to top
 
WWW  
IP Logged
 
perigalacticon
Junior Member
**
Offline



Posts: 41
detroit area
Re: Unable to upload
Reply #8 - Jul 31st, 2017 at 8:26pm
 
Yes I saw that note when I uploaded, I did have the cpp file with the ino name in the project folder.  When I select "Start Debugging and Break" then I get the "Device Programming" window.  Now I choose "Program" under "Memories" and there is no error.  I close the window.  Now there are 3 error notifications when it tries to start the debugger including, they are:  "Launch has failed and Studio could not read the target voltage.  Please check your connections and try again";  "Failed to launch debug session with debugWIRE.  This could be caused by reset line circuitry or disabled debugWIRE interface.  Make sure that the reset line is free before continuing.  Do you want to use SPI to enable the DWEN fuse?";  If I choose yes, then I get the last error: "Failed to enable DW:ispSetBaud: Unexpected response received:  Got 0x84, expected 0x1d" and the only option is to abort.
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10532
United Kingdom
Re: Unable to upload
Reply #9 - Jul 31st, 2017 at 11:53pm
 
Okay so that shows Atmel is trying to do it's stuff without intervention from Visual Micro.

The native atmel avr debuggers have always been complicated which is why I wrote the simpler serial debugger.

Having said that you would hope an explained board is easier than an Arduino Uno in this area.

All I can do is to ensure the correct project properties and a build output. If you find anything that can be changed to help in those areas then I can help.

Otherwise you are in the hands of the native atmel studio tools which are not part of Visual Micro and not an area I am knowledgeable about.
Back to top
 
WWW  
IP Logged
 
perigalacticon
Junior Member
**
Offline



Posts: 41
detroit area
Re: Unable to upload
Reply #10 - Aug 1st, 2017 at 12:49am
 
Ok thanks, I'm asking at the Microchip/Atmel forums.  One thing that is still in your realm, I think, is what happens when it is compiled in VM, and then debugged in AS? 

I read that VM combines all ino files into one ino file before compiling.  Does this mean it includes all the included library files as well?  For instance if I try to debug in AS7 is it going to just read through that one big file or is it going to jump into the separate library files that are used?

If you debug in VM, does it go into each separate library file that is used when it reaches a function from them or are all files combined into the one ino file?

Thanks.

Back to top
 
 
IP Logged
 
perigalacticon
Junior Member
**
Offline



Posts: 41
detroit area
Re: Unable to upload
Reply #11 - Aug 1st, 2017 at 2:02am
 
Is there a way to switch on or off VM such that you could use the "Open Arduino Project" option in AS7?

Thanks.
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10532
United Kingdom
Re: Unable to upload
Reply #12 - Aug 1st, 2017 at 1:26pm
 
Hi,

When you follow the instruction to make a project_name.cpp from your .ino and to have an empty project_name.ino in your project then you question about combining .ino files becomes irrelevant. The atmel debugger doesn't like .ino files so this is why visual micro supports the project_name.cpp alternative.

Normally for arduino it is only the .ino files that get combined into a .cpp all other .cpp files in a project including core and libs remain as normal source code and will be compiled correctly.

If you click "vMicro>Show Hidden Files" then links to all libs will be included in the atmel project and the debugger will find them more easily. Click the menu again to remove the short cuts if you do not want them

"File>Open Arduino Project" is a Visual Micro menu item. I don't understand the question in your last post.
Back to top
 
WWW  
IP Logged
 
perigalacticon
Junior Member
**
Offline



Posts: 41
detroit area
Re: Unable to upload
Reply #13 - Aug 2nd, 2017 at 4:28am
 
Sorry I read about importing arduino projects into AS7 directly and I thought that was the method.  I see you have to start a new project to do that.  There was a problem when I showed the hidden files something happened and none of the linked files would open.  But after making a new project it worked again.  Thanks for your help.
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10532
United Kingdom
Re: Unable to upload
Reply #14 - Aug 2nd, 2017 at 8:15pm
 
Thanks for the update
Back to top
 
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print