How dungjk/grbl-stm32 works
This repository is STM32F10x firmware for a Grbl CNC motion controller, with USB virtual-COM support and a serial fallback. The user-facing workflow is to submit G-code or control commands, parse and plan motion, then generate timed stepper outputs while controlling spindle, coolant, probing, and limits. The README also documents jogging, overrides, laser operation, sleep, and safety-door parking. The excerpts show initialization and selected USB/peripheral behavior; links between most runtime stages are therefore marked unverified rather than inferred from module names.
Main entry points: main.c Grbl startup · planner.c Motion planner · system.c System and overrides · gcode.c G-code parser
Components 20
Command Interface
- USB virtual COM
usb/usb_prop.c - USB device stack
stm_usb_fs_lib/src/usb_core.c - Serial transport
grbl/serial.c - Command protocol
grbl/protocol.c
G-code and Motion
- G-code parser
grbl/gcode.c - Jogging
grbl/jog.c - Motion planner
grbl/planner.c - Motion control
grbl/motion_control.c - Stepper execution
grbl/stepper.c
Machine Control
- System and overrides
grbl/system.c - Limits and homing
grbl/limits.c - Probing
grbl/probe.c - Spindle control
grbl/spindle_control.c - Coolant control
grbl/coolant_control.c - Settings and EEPROM
grbl/settings.c
STM32 Platform
- STM32 peripheral drivers
SPL/src/stm32f10x_tim.c - USB interrupt handling
usb/usb_istr.c - Flash-backed EEPROM
util/stm32eeprom.h - Grbl startup
grbl/main.c
Other components
- CNC sender
Connections 26
- CNC sender → USB virtual COM: sends commands
- CNC sender → Serial transport: sends commands
- USB virtual COM → USB device stack: uses device stack
- USB device stack → USB interrupt handling: dispatches interrupts
usb/usb_istr.c - Serial transport → Command protocol: provides input
- Command protocol → G-code parser: dispatches commands
- G-code parser → Motion control: requests motion
- G-code parser → Motion planner: submits motion
- Jogging → Motion planner: plans jogs
- Motion planner → Stepper execution: provides motion blocks
- Motion control → Motion planner: plans moves
- Stepper execution → STM32 peripheral drivers: uses timer drivers
grbl/stepper.c - Grbl startup → Serial transport: resets buffer
grbl/main.c - Grbl startup → G-code parser: initializes parser
grbl/main.c - Grbl startup → Motion planner: resets planner
grbl/main.c - Grbl startup → Stepper execution: resets stepper
grbl/main.c - Grbl startup → Spindle control: initializes spindle
grbl/main.c - Grbl startup → Coolant control: initializes coolant
grbl/main.c - Grbl startup → Limits and homing: initializes limits
grbl/main.c - Grbl startup → Probing: initializes probe
grbl/main.c - Settings and EEPROM → Flash-backed EEPROM: stores settings
- System and overrides → Stepper execution: controls runtime motion
- System and overrides → Spindle control: applies overrides
- System and overrides → Coolant control: applies overrides
- Limits and homing → System and overrides: signals limit events
- Probing → Motion control: supports probe moves