Important:
If enabling ftp upload to the SD card then ffconf.h in the ESP SDK has to be edited, #define FF_FS_RPATH
must be changed to 2 or you will get a compiler error.
ffconf.h is located in the subfolder esp-idf\components\fatfs\src in the ESP32 SDK installation. The ESP32 SDK is typically installed in the user folder.
This driver can be built with the Web Builder.
While this manual briefly describes basic build process on Linux OS, you can find more details as well as differences for building on other OS at this webpage:
First you have to prepare esp-idf v4.3:
#Create directory and clone esp-idf into it:
mkdir -p ~/esp
cd ~/esp
git clone -b release/v4.3 --recursive --shallow-submodules https://github.com/espressif/esp-idf.git
#Prepare build environment and toolchain:
cd ~/esp/esp-idf
./install.sh
. ~/esp/esp-idf/export.sh
Then get the grblHAL driver code:
#Create directory and clone the ESP32 grblHAL driver into it:
git clone --recursive https://github.com/grblHAL/ESP32.git
Go into the ESP32/main
directory and modify settings in grbl/config.h
and CMakeLists.txt
as needed.
Pin assignments and board specific config is in *_map.h
files for each individual board.
Run idf.py build
from the ESP32
directory.
This will build the firmware image which can be later flashed into ESP32 device.
Note that idf.py
command is only available in terminal window which was previously configured
using the . ~/esp/esp-idf/export.sh
command.
After build is completed you will be instructed on how to flash firmware into the device.
Typically you can use command similar to this: idf.py -p /dev/ttyUSB0 flash
Once flashing is complete, your CNC controller is ready to be configured and used.
If you're familiar with Docker, you can use it to build grblHAL in a self-contained environment without installing the complete toolchain on your system:
- prepare and configure the codebase as described above
- build with
docker run -it --rm -v $(pwd):/grbl -w /grbl espressif/idf:release-v4.3 idf.py build
- flash with
docker run -it --rm -v $(pwd):/grbl --privileged -v /dev:/dev -w /grbl/drivers/ESP32 espressif/idf:release-v4.3 idf.py -p /dev/ttyUSB0 flash
The file containing my_plugin_init()
has to be added to CMakeLists.txt in the SRCS list
and grbl/my_plugin.c has to be removed from it to be linked correctly.
NOTE: grbl/config.h or CMakeLists.txt may need modification before compilation. If needed an #error
(with instructions) will be generated when compiling.
NOTE: Configuration has been simplified a bit, primarily change options in CMakeLists.txt
to enable/disable.
Configuration of options in my_machine.h is turned off in CMakeLists.txt by default due to this.
index.htm.gz is Copyright (c) 2019 Luc Lebosse - from his ESP3D-WEBUI, I may have pulled a few lines from his backend code too.
dns_server.c is Copyright (c) 2019 Tony Pottier - from his ESP32 WiFi Manager
Snippets of code is extracted from Espressif ESP-IDF examples which are public domain.
2023-09-20