- LinuxCNC
- General LinuxCNC Questions
- rs274ngc as a standalone interpreter — driving grblHAL over UART, no HAL, no RT
rs274ngc as a standalone interpreter — driving grblHAL over UART, no HAL, no RT
- Okojo
- Offline
- New Member
-
Less
More
- Posts: 1
- Thank you received: 0
17 May 2026 14:28 #346459
by Okojo
rs274ngc as a standalone interpreter — driving grblHAL over UART, no HAL, no RT was created by Okojo
I wanted to share an approach that may interest anyone running CNC on a Linux SBC without a Mesa card or a real-time kernel.
### The setup
Hardware: Arduino UNO Q — a single board that combines a Qualcomm QRB2210 (Debian 13 Linux) with an STM32U585 MCU connected via an internal UART (`ttyHS1`). The STM32 runs grblHAL and handles all real-time step generation. The QRB2210 handles G-code interpretation.
### The key insight
`linuxcnc-uspace` ships a Python API for `rs274ngc` that works perfectly outside of a running LinuxCNC instance:
```python
import gcode
from rs274.interpret import Translated, StatMixin
result, seq = gcode.parse(filename, canon, "G21", "")
```
This gives you the full rs274ngc interpreter — canned cycles (G81, G83…), O-word subroutines, G92/G5x coordinate systems, polar coordinates, error checking — with zero HAL setup and no real-time kernel requirement.
The `canon` object intercepts the resulting primitive motion calls (`straight_feed`, `arc_feed`, `spindle_on`…) and translates them to grblHAL commands streamed over serial with `ok`-based flow control.
### What rs274ngc handles automatically
- Canned cycles expanded to primitive G0/G1 moves
- Incremental → absolute coordinate conversion
- G5x / G92 work coordinate offsets
- Polar coordinates
- O-word loops and subroutines
- Unit conversion (G20/G21)
### Architecture
```
G-code file
↓ gcode.parse() — rs274ngc Python API
canon calls (straight_feed, arc_feed …)
↓ Python bridge
G0 / G1 / G2 / G3 over /dev/ttyHS1
↓
grblHAL on STM32U585 — real-time step generation
↓
Stepper drivers / CNC shield
```
Note: rs274ngc canon calls are always in inches (internal unit). All coordinates are multiplied by 25.4 before sending to grblHAL in mm mode.
### Repos
- Bridge (Python, runs on QRB2210): github.com/hoshigarasu/canon-grbl-bridge
- grblHAL firmware (STM32U585 port): github.com/hoshigarasu/grblHAL-STM32U585
Demo video: XY pen plotter drawing a 50mm circle, G-code interpreted by rs274ngc on the QRB2210, executed by grblHAL on the STM32U585. [photos.app.goo.gl/vnDY3CgpnHprdv5dA]
Happy to answer questions about the rs274ngc Python API or the canon interface.
### The setup
Hardware: Arduino UNO Q — a single board that combines a Qualcomm QRB2210 (Debian 13 Linux) with an STM32U585 MCU connected via an internal UART (`ttyHS1`). The STM32 runs grblHAL and handles all real-time step generation. The QRB2210 handles G-code interpretation.
### The key insight
`linuxcnc-uspace` ships a Python API for `rs274ngc` that works perfectly outside of a running LinuxCNC instance:
```python
import gcode
from rs274.interpret import Translated, StatMixin
result, seq = gcode.parse(filename, canon, "G21", "")
```
This gives you the full rs274ngc interpreter — canned cycles (G81, G83…), O-word subroutines, G92/G5x coordinate systems, polar coordinates, error checking — with zero HAL setup and no real-time kernel requirement.
The `canon` object intercepts the resulting primitive motion calls (`straight_feed`, `arc_feed`, `spindle_on`…) and translates them to grblHAL commands streamed over serial with `ok`-based flow control.
### What rs274ngc handles automatically
- Canned cycles expanded to primitive G0/G1 moves
- Incremental → absolute coordinate conversion
- G5x / G92 work coordinate offsets
- Polar coordinates
- O-word loops and subroutines
- Unit conversion (G20/G21)
### Architecture
```
G-code file
↓ gcode.parse() — rs274ngc Python API
canon calls (straight_feed, arc_feed …)
↓ Python bridge
G0 / G1 / G2 / G3 over /dev/ttyHS1
↓
grblHAL on STM32U585 — real-time step generation
↓
Stepper drivers / CNC shield
```
Note: rs274ngc canon calls are always in inches (internal unit). All coordinates are multiplied by 25.4 before sending to grblHAL in mm mode.
### Repos
- Bridge (Python, runs on QRB2210): github.com/hoshigarasu/canon-grbl-bridge
- grblHAL firmware (STM32U585 port): github.com/hoshigarasu/grblHAL-STM32U585
Demo video: XY pen plotter drawing a 50mm circle, G-code interpreted by rs274ngc on the QRB2210, executed by grblHAL on the STM32U585. [photos.app.goo.gl/vnDY3CgpnHprdv5dA]
Happy to answer questions about the rs274ngc Python API or the canon interface.
Please Log in or Create an account to join the conversation.
- LinuxCNC
- General LinuxCNC Questions
- rs274ngc as a standalone interpreter — driving grblHAL over UART, no HAL, no RT
Time to create page: 0.115 seconds