Update GRBL firmware on CNC 3018 Pro

 Posted by:   Posted on:   Updated on:  2021-12-07T10:22:27Z

Flash the latest GRBL firmware on ATmega328p controller boards of CNC 3018 Pro machines

CNC 3018 Pro is a low-cost CNC router that should be used mostly with wood and acrylic plastic. It can also be used to mill PCBs and cut soft metals like aluminum with proper settings. The machine uses both metal and plastic parts. Electronics is based on a custom made ATmega328p board with A4988 stepper drivers. Spindle uses a common DC775 motor fitted with ER11 chuck.

I recently bought one from Banggood (I chose the version with offline controller because it allows me to load gcode from SD card and use the CNC without a computer next to it). To my surprise it came with an old version of GRBL firmware (0.9j) so I started gathering information about how I can update it.

Update GRBL firmware on CNC 3018 Pro

I should mention that the product description page on Banggood strictly mentions it has GRBL 0.9 because 1.1 is unstable and the machine does not run „smoothly”.

Note:The software version should be version 0.9, version 1.1 is unstable, which will cause the engraving machine to run unsmoothly!

While most people would have sticked with manufacturer recommendations and stop here, I wanted to see what issues appear with GRBL 1.1 on CNC 3018 Pro. I will tell you now: none. The CNC runs... smoothly. Following is a hassle-free method of backing up existing firmware and flashing a new one without any additional hardware.

Precompiled binaries of GRBL firmware do exist (that is what I am going to use too) only for ATmega328p, probably all CNC 3018 boards use this MCU. The update process described here will not work with different hardware. It is still a good thing to inspect the board first. Mine is a custom design with soldered stepper drivers.

Control board of CNC 3018 Pro

Control board of CNC 3018 Pro

Backup

I decided to make a full backup: the current settings from GRBL console, EEPROM data and flash contents. First, using either Candle (GrblControl) or UGS I sent $$ command. The CNC reports all its settings:

$0=10 (step pulse, usec)
$1=25 (step idle delay, msec)
$2=0 (step port invert mask:00000000)
$3=0 (dir port invert mask:00000000)
$4=0 (step enable invert, bool)
$5=0 (limit pins invert, bool)
$6=0 (probe pin invert, bool)
$10=3 (status report mask:00000011)
$11=0.010 (junction deviation, mm)
$12=0.002 (arc tolerance, mm)
$13=0 (report inches, bool)
$20=0 (soft limits, bool)
$21=0 (hard limits, bool)
$22=0 (homing cycle, bool)
$23=0 (homing dir invert mask:00000000)
$24=25.000 (homing feed, mm/min)
$25=500.000 (homing seek, mm/min)
$26=250 (homing debounce, msec)
$27=1.000 (homing pull-off, mm)
$100=800.000 (x, step/mm)
$101=800.000 (y, step/mm)
$102=800.000 (z, step/mm)
$110=800.000 (x max rate, mm/min)
$111=800.000 (y max rate, mm/min)
$112=800.000 (z max rate, mm/min)
$120=10.000 (x accel, mm/sec^2)
$121=10.000 (y accel, mm/sec^2)
$122=10.000 (z accel, mm/sec^2)
$130=200.000 (x max travel, mm)
$131=200.000 (y max travel, mm)
$132=200.000 (z max travel, mm)

Copy your output and save in a text file! You will need it later.

I will also make a backup of the EEPROM which holds exactly these setting in some binary format. The problem is that I cannot flash GRBL 1.1 and keep old EEPROM contents. So all of the above settings must be compared and set to their specific values for this machine with the new GRBL version.

avrdude is the tool used to read the old firmware and program the new one. Being used by Arduino IDE, it is free, open-source and available on all platforms. But, to make things even more clear, I used AVRDUDESS, a graphical tool for the command line programmer. If you are trying to make a backup, launch it, start by setting programmer to Arduino, choose the right serial port and set baud rate to 57600. At this point, if you never opened the plastic case of the controller board and you don't know whether it uses ATmega328p or not, click Detect button. If the MCU ID is different than what you see in my screenshot, it's worth looking at the hardware. If the chip is marked as ATmega328p, select it in the combobox and ignore the different ID. If the board has a different MCU, you cannot continue since GRBL is precompiled for ATmega328p.

