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) Serial debug. (Read 2123 times)
MikeM
Junior Member
**
Offline


Posts: 17
Location: Swindon
Joined: Nov 6th, 2024
Serial debug.
Nov 21st, 2024 at 9:13pm
Print Post  
Updated VM & VS 2 days ago.

I have a problem with a feature/s of the debugger causing my code to crash, and a subsequent restart. ( more further below)
Whilst researching the cause of this, I used the "blink" code  with a few added variables, for proving the debugger. 

I noted the following :- Expression window.
1)  The documentation shows red text & a yellow cell in the expression window.  In reality these colours are not present. A bit confusing to a new start with a Very Old Brain. I appreciate maintenance of a project like VM is difficult.

2)The code pauses if the appropriate box is unticked and proceeds as expected when the appropriate key is pressed. Trace configuration window.

3) When appending the variable name with =? it is possible to change the value in the variable, whilst the code is Running.  Just select the approppriate cell, change the value and then hit Enter.

Re my real problem - 
My code runs Ok with and without debug.
If however I try to use =? or @Report.. functions, it crashes.
Work in progress - any suggestions welcome.
« Last Edit: Nov 21st, 2024 at 9:15pm by MikeM »  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2728
Joined: Feb 13th, 2019
Re: Serial debug.
Reply #1 - Nov 22nd, 2024 at 9:35am
Print Post  
Thanks for the report and detail, and we will update the documentation as suggested.

Can you give some example code, or attach the simple project as a ZIP (without the ".vs" folder) so we can review the variable being changed with the breakpoint?

Also please attach the full build output with the settings shown at the top of the page.
  
Back to top
IP Logged
 
MikeM
Junior Member
**
Offline


Posts: 17
Location: Swindon
Joined: Nov 6th, 2024
Re: Serial debug.
Reply #2 - Nov 22nd, 2024 at 11:43am
Print Post  
Attached is the build file for the code that crashes when I apply the  =? or @Report...  functions.

Apologies for not including the build file earlier, I have just found how to save & retrieve it.

Other requuested data to follow.........
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
MikeM
Junior Member
**
Offline


Posts: 17
Location: Swindon
Joined: Nov 6th, 2024
Re: Serial debug.
Reply #3 - Nov 22nd, 2024 at 12:08pm
Print Post  
Attached is the blink file I described. I tested it again before sending. Same response.

The variable I was able to change was the float f.
Same response when it was defined as Int.

Build file included.
  

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


Posts: 2728
Joined: Feb 13th, 2019
Re: Serial debug.
Reply #4 - Nov 22nd, 2024 at 2:22pm
Print Post  
Thanks for the project and the logs.

Do you see the same crash when using the editable variable, but with the breakpoint not set to continue code execution?

I can't currently replicate the crash with this sketch, could you try running a repair on VS2022?

Also can you attach the Micro Build output for the simple project so I can ensure I am using all the same settings (in case they differ from your main project).
« Last Edit: Nov 22nd, 2024 at 2:25pm by Simon@Visual Micro »  
Back to top
IP Logged
 
MikeM
Junior Member
**
Offline


Posts: 17
Location: Swindon
Joined: Nov 6th, 2024
Re: Serial debug.
Reply #5 - Nov 22nd, 2024 at 3:23pm
Print Post  
I have just changed from a Mega 256 to an Uno R3 - you never know??

and YES it works!!
It runs as it should with or without breakpoints - but still I can change the variable whilst the code is running.
..........................
The crash only occurs when I use =? or the @Report...  On the Mega only.

Breakpoints dont work on the Mega, when the =? or Report .. are used.

I havent tested breakponts on the Meag without =? or @Report

You should have the mico build files for both projects.

I havent yet run a repair on VS2022
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2728
Joined: Feb 13th, 2019
Re: Serial debug.
Reply #6 - Nov 22nd, 2024 at 3:25pm
Print Post  
Thanks for the update, I don't think the repair is needed as the Uno works.

We will look into any specific Mega Code for the Debugger and update when we have a fix or workaround available.
  
Back to top
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2728
Joined: Feb 13th, 2019
Re: Serial debug.
Reply #7 - Nov 22nd, 2024 at 4:40pm
Print Post  
Quote:
You should have the mico build files for both projects.


The log in the ZIP was from the Output > Build Window, can you attach the Output > Micro Build Output from the test project?

Currently I am unable to replicate this, but we will keep investigating...
  
Back to top
IP Logged
 
MikeM
Junior Member
**
Offline


Posts: 17
Location: Swindon
Joined: Nov 6th, 2024
Re: Serial debug.
Reply #8 - Nov 22nd, 2024 at 4:48pm
Print Post  
Many thanks.
Just tried Mega with a breakpoint and a {variable} -it crashed.
Removed breakpoint;  it runs & displays variable.
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2728
Joined: Feb 13th, 2019
Re: Serial debug.
Reply #9 - Nov 22nd, 2024 at 4:49pm
Print Post  
Thanks, is that with the simple Blink project provided?

Can you send the complete Micro Build output in case we are missing a setting which is causing the crash?
  
Back to top
IP Logged
 
MikeM
Junior Member
**
Offline


