Git Product home page Git Product logo

grbl_port_opencm3's Introduction

GRBL port using opencm3 libraries Build Status

Scope

The first idea of this project was to port the GRBL code to a Cortex-M processor, using the Nucleo F401RE board, that is a cheap microcontroller (~10/15 $), but is also quite performing (84MHz 32-bit Cortex-M4 CPU and many other features).
In order to achieve this scope, I chose to use libopencm3 as a base library, concentrating the effort on the development/porting of the application while having a light driver access substrate.
I used the GRBL version 0.9 as a code base since it is a stable and vastily used version of GRBL, and then solved some issues to reproduce the same functionality on this microcontroller.

Since the libopencm3 are structured to support many microcontrollers, this porting may be achieved with some effort on other popular microcontrollers.

NEWS: Added also support for Nucleo F103RB and F303K8. I have tested many functionalities on a COREXY machine using F401RE and some functionalities with F303K8.

License

Being a work derived from the GNU GPLv3 licensed GRBL project, this project uses the same license.
The authors and owners of every file are mentioned in the header of the file itself.
Please refer to GRBL repository for more information about the authors and owners of GRBL project.
Please refer to libopencm3 repository for more information about the authors and owners of libopencm3 project.

How to compile?

This repository has a structure similar to the libopencm3 examples repository, it uses a makefile in the main directory.

You should install a gcc arm toolchain and make sure it's used to compile by setting the correct PATH to it.
Since the makefiles use GNU compiler tools and linux commands (e.g. "ls"), in order to compile on Windows environment something as MinGW or Cygwin should be used.
As an example, if you are a Windows user, you may download and install:

  1. msys (click here) or equivalent.
  2. Python 2.7 (click here)
  3. arm-none-eabi/arm-elf toolchain (for example this one here)

Set the path for the tools and the toolchain, for example:
set PATH=C:\msys\1.0\bin;C:\Python27;C:\path-to-gcc-arm-none-eabi\bin;

If you are compiling under unix environment you need your PATH to point to the gcc arm toolchain Python 2.7, and you should be ready to compile.

Then, to be able to build the application:

  • get the repository in a folder, by cloning it or downloading it from GitHub;
  • change directory to the main project folder
  • get the library opencm3 in "libopencm3" sub-folder using "git submodule init".
  • run "make bin" to compile the project and generate the binaries.

Just the "make" command is sufficient to trigger the build. The build process will start by building the lib opencm3, and then it will build the grbl applications for every microcontroller target present in the repository.
The grbl application artifacts created by the build process will be stored in a sub-directory "build_dir" in the path of chosen microcontroller board. As an example, for Nucleo F401 the build_dir will be "/grbl_port/stm32/f4/nucleo-f401re/build_dir".

The most important make targets that may be used are:

  • "make", to build lib opencm3 and grbl applications in sequence.
  • "make all" or "make build", that are equivalent to "make" by itself.
  • "make bin", to build everything as "make" and generate the binaries file from ELF files of grbl.
  • "make lib", to build only the lib opencm3.
  • "make grbl", to build only the grbl applications and generate binaries. If the lib opencm3 was not built before, this will generate build errors.
  • "make clean", to clean every build artifact both from library and grbl applications.
  • "make clean_grbl", to clean every build artifact of grbl applications only.

Moreover, to make the build verbose it is possible to use "V=1" after every command specified above.

How to install?

At the moment only Nucleo boards are present in the repository, so the installation methods for this boards is detailed here, when there will be other kinds of boards, this section shall be modified.

For Nucleo boards and similar, if you have the ST drivers installed, the board should be seen as a mass storage device.
In this case, copy the binary obtained from the building process into the mass storage and the on-board firmware should take care of the rest.
Take care, likely with this procedure only the sector used by the application will be erased. So if you have anything already written in the sectors used by the grbl parameters, the application behaviour is not guaranteed. Likely, it will find that parameters are corrupted and restore them to default values.

As an alternative method to install your application, if you are using a Windows OS, the application ST-LINK may be used to download the compiled software in flash. In this case, the ELF file may be used.

grbl_port_opencm3's People

Contributors

adichell avatar christianrinn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

grbl_port_opencm3's Issues

Stuttering movement with corexy running bcnc autobed level code

Describe the bug
I am using a drill file from flatcam. When I run it on the nucleo 401 (using the ant pcb firmware) it runs fine. However if I do an auto bed level and then run it I will get stutter on fast travel moves. I will attach the offending snippit of gcode as well as my configured parameters

The stuttering occurs with or without belts connected to the steppers. I have tried lowering the max rate for Y and X and it does not stop the stuttering. To me it seems like the timing for the stepping pulses is somehow going out of sync.

https://www.youtube.com/watch?v=tLgvMT3h3JA

Additional context
Add any other context about the problem here (e.g. tool used, configuration used, microcontroller, etc.).
$0=10 (step pulse, usec)
$1=255 (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=1 (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=1 (hard limits, bool)
$22=1 (homing cycle, bool)
$23=0 (homing dir invert mask:00000000)
$24=100.000 (homing feed, mm/min)
$25=1000.000 (homing seek, mm/min)
$26=250 (homing debounce, msec)
$27=1.000 (homing pull-off, mm)
$28=20000 (Spindle pwm period, us)
$29=1860 (Spindle pwm Max time-on, us)
$30=700 (Spindle pwm min time-on, us)
$31=1 (Spindle pwm Enabled at startup)
$100=170.000 (x, step/mm)
$101=170.000 (y, step/mm)
$102=100.000 (z, step/mm)
$110=8000.000 (x max rate, mm/min)
$111=8000.000 (y max rate, mm/min)
$112=500.000 (z max rate, mm/min)
$120=500.000 (x accel, mm/sec^2)
$121=500.000 (y accel, mm/sec^2)
$122=100.000 (z accel, mm/sec^2)
$130=160.000 (x max travel, mm)
$131=270.000 (y max travel, mm)
$132=200.000 (z max travel, mm)

(Block-name: Header)
(Block-expand: 0)
(Block-enable: 1)
(G-CODE GENERATED BY FLATCAM v8.913 - www.flatcam.org - Version Date: 2019/04/13)

(Name: drills.xln_cnc)
(Type: G-code from Excellon)
(Units: IN)

(Created on Saturday, 20 April 2019 at 15:56)

(Feedrate: 3.0 in/min)
(Feedrate rapids 3.0 in/min)

(Z_Cut: -0.08 in)
(Z_Move: 0.1 in)
(Z Toolchange: 1.0 in)
(X,Y Toolchange: 0.0000, 0.0000 in)
(Z Start: None in)
(Z End: 2.0 in)
(Steps per circle: 64)
(Postprocessor Excellon: default)

(X range: 0.0929 ... 3.3071 in)
(Y range: 0.0949 ... 3.1485 in)

(Spindle Speed: None RPM)

G20
G90
G94

G01 F3.00
(Block-name: block [autolevel])
(Block-expand: 0)
(Block-enable: 1)
G0X0Y0Z0.0989

M03
G0X0.0589Y0.15Z0.0996
G0X0.15Y0.3818Z0.1007
G0X0.2537Y0.6458Z0.1021
G0X0.4485Y1.1417Z0.1038
G0X0.6433Y1.6375Z0.103
G0X0.6667Y1.697Z0.1029
G0X0.8381Y2.1333Z0.1021
G0X1.0329Y2.6292Z0.1028
G0X1.1Y2.8Z0.1031
G1X1.1Y2.8Z-0.0769
G1X1.1Y2.8Z0.0031
G0X1.1Y2.8Z0.1031

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.