Read ATmega328p flash and EEPROM with AVRDUDESS

Read ATmega328p flash and EEPROM with AVRDUDESS

Proceed by checking Read, then choose Intel Hex format and browse to a file to save current data. After you did this, click Go for both flash and EEPROM sections. Do not mess with other options (no need to click Program!). CNC will reset, you will hear a clicking sound from the steppers, and if the control board uses Arduino bootloader, everything should work.

If you're on a different operating system or you prefer command line, these are the two commands (adjust port and file paths):

avrdude -u -c arduino -p m328p -P COMx -b 57600 -U flash:r:"/path/to/file/grbl_0.9j_3018pro.hex":i
avrdude -u -c arduino -p m328p -P COMx -b 57600 -U eeprom:r:"/path/to/file/grbl_0.9j_3018pro_eeprom.hex":i

Update

Keep AVRDUDESS open. Just go to Flash section, change to Write, set Format to Auto (writing only). Download the latest GRBL precompiled HEX file (1.1h at the time of writing this). Select it in AVRDUDESS at Flash section and click Go. The new firmware will be flashed to board, and it will reset. That was it.

Flash GRBL 1.1 on ATmega328p with AVRDUDESS

Flash GRBL 1.1 on ATmega328p with AVRDUDESS

Close AVRDUDESS and open a serial console (connect in Candle/UGS). By the way, the command to flash firmware is:

avrdude -u -c arduino -p m328p -P COMx -b 57600 -U flash:w:"/path/to/file/grbl_v1.1h.20190825.hex":a

This is the procedure you can use to flash the original firmware in case of issues. Just remember, after each update procedure, check CNC settings from EEPROM.

Settings

Connect to the machine. It should respond with then new GRBL version. Send $$ command to print all settings. The new firmware erased previous EEPROM contents (settings were stored here). Trying to write the old EEPROM back will not do anything good. On boot, the new firmware will keep erasing EEPROM contents from old versions.

There are not many settings. Open the settings backup text file. Take each one and check if it has changed. In my case, steps/mm and maximum rate were messed up for all axes. To change a setting and store it to EEPROM, send:

$100=800

Do this for each of the settings which need to be changed. As a side note, my CNC came with inverted direction of Y axis. I had to change this with $3=2. Do you have issues connecting to the board with avrdude? Drop a comment.

10 comments :

  1. Thanks for your guide, very useful and interesting, in Freecad which processor should i use to compile in Gcode? thanks Gianluca

    ReplyDelete
    Replies
    1. You should set units to small parts & CNC, then use grbl postprocessor. See this: FreeCAD tools and settings for CNC 3018 Pro.

      Delete
  2. First time I found a picture of that control card with dual Y-connectors which I got from Banggood with my 3018 PRO. I tried some other guides which included Arduino but they failed due to some problem finding java.io. This guide and apps worked like a charm all the way. I haven't run any jobs yet but UGS connects and responds with GRBL1.1 and jog commands work.

    ReplyDelete
  3. could you send me the eeprom.hex file i dont have it available and i think its why my cnc is unrecognized my ugs.

    ReplyDelete
    Replies
    1. GRBL resets EEPROM contents if not valid. You can receive and send commands to CNC in this situation. It is not an EEPROM issue if you cannot connect to CNC. Anyway, here is the dump: https://we.tl/t-kh7GA7uiY6.

      Delete
  4. Cannot read/write to the board. Getting avrdude: stk500_getsync() error. But I can connect to the board from terminal, send commands, work with gcode, but cannot get to the bootloader (
    Tried diff cables.
    Anny suggestions?

    ReplyDelete
    Replies
    1. Maybe your hardware is different. Is the MCU detected in AVRDUDESS when you click Detect button?

      Delete
    2. made stupid mistake. boudrate was set to connection (115200). once I set it on 57600 it worked well )
      but this mistake made me dig very deep, and I'm glad I made it )

      Delete
  5. Thank you! This helped me a lot!

    ReplyDelete

Please read the comments policy before publishing your comment.