Posts: 17
Location: Swindon
Joined: Nov 6th, 2024
Re: Serial debug.
Reply #10 - Nov 22nd, 2024 at 8:52pm
Print Post  
Good evening,
Re my last post - this test was with my project file.

The blink file runs on the mega, debug, {variable=?}, @Report, breakpoint,- all no problem.

My project file fails on the Mega wihen I use {variable=?}, @Report, breakpoint.

You have the build file for the crashing configuration. I sent it at 11:43 - its there I have just opened it  its called DSG5Build.txt

With the Uno - there are no problems.
  
Back to top
 
IP Logged
 
MikeM
Junior Member
**
Offline


Posts: 17
Location: Swindon
Joined: Nov 6th, 2024
Re: Serial debug.
Reply #11 - Nov 23rd, 2024 at 10:39am
Print Post  

Correction :-

The blink file runs on the mega, debug, {variable=?}, @Report, breakpoint,- all no problem.  should read :-

The blink file runs on the Uno, debug, {variable=?}, @Report, breakpoint,- all no problem.

It had been a long day.!!
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2728
Joined: Feb 13th, 2019
Re: Serial debug.
Reply #12 - Nov 25th, 2024 at 12:10pm
Print Post  
Thanks for the clarification.

The log for the crashing configuration looks to be a much larger/complex project than the blink sketch which was sent over.

I assume the blink sketch on the mega fails with the single breakpoint with just the {f=?} action set? (without any @Report or other features enabled)

  
Back to top
IP Logged
 
MikeM
Junior Member
**
Offline


Posts: 17
Location: Swindon
Joined: Nov 6th, 2024
Re: Serial debug.
Reply #13 - Nov 25th, 2024 at 4:28pm
Print Post  
My project for the Mega is much larger etc.
It uses ser comms to a nextion display.
2 dig inputs for encoder - 2 interrupts
1 dig input for speed input - 1 interrupt
+ 0ther dig and analogue inputs.
(its for machine control)

The blink sketch on the mega runs ok with breakpoints & {f=?}

My project runs ok on mega, its only when I use {variable=?} or @Report etc that it crashes
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2728
Joined: Feb 13th, 2019
Re: Serial debug.
Reply #14 - Nov 25th, 2024 at 4:45pm
Print Post  
Thanks for clarifying, and explains why I cannot repro this on the Mega with the blink sketch etc...

When you said your code crashes on the Mega, is it that the board needs to be reset to get it running again?

Is it only when you change the variable in the Serial Debugger that it all goes wrong?

Finally, does your code use the same Serial port that the Debugger is using? (I only ask as the serial debugger can be moved onto a different Serial port if needed so the comm's for the debugger and your code become completely isolated)
  
Back to top
IP Logged
 
MikeM
Junior Member
**
Offline


Posts: 17
Location: Swindon
Joined: Nov 6th, 2024
Re: Serial debug.
Reply #15 - Nov 25th, 2024 at 9:13pm
Print Post  
On a Mega, the code starts,  I see an lcd initialise & data appears and then it restarts again without any intervention from me. If I remove the {=?} but leave the {variable}, it runs ok.

On an Uno the same code runs fine.

No change of variable is done. The mega just keeps restarting.
I have tried Serial1 & Serial2 on the mega. Same result.

I have also removed the Nextion code & the Nextion Library, in case there was a conflict, but it still restarts.
I have also tried a second Mega board - it still restarts.

On the Uno - it runs fine.
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2728
Joined: Feb 13th, 2019
Re: Serial debug.
Reply #16 - Nov 25th, 2024 at 9:25pm
Print Post  
Thanks for the update.

Would it be possible to ZIP the whole solution (minus the .vs folder) and email it to us with a link to this thread to investigate?

We will of course remove the files once the issue is resolved.
  
Back to top
IP Logged
 
MikeM
Junior Member
**
Offline


Posts: 17
Location: Swindon
Joined: Nov 6th, 2024
Re: Serial debug.
Reply #17 - Nov 26th, 2024 at 8:49pm
Print Post  
You should have the files now.
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2728
Joined: Feb 13th, 2019
Re: Serial debug.
Reply #18 - Nov 27th, 2024 at 11:11am
Print Post  
Thanks for the files.

Running this with just the boards (no LCD Screen etc) we see the same problem with your code crashing and restarting on the mega.

If you change the printf statement on line 324 to be separate Serial.print statements then it all seems to work as expected with the debugger enabled, and you see this output in the Serial Monitor (when using printf you don't).

This is likely down to how Stdout is interpreted by the microcontroller, the Uno only has "Serial" wheras the Mega has Serial, Serial1, Serial2, Serial3.

I'm not currently sure why the Serial Debugger causes the crash when using the editable variable, however this does add code which attempts to read and write to the serial buffer.  We will try and debug this to get a better understanding of what is happening here.
  
Back to top
IP Logged
 
MikeM
Junior Member
**
Offline


Posts: 17
Location: Swindon
Joined: Nov 6th, 2024
Re: Serial debug.
Reply #19 - Nov 27th, 2024 at 9:06pm
Print Post  
Many thanks, my problem is solved but I think yours isnt??

On a separate issue -re the forum.
It would be good to have an email indicating when a reply is posted to a querie.
Have I missed a configuration some where.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint