*Note: these instruction are for updating CNC xPRO V1 through CNC xPRO V4. To update firmware on the CNC xPRO V5, please see these instruction.
Thanks to the great people working on the Arduino IDE, it has everything you need to compile grbl included in their software package. This method compiles the Grbl source code and automatically uploads it to an Arduino.
NOTE: Before starting, delete prior Grbl library installations from the Arduino IDE. Otherwise, you'll have compiling issues! On a Mac, Arduino libraries are located in ~/Documents/Arduino/libraries/. On Windows, it's in My Documents\Arduino\libraries. On Linux (Ubuntu), it's in /usr/share/arduino/libraries
- If you don’t already have the Arduino IDE installed do so now
- Download the Grbl source code from the github directory.
· Click on the <>Code Tab
· Click the CLONE/DOWNLOAD button on the Grbl home page.
· Click the Download ZIP
· Unzip the download and you'll have a folder called grbl-XXX, where XXX is the release version.
- Launch the Arduino IDE
· Make sure you are using the most recent version of the Arduino IDE!
- Load the grbl folder into the Arduino IDE as a Library.
· Click the Sketch drop-down menu, navigate to Include Library and select Add .ZIP Library. The Add .ZIP Library command supports both a .ZIP file or a folder. In our case, there is no .ZIP file.
· You can confirm that the library has been added. Click the Sketch drop-down menu again, navigate to Include Library, then scroll to the bottom of the list where you should see grbl.
· IMPORTANT: Select the grbl folder inside the grbl-XXX folder, which only contains the source files and an example directory.
· If you accidentally select the .zip file or the wrong folder, you will need to navigate to your Arduino library, delete the mistake, and re-do Step 3.
- Open the GrblUpload Arduino example.
· Click the File down-down menu, navigate to Examples->Grbl, and select GrblUpload.
· Do not alter this example in any way! Grbl does not use any Arduino code. Altering this example may cause the Arduino IDE to reference Arduino code and compiling will fail.
- Compile and upload Grbl to your Arduino.
· Connect your CNC xPRO to your computer.
· Make sure your board is set to the Arduino Uno in the Tool->Board menu and the serial port is selected correctly in Tool->Serial Port. *Note - the CNC xPRO is programmed as an Uno for both the 328p and 328pb chip variants.
· Click the Upload, and Grbl should compile and flash to your xPRO! (Flashing with a programmer also works by using the Upload Using Programmer menu command.)
Note: Remember to apply the correct settings for your build – common build settings found here
Compiling GRBL or Advanced Users: Most users are just fine with Grbl's default build, but you can customize Grbl by editing the config.h file in the Arduino library (not where you downloaded it, it has been copied into Arduino Library) folder. This file enables or disables all of Grbl's additional compile-time options. There are descriptions in the file that explains what they all do. Once edited and saved, just follow the steps above to flash your custom Grbl build!
Errors: If you receive a "not in sync" error message:
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
You will need to manual sync the xPRO and the Arduino IDE. Press the Upload button in the IDE, then press and hold the Silver Reset button on the xPRO. Watch the bottom right corner of the IDE, it will have a message that says "compiling.. " and then it will change to "Uploading..". When it changes to "Uploading, release the reset button on the xPRO. This may take a few tries to get the timing correct.