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
Normal Topic Debugger messages from Arduino (Read 7772 times)
Felice
Newbies
*
Offline


Posts: 7
Location: Florence (Italy)
Joined: Mar 22nd, 2013
Debugger messages from Arduino
Apr 14th, 2013 at 2:44pm
Print Post  
Hi,
I just had an interesting experience. I am using Visual Micro and the relevant debugger to code and test the Arduino and my c# programs. I am not a professional, this is only my hobby.

If you load the Arduino sketch from the Visual Micro plugin after you have made breakpoints for debugging it, you will have messages back from the Arduino serial informing the debugger about what you are monitoring.
Messages like these:

VMDPE_3|131_VMDPE (here I sent to Arduino a command to setup the PWM on analog 3 to 131)
VMDPE_3|0_VMDPE (here I sent to Arduino a command to setup the PWM on analog 3 to 0)
VMDPE_4|255_VMDPE (here I sent to Arduino a command to setup the PWM on analog 5 to 255)
VMDPE_4|0_VMDPE (here I sent to Arduino a command to setup the PWM on analog 5 to 0)
VMDPE_7|1_VMDPE (here I sent a command to setup pin 2 HIGH)
VMDPE_6|0_VMDPE (here I sent a command to setup pin 2 LOW)
VMDPE_5|1_VMDPE (here I sent a command to setup pin 13 HIGH)
VMDPE_8|0_VMDPE (here I sent a command to setup pin 13 LOW)

Now, in general this should not be a problem but if your application controlling the Arduino has  to catch messages from the Arduino serial to do something, this could generate a mess.

Also look at my post in the Arduino Forum here: http://arduino.cc/forum/index.php/topic,160424.0.html

I would first appreciate if you can confirm my understanding of such problem and if so, I suggest to add in the debugger an option to load the sketch without the breakpoints.

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


Posts: 12188
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Debugger messages from Arduino
Reply #1 - Apr 14th, 2013 at 4:02pm
Print Post  
Hi there,

In the youtube video on the debug page you will see that you can switch to the "Debug" (or ano) configuration and then enable the (Micro Debug) property. This then allows you to easily switch between "release" non-debug and "Debug" modes very easily. You must then compile and upload to complete the switch between debug and non-debug program versions.

+ When (Micro Debug) is enabled you have the option to "Debug>Start" WITH or WITHOUT debugging.

So this describes two ways to switch between debug mode and non-debug mode.

When you compile without debug then breakpoints are ignored and the serial will be clean. 

The debugger works via usb serial by injecting serial debug commands into a temp copy of the current sketch. This must be done during compilation and therefore, as explained above, you must compile and upload when a change to debug mode, breakpoints or expressions is made and this should answer your question as to how to put the arduino back in normal serial mode. 

The default for the debugger is to use the standard upload serial port. This does allow you to share the serial port but not if you also have a program that wants to use the port at the same time as the debugger runs.

It sounds like it would be best for your project if the debugger used a different serial port. Using a different port is an option of the debug. 

The debugger supports two different transports, HardwareSerial and SoftwareSerial. 

If you are using a larger arduino chip such as a 1280 or 2560 then you can use the HardwareSerial ports of the Arduino which are named Serial, Serial1, Serial2, Serial3 etc. Obviously "Serial" is the default and is the main upload port of any Arduino which we don't want to use in this case. So you could buy an FTDI cable and connect to tx1/rx2 or tx2/rx2 on the Arduino and use for dedicated debugging. In this case you would enter "Serial1" or "Serial2" in the "RemotePort" project property and in the "LocalPort" project property enter the COMx port of the FTDI cable that appears when you plug it in to the computer.

The 2nd option that works with all Arduino chips is again to use an FTDI cable but with the "RemoteTransport" project property set to "SoftwareSerial". In this case the FTDI will connect to any two arduino digital pins that support interrupts. Actually, if you are not stopping (break/pause) on breakpoints and not updating variables on the running Arduino the debugger only requires a single Arduino digital pin (tx/transmit).

With the softwareSerial option I recommend setting the RemoteSpeed to 57k or 19k which will ensure that debugger comms between pc and arduino works at a slower speed that the 115k default. SoftwareSerial is more reliable at slightly slower speeds than HarwareSerial.

To be clear, If you use a dedicated serial port for debug then you will have two cables connected between the arduino and the pc. This will allow your c# program to work at the same time as the debugger. In this case I would recommend opening two copies of vs, one with your c# windows project and one with the arduino project. This will allow both the windows app and the arduino program to be debugged at the same time  Cheesy

There are some articles on the vm wiki that might clarify some of what I have said. Let me know if it doesn't make sense.

Thanks
  
Back to top
IP Logged
 
Felice
Newbies
*
Offline


Posts: 7
Location: Florence (Italy)
Joined: Mar 22nd, 2013
Re: Debugger messages from Arduino
Reply #2 - Apr 14th, 2013 at 4:13pm
Print Post  
Thanks for your exhaustive reply.
Kind regards
Felice
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12188
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Debugger messages from Arduino
Reply #3 - Apr 14th, 2013 at 4:14pm
Print Post  
Forgot to say that when using SoftwareSerial you must also specify the RemoteTx and RemoteRx project properties. 

These properties should contain the numbers of the Arduino digital pins that you connect the FTDI cable to.

The defaults are shown in the help tips below the property window.

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