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
Hot Topic (More than 8 Replies) Serial does not work with the grbl library (Read 1939 times)
Lee Critchlow
Junior Member
**
Offline


Posts: 18
Location: TN
Joined: Jul 19th, 2022
Serial does not work with the grbl library
Aug 11th, 2022 at 6:08pm
Print Post  
I am attempting to install grbl on a Mega 2560. I downloaded the library from GitHub  gnea/grbl-Mega. The errors are: multiple definition of max, min, & bit, multiple definition of __vector_23, multiple definition of __vector_25, and multiple definition of __vector_26. I've used #ifndef for duplicates of variables but I do not know what to do with the ISRs. With a little research, I think it has something to do with the existence of wiring.c.o, which I believe is not used by the grbl library.
I used Arduino IDE to compile and upload the original grbl with success. Then when I used vMicro Port Monitor, I get the grbl Welcome Message. However, when I type various grbl commands, all I get is two 'ok's.
Do I just comment out the offending ISR definitions or is there another answer?
« Last Edit: Aug 12th, 2022 at 7:44pm by Tim@Visual Micro »  

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


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino IDE compiles and uploads, vMicro has compile errors
Reply #1 - Aug 11th, 2022 at 6:21pm
Print Post  
Please switch the configuration name on the toolbar to Release and then attach the output again after build/upload. 

In Release mode Visual Micro should be exactly the same as the Arduino IDE. After that is proven we can discuss debug options.

Thanks
« Last Edit: Aug 11th, 2022 at 7:30pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Lee Critchlow
Junior Member
**
Offline


Posts: 18
Location: TN
Joined: Jul 19th, 2022
Re: Arduino IDE compiles and uploads, vMicro has compile errors
Reply #2 - Aug 11th, 2022 at 10:05pm
Print Post  
Release compiled. Smiley
« Last Edit: Aug 11th, 2022 at 10:06pm by Lee Critchlow »  

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


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino IDE compiles and uploads, vMicro has compile errors
Reply #3 - Aug 11th, 2022 at 10:12pm
Print Post  
Great. If you add a Serial.begin(115200); to your code does it still compile and link correctly?
  
Back to top
WWW  
IP Logged
 
Lee Critchlow
Junior Member
**
Offline


Posts: 18
Location: TN
Joined: Jul 19th, 2022
Re: Arduino IDE compiles and uploads, vMicro has compile errors
Reply #4 - Aug 11th, 2022 at 10:22pm
Print Post  
grblUpload.ino -> #include <grbl.h> // Do not alter this file!
Should I add a setup & loop?
« Last Edit: Aug 11th, 2022 at 10:23pm by Lee Critchlow »  
Back to top
 
IP Logged
 
Lee Critchlow
Junior Member
**
Offline


Posts: 18
Location: TN
Joined: Jul 19th, 2022
Re: Arduino IDE compiles and uploads, vMicro has compile errors
Reply #5 - Aug 11th, 2022 at 10:29pm
Print Post  
Added setup with Serial.begin(115200); and loop (Release).
multiple definition of __vector_23 is gone, however 25 & 26 still exist. Cry
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino IDE compiles and uploads, vMicro has compile errors
Reply #6 - Aug 11th, 2022 at 10:41pm
Print Post  
That means the library redefines the timer used by serial which is the default debug mechanism for visual micro. Visual Micro can use software serial for most boards which might use different or no timers.

I don't know if the Serial1,2 etc ports of the mega use different interrupts or timers. If they do then the debugger than use those instead of Serial.

If the library presents a special serial object that implements the same methods and properties that the arduino serial object implements then we can also use that for debugging.

If your board supports hardware debugging that might also be an option.

Does this help?
« Last Edit: Aug 11th, 2022 at 11:45pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Serial does not work with the grbl library
Reply #7 - Aug 12th, 2022 at 7:48pm
Print Post  
Hi, you just sent a log? I think we have established that in release mode the compile is fine but when serial or the serial debugger is used the project can not b compiled. This is by design by the author of the grbl library. The possible solutions to support debugging are outlined in my previous post.

When time allows, we will investigate the library to see if we can make other recommendations but you can also post a question to the library author to ask for recommendations to make Serial or a type of Serial work alongside the library
  
Back to top
WWW  
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Serial does not work with the grbl library
Reply #8 - Aug 12th, 2022 at 11:30pm
Print Post  
We have looked at the "grbl-Mega-edge" library and it is not designed for users to add any arduino code in the normal way. It overrides the arduino main.cpp with its own main.c. The entire running of the mcu is controlled via the main.c in the library itself. 

Without modifying the library the only debug capability would be via hardware debugging which the 2560 does support.  Hardware debugging will alter the cpu speed and I suspect that would cause an issue with the grbl code.

The library does include some debug facity which reports useful information via it's own serial system. Take a look at the config.h in the library itself for the setting that the library supports. 

In Visual Micro click "vMicro>Show/Hide Hidden Files" to more easily see the sources within the grbl library.

  
Back to top
WWW  
IP Logged
 
Lee Critchlow
Junior Member
**
Offline


Posts: 18
Location: TN
Joined: Jul 19th, 2022
Re: Serial does not work with the grbl library
Reply #9 - Sep 18th, 2022 at 5:04pm
Print Post  
Would it be correct if I created a grbl.ino file and placed the setup portion of main.c into setup and the protocol.c into loop? I ask since trying to add components to grbl has not been successful. Adding those components to setup and loop should work. Undecided
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Serial does not work with the grbl library
Reply #10 - Sep 18th, 2022 at 8:28pm
Print Post  
Visual Micro uses Arduino compatible solutions. These are questions that should be directed a the author of the library.
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint