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
Hot Topic (More than 8 Replies) Arduino Leonardo - debugging and serial output issues (Read 31701 times)
Fabien
Junior Member
**
Offline


Posts: 13
Location: Redmond, WA
Joined: Nov 23rd, 2012
Arduino Leonardo - debugging and serial output issues
Dec 5th, 2012 at 5:23am
Print Post  
Hi,

I've been testing Visual Micro 1.1211.04 with an Arduino Leonardo using VS 2010 Pro. The test proggy just blinks the LED on pin 13 and spits out some serial data.

#include "HardwareSerial.h"
#include "Arduino.h"
const int led = 13;
void setup(){
     Serial.begin(57600);
     pinMode(led, OUTPUT);
}
void loop(){
     Serial.write("Leonardo says Hi!\r\n");
     while(true){
           digitalWrite(led, 1);
           delay(50);
           digitalWrite(led, 0);
           delay(50);
           Serial.write(".");
     }
}

Even though I placed a breakpoint (breaks unconditionally) on the first line in the loop function, on "Serial.write("Leonardo says Hi!\r\n");", it does not get hit.

The debugger options are set like so:

  • The project is built as 'Debug'
  • Memory Usage Report: True
  • Micro Debug: Full
  • Enable Break/Pause: False (True seems to work and blocks the execution indefinitely since no serial data ever seems to make it through to the debugger)
  • Local Speed: 57600 (I'm aware of the serial speed issues above 57.6 kbps with the Leonardo)
  • Remote Speed: 57600


When compiling and starting the debugger, things start out as expected:

Compiling debug version of 'Test' for 'Arduino Leonardo'
Binary sketch size: 6072 bytes (of a 28672 byte maximum) (0.5100292 secs)

AVR Memory Usage
----------------
Device: atmega32u4

Program:    6072 bytes (18.5% Full)
(.text + .data + .bootloader)

Data:        280 bytes (10.9% Full)
(.data + .bss + .noinit)

text         data          bss          dec          hex      
      0         6072            0         6072         17b8

Uploading to I/O board using 'COM20'
Done uploading via 'COM22'

Usually, this is followed by a couple dialog boxes:

---------------------------
Visual.Micro.Visual.Studio.Arduino.10
---------------------------
Visual micro was unable to load a debugger extension

Assembly: C:\Program Files (x86)\Visual Micro\Visual Micro for Arduino\Micro Extensions\Debugger Visualizations\PerformanceMonitor\bin/PerformanceMonitor.dll

Type: VisualizationExamples.PerformanceMonitorWindow

Exception has been thrown by the target of an invocation.
---------------------------
OK   
---------------------------

---------------------------
Visual.Micro.Visual.Studio.Arduino.10
---------------------------
Unable to load debugger visualization: C:\Program Files (x86)\Visual Micro\Visual Micro for Arduino\Micro Extensions\Debugger Visualizations\PerformanceMonitor\bin/PerformanceMonitor.dll

Exception has been thrown by the target of an invocation.
---------------------------
OK   
---------------------------

As the app runs on the Arduino, there are no debug traces and no debug messages.
The terminal window opens up on COM 20 as expected and at the proper speed (57600 baud) but no serial data shows up. If I open a dumb terminal on COM 20, I do see the expected app output.

After watching the detailed YouTube video on configuring and using the debugger and trying various Micro Debug options, all signs seem to point to a serial port issue not being initialized or opened properly but I have no clue why that is.

Commenting out all calls to Serial.xxx() functions in the application doesn't alter the behavior, neither does adding a "while(!Serial);" in the setup() function.

Please let me know if you'd like a more detailed report of the project properties or the full project if this helps.

Thank you,

Cheers,
-Fabien.

PS: if this is any help, the machine I'm testing with runs 64-bit Windows 7, is very stable and used for development with other tool chains (mostly using IAR Workbench with STLinkv2) targeting ARM Cortex Mx, STM8S chips and Netduino Go boards running the .Net Micro Framework.
« Last Edit: Dec 5th, 2012 at 5:30am by Fabien »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino Leonardo - debugging and serial output issues
Reply #1 - Dec 5th, 2012 at 1:49pm
Print Post  
I'm using the same machine as you. I think your own serial messages combined with debugger are overflowing the Leonardo buffer. We have some users working well with the debug on Leonardo but bear in mind that 

"Serial" is USB and not hardwareSerial on a Leonardo. USB serial is not as good but notice that a Leonardo also has "Serial1" which is uses normal Arduino HardwareSerial.

Questions

Does it work it you comment out all of your serial.write() and serial.begin() messages? 

Why are you using serial.write instead of serial.print()

Your while(true) will ensure we only ever see one hit on the loop() breakpoint so it's not such a good test.

« Last Edit: Dec 5th, 2012 at 3:28pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Fabien
Junior Member
**
Offline


Posts: 13
Location: Redmond, WA
Joined: Nov 23rd, 2012
Re: Arduino Leonardo - debugging and serial output issues
Reply #2 - Dec 5th, 2012 at 6:52pm
Print Post  
Tim,

"Does it work it you comment out all of your serial.write() and serial.begin() messages?"

FR> No, it does not. I mentioned that commenting out all Serial.xxx() calls had no effect in my initial report.

"Why are you using serial.write instead of serial.print()"

FR> Old habits Wink Why not though?

"Your while(true) will ensure we only ever see one hit on the loop() breakpoint so it's not such a good test."

FR> I just wanted to hit a breakpoint to see the debugger halting and jumping to the corresponding line in the source code before going any further into the loop. It's a test that is as good as any for an unconditional breakpoint as I'm testing the debugger's basics. Moving the breakpoint within the while() loop has no effect either.

As of now, here's the snippet stripped down of all Serial.xxx(), with an unconditional breakpoint on 'digitalWrite(led, state);' and the debugger still does not break.

#include "Arduino.h"
const int led = 13;
void setup(){
     pinMode(led, OUTPUT);
}
static int state = 1;
void loop(){
     while(true){
           digitalWrite(led, state); // <-- unconditional bkpt here
           state ^= 1;
           delay(25);
     }
}

Can you please comment on the exception dialog boxes that I'm seeing when starting the debugger?

---------------------------
Visual.Micro.Visual.Studio.Arduino.10
---------------------------
Visual micro was unable to load a debugger extension

Assembly: C:\Program Files (x86)\Visual Micro\Visual Micro for Arduino\Micro Extensions\Debugger Visualizations\PerformanceMonitor\bin/PerformanceMonitor.dll

Type: VisualizationExamples.PerformanceMonitorWindow

Exception has been thrown by the target of an invocation.
---------------------------
OK   
---------------------------

---------------------------
Visual.Micro.Visual.Studio.Arduino.10
---------------------------
Unable to load debugger visualization: C:\Program Files (x86)\Visual Micro\Visual Micro for Arduino\Micro Extensions\Debugger Visualizations\PerformanceMonitor\bin/PerformanceMonitor.dll

Exception has been thrown by the target of an invocation.
---------------------------
OK   
---------------------------
« Last Edit: Dec 5th, 2012 at 6:55pm by Fabien »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino Leonardo - debugging and serial output issues
Reply #3 - Dec 5th, 2012 at 6:59pm
Print Post  
Serial.write is ok.

Edit

Ignore my last message I will make another shortly
« Last Edit: Dec 5th, 2012 at 7:00pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino Leonardo - debugging and serial output issues
Reply #4 - Dec 5th, 2012 at 7:04pm
Print Post  
Please uninstall the two Visual Micro apps via control panel add or remove programs. Then run both installers again. The errors you are getting are important. During the main plugin install it installs a dll into the windows gac, this is the dll that is causing the error so let's re-install and see what happens. You should be prompted to allow admin access. Make sure you click OK but I am sure you did.

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


Posts: 13
Location: Redmond, WA
Joined: Nov 23rd, 2012
Re: Arduino Leonardo - debugging and serial output issues
Reply #5 - Dec 5th, 2012 at 7:24pm
Print Post  
"Please uninstall the two Visual Micro apps via control panel add or remove programs. Then run both installers again. The errors you are getting are important. During the main plugin install it installs a dll into the windows gac, this is the dll that is causing the error so let's re-install and see what happens. You should be prompted to allow admin access. Make sure you click OK but I am sure you did."

FR> Ok. I'll try again and will report on what happens.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino Leonardo - debugging and serial output issues
Reply #6 - Dec 5th, 2012 at 7:30pm
Print Post  
Great. I've removed the prev post because I removed my post 2 mins after I made it. I reviewed tge thread and realized you had done everything correctly. Thanks!
  
Back to top
IP Logged
 
Fabien
Junior Member
**
Offline


Posts: 13
Location: Redmond, WA
Joined: Nov 23rd, 2012
Re: Arduino Leonardo - debugging and serial output issues
Reply #7 - Dec 5th, 2012 at 7:55pm
Print Post  
So, I entirely removed Visual Micro and the debugger, then re-installed everything, answering Yes to all admin elevation prompts and keeping the default ACLs suggested by the installer, starting by installing ArduinoForVisualStudio.msi, then VisualMicroDebugUpgrade1211_04.msi.

I'm still getting the same error on PerformanceMonitor.dll when the debugger starts.

A quick search reveals that the PerformanceMonitor.dll is installed but is nowhere else on the system. I expected to see it in one of the GAC directories as well, but it is not there.

C:\>dir PerformanceMonitor.dll /s
Volume in drive C has no label.
Volume Serial Number is D46F-1DB2

Directory of C:\Program Files (x86)\Visual Micro\Visual Micro for Arduino\Micro Extensions\Debugger Visualizations\PerformanceMonitor\bin

11/04/2012  08:19 PM            14,848 PerformanceMonitor.dll
               1 File(s)         14,848 bytes

     Total Files Listed:
               1 File(s)         14,848 bytes
               0 Dir(s)  13,424,607,232 bytes free
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino Leonardo - debugging and serial output issues
Reply #8 - Dec 5th, 2012 at 8:03pm
Print Post  
The gac dll is called Visual.Micro.Debugger.Data.Extensions.dll and it  relies on .net3.5. The dll is installed into the gac by the main plugin installer.

The performancemonitor.dll is part of the open source controls that are installed below the vm program folder when the debugger upgrade installer runs. The dll provides the free memory usage graph that shows if you enable the option.

I think you will find the dlls are installed because they have installed fine for many users. So we should check your .net3.5 is up to date?

Thanks


  
Back to top
IP Logged
 
Fabien
Junior Member
**
Offline


Posts: 13
Location: Redmond, WA
Joined: Nov 23rd, 2012
Re: Arduino Leonardo - debugging and serial output issues
Reply #9 - Dec 5th, 2012 at 8:30pm
Print Post  
"The gac dll is called Visual.Micro.Debugger.Data.Extensions.dll and it  relies on .net3.5"

Ok, I believe we have found the source of the issue. 
The .dll is indeed in the GAC, but on my box, there's not .Net 3.5, only .Net 4.x. 
I'll need to install .Net 3.5 before I can try again...

One suggestion: it may be worthwhile for the installer(s) to check if the .Net system dependencies are satisfied?

C:\>dir Visual.Micro.Debugger.Data.Extensions.dll /s
Volume in drive C has no label.
Volume Serial Number is D46F-1DB2

Directory of ee8c9ebd4902

12/05/2012  11:42 AM            37,376 Visual.Micro.Debugger.Data.Extensions.dll
               1 File(s)         37,376 bytes

     Total Files Listed:
               1 File(s)         37,376 bytes
               0 Dir(s)  13,886,562,304 bytes free

Thanks,
-Fabien.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino Leonardo - debugging and serial output issues
Reply #10 - Dec 5th, 2012 at 8:43pm
Print Post  
Yes that's certainly the problem. .NET3.5 is in the prerequisites list on codeplex. 

You are right about forcing the check via the installer however I've been keeping the installer as simple as possible because it installs .net3.5 api for vs 2008, .net 4.0 api for vs 2010 and .net4.5 for 2012. 

It is only recently that I decided to make a single compile of the open source debugger controls with the lowest common denominator of .net3.5, so this would mean forcing .net3.5 for users of the std plugin who are not using the debugger. 

I think it probably makes sense to do this. Thanks for working through it.
  
Back to top
IP Logged
 
Fabien
Junior Member
**
Offline


Posts: 13
Location: Redmond, WA
Joined: Nov 23rd, 2012
Re: Arduino Leonardo - debugging and serial output issues
Reply #11 - Dec 6th, 2012 at 12:25am
Print Post  
Let's take a step back for a moment...

I dug into the requirements for .Net 3.5 and I don't understand why it's needed: I cracked open the Visual Micro installer project as well as the extension projects for PerformanceMonitor and AnalogGraphExample and I saw no hard-coded version dependency on .Net 3.5.

The only item that appears to be hard-bound to the .Net 3.5 is the Visual.Micro.Debugger.Data.Extensions.dll project because the .dll is specifically tied to .Net 3.5 in the GAC.

But why does it have to be this way considering that the GAC is capable of keeping multiple versions/cultures of the same assembly?

Only seeking to understand...

Cheers,
-Fabien.
« Last Edit: Dec 6th, 2012 at 12:26am by Fabien »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino Leonardo - debugging and serial output issues
Reply #12 - Dec 6th, 2012 at 12:45am
Print Post  
Unless you tell me otherwise I have the following projects and have to make the following compiles each time I make an upgrade. Each then has to be tested.

1. 2008 .net3.5 (vs addin + api)
2. 2010 .net4.0 (vs addin + api)
3. 2012 .net4.5 (vs addin + api)
4. Shared gac extension project (.Net3.5)
5. Vm plugin installer

6. 4 x Debugger open source projects mapped to .net3.5 assembly
7. Debugger upgrade msi

Obviously in the future I might combine the debugger upgrade into the plugin msi

All the debugger open source projects can compile for any .net version but reference the .net3.5 gac dll

If I was to ship different versions of the gac dll I would have to make separate projects and compiles for each:- 

8. extension for .net4
9. extension for .net4.5

If I wanted to ship the open source debugger controls with pre-compiled dlls (ready to use) for each .net version this would involve:-

10. 4 x .Net 4.0 debugger visualization
11. 4 x .Net 4.5 debugger visualization

But in theory you would also require different installers for each .net version with prerequisites
12. plugin installer for .net4.0
13. plugin installer for .net4.5

And the list goes on. Does this make sense to you?
  
Back to top
IP Logged
 
Fabien
Junior Member
**
Offline


Posts: 13
Location: Redmond, WA
Joined: Nov 23rd, 2012
Re: Arduino Leonardo - debugging and serial output issues
Reply #13 - Dec 6th, 2012 at 2:33am
Print Post  
Well, I'm not sure why it's necessary to compile multiple times: if VM works on .Net 3.5, it should also just work on .Net 4.0. Also, the .Net 4.0 and .Net 4.5 frameworks share the same runtime, only libraries change.

So, if you're not using any code specific to the latest and greatest features found in .Net 4.5 only, things should continue humming along. MSFT spent a great deal of resources ensuring this would remain true.

At the end of the day, you should be fine compiling against .Net 3.5 only, removing any hard framework version dependency from your assemblies. This should help you reducing the complexity of your test matrix by quite a bit Wink 

Perhaps the VM community can help with validating that everything continues working as expected under various versions of Visual Studio when a major VM update is released, but even that should not be required.

Cheers,
-Fabien.
« Last Edit: Dec 6th, 2012 at 2:55am by Fabien »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino Leonardo - debugging and serial output issues
Reply #14 - Dec 6th, 2012 at 8:20am
Print Post  
Huh, don't believe that ms hype, its much more complicated than that. 

Vs addins need references to different vs api versions or they don't work. Vs addins need to match the vs platform or debugging the addins doesn't work. Serial comms crashes more easily in 3.5 so 4.0 is required when available.

So as you know 3.5 has been used where possible and that is why you need it installed an you have answered your own question  Smiley

Did you uninstall .net3.5 from win7, I thought it came with 3.5 as standard?
  
Back to top
IP Logged
 
Fabien
Junior Member
**
Offline


Posts: 13
Location: Redmond, WA
Joined: Nov 23rd, 2012
Re: Arduino Leonardo - debugging and serial output issues
Reply #15 - Dec 6th, 2012 at 8:19pm
Print Post  
"Huh, don't believe that ms hype, its much more complicated than that. "

FR> Lol! Well, there still may be some trace amounts of 'Kool-Aid' left in my system since I left MSFT a year ago, but not that much Wink

"Vs addins need references to different vs api versions or they don't work. Vs addins need to match the vs platform or debugging the addins doesn't work. Serial comms crashes more easily in 3.5 so 4.0 is required when available."

FR> Ah! Ok. That would make sense, likely due to specific API interface versioning. This is a different issue than the backward-compatibility by design of the .Net runtime though.

"Did you uninstall .net3.5 from win7, I thought it came with 3.5 as standard?"

FR> You're correct: .Net 3.5.1 is part of the Windows Features that can be enabled in the "Program and Features" Control Panel with a checkbox. It's a dependency for built-in WCF activation (WCF is currently unchecked on my box).

However, even with .Net 3.5.1 enabled, the debugger still won't run, so there's more to the story here, as if some .Net 3.5 binaries have gone missing. 

I'll investigate deeper what may have happened and will let you know.

Cheers,
-Fabien.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino Leonardo - debugging and serial output issues
Reply #16 - Dec 6th, 2012 at 8:24pm
Print Post  
Thanks
  
Back to top
IP Logged
 
Fabien
Junior Member
**
Offline


Posts: 13
Location: Redmond, WA
Joined: Nov 23rd, 2012
Re: Arduino Leonardo - debugging and serial output issues
Reply #17 - Dec 11th, 2012 at 4:16am
Print Post  
Hi Tim,

Over the weekend, I setup a new Window 8 system (64-bit, same as my other system) and guess what... same exact issue: the debugger won't start and fails with the same "PerformanceMonitor.dll" errors as on the other system. 
The Leonardo driver is installed and I can deploy code to it, the .Net framework 3.5 is enabled, fully patched, etc. In short, everything checks out. At this point, I don't believe this issue has anything to do with .Net 3.5 anymore. 

Do you have suggestions on how we can proceed to diagnose what's going on?

Thanks,
-Fabien.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino Leonardo - debugging and serial output issues
Reply #18 - Dec 11th, 2012 at 4:18pm
Print Post  
Hi Fabien,

I don't have any ideas, it seems to work for everyone else so must be something different about your systems.

I'll give it some more thought but sounds like a .net or permissions problem
  
Back to top
IP Logged
 
John Ewert
Newbies
*
Offline


Posts: 6
Location: Comox BC Canada
Joined: Nov 15th, 2012
Re: Arduino Leonardo - debugging and serial output issues
Reply #19 - Dec 26th, 2012 at 9:34pm
Print Post  
Hello Tim,

Thanks for all you do.

I found this thread today as I am having same (or similar)  problem getting Debug Package to work correctly on a Mega 2560 board (Visual Mcro is working great with no problems). I'm getting following errors:

Visual micro was unable to load debugger extensions Assembly .....PerformanceMonitor.dll....Could not load file or assembly 'Visual micro Debugger Data Extensions' or one of its dependencies. The system cannot find the file specified.

Visual micro was unable to load debugger extensions Assembly .....AnalogGraphExample.dll....

Visual micro was unable to load debugger extensions Assembly .....DigitalPinsExample.dll.

I have verified that the 3 files are in fact installed.

I have verified that .NET 3.5 and .NET 4.5 are installed.

I have uninstalled Visual Micro and the Debug Package and re-installed both.

I have removed Serial.begin and all Serial.print statements.

My setup is:

Win 7 Ult
VS2012 Pro
Visual Micro 1210.40
Debug Package 3.2

Arduino mega 2560

Regards,
John

  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint