Skip to content

MKS Robin Nano and MPG #258

@bullestock

Description

@bullestock

Hi,

I am trying to enable MPG on the MKS Robin Nano V3.0, using a GPIO pin for mode switching.

I am using PlatformIO with this platform.ini (adapted from one downloaded from the WebBuilder):

# Template for Web Builder, STM32F4xx
#

[platformio]
include_dir = Inc
src_dir = Src

[common]
build_flags =
  -I .
  -I boards
  -I FatFs
  -I FatFs/STM
  -I Drivers/FATFS/Target
  -I Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc
  -I Middlewares/ST/STM32_USB_Device_Library/Core/Inc
  -I USB_DEVICE/App
  -I USB_DEVICE/Target
  -D _USE_IOCTL=1
  -D _USE_WRITE=1
  -D _VOLUMES=1
  -Wl,-u,_printf_float
  -Wl,-u,_scanf_float
lib_deps =
  boards
  bluetooth
  grbl
  keypad
  laser
  motors
  trinamic
  odometer
  openpnp
  fans
  plugins
  FatFs
  sdcard
  spindle
  embroidery
  Drivers/FATFS/App
  Drivers/FATFS/Target
  # USB serial support
  Middlewares/ST/STM32_USB_Device_Library/Core
  Middlewares/ST/STM32_USB_Device_Library/Class
  USB_DEVICE/App
  USB_DEVICE/Target
lib_extra_dirs =
  .
  boards
  FatFs
  Middlewares/ST/STM32_USB_Device_Library
  USB_DEVICE

[eth_networking]
build_flags =
  -I LWIP/App
  -I LWIP/dp83848/Target
  -I Middlewares/Third_Party/LwIP/src/include
  -I Middlewares/Third_Party/LwIP/system
  -I Middlewares/Third_Party/LwIP/src/include/netif
  -I Middlewares/Third_Party/LwIP/src/include/lwip
  -I Drivers/BSP/Components/dp83848
lib_deps =
   networking
   webui
   LWIP/App
   LWIP/dp83848/Target
   Middlewares/Third_Party/LwIP
   Drivers/BSP/Components/dp83848
lib_extra_dirs =

[wiznet_networking]
build_flags =
  -I networking/wiznet
  -I Middlewares/Third_Party/LwIP/src/include
  -I Middlewares/Third_Party/LwIP/system
  -I Middlewares/Third_Party/LwIP/src/include/netif
  -I Middlewares/Third_Party/LwIP/src/include/lwip
lib_deps =
   networking
   webui
   Middlewares/Third_Party/LwIP
lib_extra_dirs =

[env]
platform = ststm32
platform_packages = framework-stm32cubef4
framework = stm32cube
# Do not produce .a files for lib deps (which would prevent them from overriding weak symbols)
lib_archive = no
lib_ldf_mode = off
extra_scripts = post:extra_script.py

[env:mks_robin_nano_30]
board = genericSTM32F407VGT6
board_build.ldscript = STM32F407VGTX_BL48K_FLASH.ld
build_flags = ${common.build_flags}
  -D BOARD_MKS_ROBIN_NANO_30
  -D USE_HAL_DRIVER
  -D STM32F407xx
  -D HSE_VALUE=8000000
  -D HAS_BOOTLOADER
  -D USB_SERIAL_CDC=1
  -D PROBE_ENABLE=1
  -D EEPROM_ENABLE=32
  -D CONTROL_ENABLE=70
  -D SPINDLE0_ENABLE=11
  -D N_SPINDLE=1

lib_deps = ${common.lib_deps}
  eeprom

lib_extra_dirs = ${common.lib_extra_dirs}

and in my_machine.h I have added

#define MPG_ENABLE 1

#if MPG_ENABLE == 1
#define MPG_MODE_PORT           GPIOC
#define MPG_MODE_PIN            5
#undef MPG_STREAM
#define MPG_STREAM 3
#endif

I am unsure if my definition of MPG_STREAM is correct - I want to use UART3 (PB10/11). But it seems as if something is missing:

  1. PC5 does not get pulled high by grblHAL.
  2. Even if I pull PC5 low or high, the ? status does not include MPG:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions