VS Arduino
Visual Micro >> Visual Studio 2017, 2019, 2022 >> Serial does not work with the grbl library
https://www.visualmicro.com/forums/YaBB.pl?num=1660241289

Message started by Lee Critchlow on Aug 11th, 2022 at 6:08pm

Title: Serial does not work with the grbl library
Post by Lee Critchlow on Aug 11th, 2022 at 6:08pm
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?

https://www.visualmicro.com/forums/YaBB.pl?action=downloadfile;file=grblUpload.txt ( 85 KB | 1 Download )

Title: Re: Arduino IDE compiles and uploads, vMicro has compile errors
Post by Tim@Visual Micro on Aug 11th, 2022 at 6:21pm
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

Title: Re: Arduino IDE compiles and uploads, vMicro has compile errors
Post by Lee Critchlow on Aug 11th, 2022 at 10:05pm
Release compiled. :)
https://www.visualmicro.com/forums/YaBB.pl?action=downloadfile;file=Release_003.txt ( 95 KB | 3 Downloads )

Title: Re: Arduino IDE compiles and uploads, vMicro has compile errors
Post by Tim@Visual Micro on Aug 11th, 2022 at 10:12pm
Great. If you add a Serial.begin(115200); to your code does it still compile and link correctly?

Title: Re: Arduino IDE compiles and uploads, vMicro has compile errors
Post by Lee Critchlow on Aug 11th, 2022 at 10:22pm
grblUpload.ino -> #include <grbl.h> // Do not alter this file!
Should I add a setup & loop?

Title: Re: Arduino IDE compiles and uploads, vMicro has compile errors
Post by Lee Critchlow on Aug 11th, 2022 at 10:29pm
Added setup with Serial.begin(115200); and loop (Release).
multiple definition of __vector_23 is gone, however 25 & 26 still exist. :'(

Title: Re: Arduino IDE compiles and uploads, vMicro has compile errors
Post by Tim@Visual Micro on Aug 11th, 2022 at 10:41pm
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?

Title: Re: Serial does not work with the grbl library
Post by Tim@Visual Micro on Aug 12th, 2022 at 7:48pm
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

Title: Re: Serial does not work with the grbl library
Post by Tim@Visual Micro on Aug 12th, 2022 at 11:30pm
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.


Title: Re: Serial does not work with the grbl library
Post by Lee Critchlow on Sep 18th, 2022 at 5:04pm
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. :-/

Title: Re: Serial does not work with the grbl library
Post by Tim@Visual Micro on Sep 18th, 2022 at 8:28pm
Visual Micro uses Arduino compatible solutions. These are questions that should be directed a the author of the library.

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