VS Arduino
>> >> Debugging problems
https://www.visualmicro.com/forums/YaBB.pl?num=1546533625

Message started by greebstreebling on Jan 3rd, 2019 at 4:40pm

Title: Debugging problems
Post by greebstreebling on Jan 3rd, 2019 at 4:40pm
Hi I have just started using the Vm debug tools in Atmel Studio 7 and I am doing some simple things (having read the VM tutorials). There are two problems:

When I upload the Arduino sketch (with the breakpoints active), sometimes the output window says 'Launching debugger....' and just stops there, it doesn't show the BP text. I tried disabling the BP but this didn't help.

The other problem is that the serial monitor window is showing unexpected characters such as VMDPE + other graphic characters.

My program is not very demanding of the serial port, it's a driver for a stepper motor which receives commands from a main program, so serial traffic is confined to commands such as 'SA220.00#' which would result in an 'OK#' response - very little serial traffic.


I ensured VM was setup as in the tutorial.

Any thoughts appreciated.
Paul



Title: Re: Debugging problems
Post by greebstreebling on Jan 3rd, 2019 at 5:01pm
It looks like the serial port locks up after I send the initial command using the serial monitor. The contents of two of the variables I asked for in the BP are displayed once only, then the output window ceases to scroll too.
Thanks for any help,
Paul

Title: Re: Debugging problems
Post by greebstreebling on Jan 4th, 2019 at 10:38am
I learnt from this post:

http://electronics4dogs.blogspot.com/2014/12/debugger-for-arduino-visual-micro.html

which is quite informative, that the VMDPE messages are part of Visual Micro's breakpoint operations, so at least I know the origin, but should I be expecting these messages? The tutorial does not mention them and they make my serial comms very messy. Is there anything I can do to clean things up?

I still haven't got breakpoints to work reliably in my code, but I'll keep trying.

thanks for any help.
Paul

Title: Re: Debugging problems
Post by Visual Micro on Jan 4th, 2019 at 1:26pm
You should not need to be inspecting vm debug messages.

There are a few things to note.

1) When debug is ON, The serial send by your own code must be be terminated by a println() prior to Visual Micro sending it's own serial packets.

2) If the setup() method of your chip is called very quickly (starts quickly) there is possibility that the initial "debug hello" packet will be missed by the pc because they arrive before the serial monitor can open/start. This is not an issue but breakpoints and trace points in setup() can also be missed for this reason.

3) Sharing a serial port between debugger and your own code can be problematic if your own code does not send println() type terminator and also if your own code reads the serial port. In this case debug supports an alternative serial port if your hardware does or support a SoftwareSerial type of connection on one or two digital pins.



Title: Re: Debugging problems
Post by greebstreebling on Jan 5th, 2019 at 8:34am
ok thanks for the reply Tim, I can work around what you've said and  have made some progress myself. If I used a Teensy microcontroller, presumably I could use one of its two USB ports for debugging?

In the little time I've used visual studio debug tools, I can see they're really useful aids.
Thanks
Paul

Title: Re: Debugging problems
Post by Visual Micro on Jan 5th, 2019 at 5:38pm
Great thanks.

Yes you can either use another serial port for the visual micro debugger or use a usb>serial cable along with a couple of spare digital pins. To use a different serial port you set vMicro>Debugger> "Local Port" to the other COM port and "Remote Port" to Serial2 or other valid port name.

Docs here

Debugging-With-Different-Ports

VS Arduino » Powered by YaBB 2.6.12!
YaBB Forum Software © 2000-2024. All Rights Reserved.