Skip to content

Commit

Permalink
Bdring 6x (#103)
Browse files Browse the repository at this point in the history
* Add map for Bdring 6x v1

* with platformio

* correct filename in driver.h maps

* working version on the 6x

* Set up for 6Pack_Ext_V2

* final branch commit
  • Loading branch information
kevindt authored Mar 18, 2024
1 parent fa7b919 commit 0331dc8
Show file tree
Hide file tree
Showing 8 changed files with 1,531 additions and 23 deletions.
10 changes: 10 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
],
"unwantedRecommendations": [
"ms-vscode.cpptools-extension-pack"
]
}
41 changes: 36 additions & 5 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,44 @@
// AUTOMATICALLY GENERATED FILE. PLEASE DO NOT MODIFY IT MANUALLY
//
// PlatformIO Debugging Solution
//
// Documentation: https://docs.platformio.org/en/latest/plus/debugging.html
// Configuration: https://docs.platformio.org/en/latest/projectconf/sections/env/options/debug/index.html

{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "espidf",
"name": "Launch",
"type": "platformio-debug",
"request": "launch",
"name": "PIO Debug",
"executable": "/home/kevin/ESP32/.pio/build/esp32doit-devkit-v1/firmware.elf",
"projectEnvName": "esp32doit-devkit-v1",
"toolchainBinDir": "/home/kevin/.platformio/packages/[email protected]+2021r2-patch2/bin",
"internalConsoleOptions": "openOnSessionStart",
"preLaunchTask": {
"type": "PlatformIO",
"task": "Pre-Debug"
}
},
{
"type": "platformio-debug",
"request": "launch",
"name": "PIO Debug (skip Pre-Debug)",
"executable": "/home/kevin/ESP32/.pio/build/esp32doit-devkit-v1/firmware.elf",
"projectEnvName": "esp32doit-devkit-v1",
"toolchainBinDir": "/home/kevin/.platformio/packages/[email protected]+2021r2-patch2/bin",
"internalConsoleOptions": "openOnSessionStart"
},
{
"type": "platformio-debug",
"request": "launch",
"name": "PIO Debug (without uploading)",
"executable": "/home/kevin/ESP32/.pio/build/esp32doit-devkit-v1/firmware.elf",
"projectEnvName": "esp32doit-devkit-v1",
"toolchainBinDir": "/home/kevin/.platformio/packages/[email protected]+2021r2-patch2/bin",
"internalConsoleOptions": "openOnSessionStart",
"loadMode": "manual"
}
]
}
12 changes: 3 additions & 9 deletions main/boards/bdring_i2s_6pack_ext_v2_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,17 @@
#define X_STEP_PIN I2SO(2)
#define X_DIRECTION_PIN I2SO(1)
#define X_ENABLE_PIN I2SO(0)
#define X_LIMIT_PIN GPIO_NUM_39
#define X_LIMIT_PIN GPIO_NUM_33

#define Y_STEP_PIN I2SO(5)
#define Y_DIRECTION_PIN I2SO(4)
#define Y_ENABLE_PIN I2SO(7)
#define Y_LIMIT_PIN GPIO_NUM_36
#define Y_LIMIT_PIN GPIO_NUM_32

#define Z_STEP_PIN I2SO(10)
#define Z_DIRECTION_PIN I2SO(9)
#define Z_ENABLE_PIN I2SO(8)
#define Z_LIMIT_PIN GPIO_NUM_33
#define Z_LIMIT_PIN GPIO_NUM_35

// Define ganged axis or A axis step pulse and step direction output pins.
#if N_ABC_MOTORS >= 1
Expand Down Expand Up @@ -92,20 +92,14 @@

#if DRIVER_SPINDLE_PWM_ENABLE
#define SPINDLE_PWM_PIN GPIO_NUM_26
#else
#define AUXOUTPUT0_PIN GPIO_NUM_26
#endif

#if DRIVER_SPINDLE_DIR_ENABLE
#define SPINDLE_DIRECTION_PIN GPIO_NUM_16
#else
#define AUXOUTPUT1_PIN GPIO_NUM_16
#endif

#if DRIVER_SPINDLE_ENABLE
#define SPINDLE_ENABLE_PIN GPIO_NUM_4
#else
#define AUXOUTPUT2_PIN GPIO_NUM_4
#endif

// Define flood and mist coolant enable output pins.
Expand Down
133 changes: 133 additions & 0 deletions main/boards/bdring_i2s_6x_v1_map.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
/*
bdring_i2s_6x_v1_map.h - An embedded CNC Controller with rs274/ngc (g-code) support
Driver code for ESP32
Part of grblHAL
Copyright (c) 2020-2024 Terje Io
Grbl is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl. If not, see <http://www.gnu.org/licenses/>.
*/

#define BOARD_NAME "BDRING 6x External Drives V1.1"

#define USE_I2S_OUT
#define I2S_OUT_PIN_BASE 64

// timer definitions
#define STEP_TIMER_GROUP TIMER_GROUP_0
#define STEP_TIMER_INDEX TIMER_0

#if SDCARD_ENABLE
// Pin mapping when using SPI mode.
// With this mapping, SD card can be used both in SPI and 1-line SD mode.
// Note that a pull-up on CS line is required in SD mode.
#define PIN_NUM_MISO 19
#define PIN_NUM_MOSI 23
#define PIN_NUM_CLK 18
#define PIN_NUM_CS 5
#endif // SDCARD_ENABLE

#define I2S_OUT_BCK GPIO_NUM_22
#define I2S_OUT_WS GPIO_NUM_17
#define I2S_OUT_DATA GPIO_NUM_21

#define X_STEP_PIN I2SO(2)
#define X_DIRECTION_PIN I2SO(1)
#define X_ENABLE_PIN I2SO(0)
#define X_LIMIT_PIN GPIO_NUM_39

#define Y_STEP_PIN I2SO(5)
#define Y_DIRECTION_PIN I2SO(4)
#define Y_ENABLE_PIN I2SO(7)
#define Y_LIMIT_PIN GPIO_NUM_36

#define Z_STEP_PIN I2SO(10)
#define Z_DIRECTION_PIN I2SO(9)
#define Z_ENABLE_PIN I2SO(8)
#define Z_LIMIT_PIN GPIO_NUM_33

// Define ganged axis or A axis step pulse and step direction output pins.
#if N_ABC_MOTORS >= 1
#define M3_AVAILABLE
#define M3_STEP_PIN I2SO(13)
#define M3_DIRECTION_PIN I2SO(12)
#define M3_ENABLE_PIN I2SO(15)
#define M3_LIMIT_PIN GPIO_NUM_32
#endif

// Define ganged axis or B axis step pulse and step direction output pins.
#if N_ABC_MOTORS >= 2
#define M4_AVAILABLE
#define M4_STEP_PIN I2SO(18)
#define M4_DIRECTION_PIN I2SO(17)
#define M4_ENABLE_PIN I2SO(16)
#define M4_LIMIT_PIN GPIO_NUM_35
#endif

// Define ganged axis or B axis step pulse and step direction output pins.
#if N_ABC_MOTORS == 3
#define M5_AVAILABLE
#define M5_STEP_PIN I2SO(21)
#define M5_DIRECTION_PIN I2SO(20)
#define M5_ENABLE_PIN I2SO(23)
#define M5_LIMIT_PIN GPIO_NUM_34
#endif

// Define driver spindle pins

#if DRIVER_SPINDLE_PWM_ENABLE
#define SPINDLE_PWM_PIN GPIO_NUM_13
#else
#define AUXOUTPUT0_PIN GPIO_NUM_13
#endif

#if DRIVER_SPINDLE_ENABLE
#define SPINDLE_ENABLE_PIN GPIO_NUM_15
#endif

// Define MODBUS spindle pins (exclusive use - can use PWM or modbus since they share output pins)

#if MODBUS_ENABLE & MODBUS_RTU_ENABLED
#define UART2_RX_PIN GPIO_NUM_16
#define UART2_TX_PIN GPIO_NUM_15
#if MODBUS_ENABLE & MODBUS_RTU_DIR_ENABLED
#define MODBUS_DIRECTION_PIN GPIO_NUM_14
#endif
#endif

// If neither PWM nor modbus, gpio14 is aux output

#if !MODBUS_ENABLE & !DRIVER_SPINDLE_PWM_ENABLE
#define AUXOUTPUT1_PIN GPIO_NUM_14
#endif

// Define probe switch input pin.
#if PROBE_ENABLE
#define PROBE_PIN GPIO_NUM_2
#endif

#if KEYPAD_ENABLE
#error No free pins for keypad!
#endif


// Define flood and mist coolant enable output pins.

//#define COOLANT_MIST_PIN ?

// Define user-control CONTROLs (cycle start, reset, feed hold) input pins.

// N/A
5 changes: 5 additions & 0 deletions main/driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
#ifndef GRBLHAL_TASK_PRIORITY
#define GRBLHAL_TASK_PRIORITY 5
#endif

#ifndef GRBLHAL_TASK_CORE
#define GRBLHAL_TASK_CORE 1
#endif
Expand Down Expand Up @@ -125,6 +126,10 @@ typedef struct {
#include "boards/bdring_v3.5_map.h"
#elif defined(BOARD_BDRING_I2S6A)
#include "boards/bdring_i2s_6_axis_map.h"
#elif defined(BOARD_BDRING_6X)
#include "boards/bdring_i2s_6x_v1_map.h"
#elif defined(BOARD_BDRING_I2S_6PACK_EXT_V2)
#include "boards/bdring_i2s_6pack_ext_v2_map.h"
#elif defined(BOARD_ESPDUINO32)
#include "boards/espduino-32_wemos_d1_r32_uno_map.h"
#elif defined(BOARD_SOURCERABBIT_4AXIS) || defined(BOARD_SOURCERABBIT_4AXIS_12)
Expand Down
19 changes: 10 additions & 9 deletions main/my_machine.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/*
my_machine.h - configuration for ESP32 processors
Part of grblHAL
Copyright (c) 2020-2024 Terje Io
Expand All @@ -24,6 +22,8 @@
//#define BOARD_BDRING_V3P5 //
//#define BOARD_BDRING_V4 //
//#define BOARD_BDRING_I2S6A //
//#define BOARD_BDRING_6X //
#define BOARD_BDRING_I2S_6PACK_EXT_V2 //
//#define BOARD_ESPDUINO32 //
//#define BOARD_SOURCERABBIT_4AXIS //
//#define BOARD_PROTONEER_3XX //
Expand All @@ -42,9 +42,10 @@
// Configuration
// Uncomment to enable, for some a value > 1 may be assigned, if so the default value is shown.

#if CONFIG_IDF_TARGET_ESP32S3
#define USB_SERIAL_CDC 1 // Serial communication via native USB.
#endif
// #if CONFIG_IDF_TARGET_ESP32S3
// #define USB_SERIAL_CDC 1 // Serial communication via native USB.
// #endif

// Spindle selection:
// Up to four specific spindle drivers can be instantiated at a time
// depending on N_SPINDLE and N_SYS_SPINDLE definitions in grbl/config.h.
Expand Down Expand Up @@ -101,7 +102,7 @@
// of axes can be enabled here.
//#define X_GANGED 1
//#define X_AUTO_SQUARE 1
//#define Y_GANGED 1
#define Y_GANGED 1
//#define Y_AUTO_SQUARE 1
//#define Z_GANGED 1
//#define Z_AUTO_SQUARE 1
Expand All @@ -125,12 +126,12 @@
//#define WEBDAV_ENABLE 1 // webdav protocol - requires http daemon and SD card enabled.
#endif
// The following symbols have the default values as shown, uncomment and change as needed.
//#define NETWORK_STA_HOSTNAME "grblHAL"
//#define NETWORK_STA_HOSTNAME "grblHAL_6x"
//#define NETWORK_STA_IPMODE 1 // 0 = static, 1 = DHCP, 2 = AutoIP
//#define NETWORK_STA_IP "192.168.5.1"
//#define NETWORK_STA_GATEWAY "192.168.5.1"
//#define NETWORK_STA_MASK "255.255.255.0"
#if WIFI_SOFTAP > 0
#if WIFI_SOFTAP
//#define NETWORK_AP_SSID "grblHAL_AP"
//#define NETWORK_AP_PASSWORD "grblHALap"
//#define NETWORK_AP_HOSTNAME "grblHAL_AP"
Expand All @@ -146,5 +147,5 @@
//#define NETWORK_WEBSOCKET_PORT 81
#else
//#define NETWORK_WEBSOCKET_PORT 80
#endif
#endif // HTTP_ENABLE
#endif // WIFI_ENABLE
37 changes: 37 additions & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#
# Building for BDring new 6x board
#

[platformio]
src_dir = main
include_dir = main

[wifi_networking]
build_flags =

[env:esp32doit-devkit-v1]
platform = espressif32 @ ~4.0.0
framework = espidf
board = esp32doit-devkit-v1
board_build.partitions = partitions.csv

board_build.embed_files =
main/embedded/favicon.ico
main/embedded/ap_login.html
main/embedded/index.html.gz

build_flags =
-Wimplicit-fallthrough=1
-Wno-missing-field-initializers
-Wno-maybe-uninitialized
-Wno-stringop-truncation
-DCONFIG_IDF_TARGET_ESP32=1
; -DY_AUTO_SQUARE=1
; -DDRIVER_SPINDLE_PWM_ENABLE=1
; -DSDCARD_ENABLE=2
-DPROBE_ENABLE=1
-DPROBE_PIN=GPIO_NUM_2

monitor_speed=115200

lib_compat_mode = off
Loading

0 comments on commit 0331dc8

Please sign in to comment.