What is grblHAL?

In the last 5 years a number of software developers independently recognized that 8-bit GRBL had reached it's limits on the Arduino. They set their sights on porting it to one of a number of the emerging, inexpensive 32-bit machines, especially ARM based microcontrollers. While these ports worked, they threatened to cause fragmentation of the GRBL world. Because GRBL was so finely honed to take efficient advantage of the Arduino's Atmel microcontroller, machine specific code was intermingled with machine independent code and made it difficult to port. Also, any new features added or bugs fixed in one version would have to be retrofitted to other ports. Very quickly there were new features in one port that weren't available in others. There was no master source that all the different 32-bit versions could be built from. Moving to a new microcontroller or even a different variant in the same family required an in-depth understanding of the workings of GRBL.

 

Terje Io, a talented and forward looking Norwegian software developer, saw this and started work on a solution to the problem. He split GRBL into two parts: one that contains all the processor dependent code - a Hardware Abstraction Layer (HAL) and one that does not - the GRBL core. Thus, grblHAL was born. The HAL contains code that initializes the processor, knows about timers, PWM hardware, ports, pin addresses, communications and such. The GRBL core only interacts with the HAL. Moving grblHAL to a new microcontroller takes a few weeks or even days in some cases because the HAL layer is relatively small. In addition, bug fixes or new features to the GRBL core can be added for the benefit of all versions. 

Porting grblHAL to a new microcontroller is straightforward. Basically a single driver file defines the hardware abstraction for the target processor. A developer can start with an existing driver or a template ARM driver. Because most of the code they need to modify is in the driver file, they do not need to understand the GRBL Core.

 

As of August 2020, gbrlHAL has been ported to 13 different microcontrollers:

  • ST Microsystems STF32F1xx (Blue Pill)

  • ST Microsystems STM32F4xx (Black Pill)

  • Espressif Systems ESP32

  • NXP Semiconductors iMRXT1062 (Teensy 4.x)

  • NXP Semiconductors LPC1768/1769

  • Texas Instruments MSP430F5529 (16-bit)

  • Texas Instruments MSP432

  • Texas Instruments MSP432E401Y

  • Texas Instruments TMC123

  • Texas Instruments TMC129x

  • Cypress Semiconductor PSoC5

  • Microchip SAM3X8E (Arduino Due)

  • Microchip SAMD21 (Arduino MKRZERO)

  • Wix Facebook page
  • Twitter Classic
  • Google Classic