terjeio / GRBL_MPG_DRO_BoosterPack

Tiva C BoosterPack for GRBL MPG/DRO
46 stars 21 forks source link
boosterpack dro grbl grbl-mpg mpg

GRBL MPG & DRO BoosterPack for Tiva C (TM4C123G) and RP2040 (Pi Pico)

2024-01-29: Added firmware and flasher code for the MSP430 keypad controller to the RP2040 version. This will check for and install/update the firmware automatically.
Splitted LCD driver code in separate files for each display type supported.

2022-01-13: Added wiring diagram for default key and LED map.

Default wiring diagram (pdf).

The latest keypad code allows adding new keymappings at run time, switching between a few predefined ones or creating a new from scratch.

2022-01-10: First preliminary version with Pi Pico support committed. Tiva C (TM4C123) version updated for new HAL/APIs.

2021-08-30: Pi Pico breakout board design

First batch of boards (for final design verification) to be ordered soon.

2021-05-01: HALification of the code is underway

A RP2040 driver for Pi Pico is nearing completion, watch this space.

2019-08-20: Improved startup sequence

The GPIO line used for signalling MPG mode change is now used to signal the grbl controller ready state during startup.

On a cold start the Grbl microcontroller should pull the line low as early in the process as possible. When the cold start sequence is completed and grbl is ready to receive data the line should be reverted to input mode with interrupt and pullup enabled. The MPG microcontroller will wait for the line going high before starting any communication, displaying a progress indicator in its boot screen while waiting.


Features:

Parts of alpha-version of supporting code is now available. An initial commit of the display driver used has now been made public. The code is written so it is should be easy to port, all processor dependent code is in separate files.

All core funtionality is now up and running, GUI is 100% event driven making it easy to extend with new dialogs. Shared dialogs (canvases) created for common data (such as DOC, feed rate, RPM), input review/confirmation and GCode transfer to grbl.

How it works

The setup comprises 3 microcontrollers: one running Grbl, one handling the keyboard scanning and one (the MPG processor) for the DRO and MPG (user interface).

Grbl/grblHAL microcontroller:

Support for a second input stream and a switch for changing to/from MPG mode has to be added to the code. In \"normal\" mode the MPG processor listen to the output stream from Grbl, parses the data and displays relevant info on the display. In \"MPG\" mode Grbl switches its serial input to the second input stream and the MPG prosessor takes over control by acting as a GCode sender. To tell the MPG processor about a mode change the real time report from Grbl is extended with |MPG:0 (\"normal\") and |MPG:1 (\"MPG\"), this is only added when the mode change takes place. Some of my grblHAL drivers supports this functionality as does my patched version of grbl-Mega.

MPG microcontroller:

This handles the user interface (keypresses, MPG input, menu navigator input and DRO display). In \"normal\" mode it passively listen to the output stream coming from Grbl, parses it and updates the display and LED statuses accordingly. For this to work correctly there has to be a PC based GCode sender connected to the controller, such as ioSender, that constantly request the real time status report.

In \"MPG\" mode it takes over control and acts as a GCode sender itself, ideally the PC based GCode sender should then disable its GUI. When turning the MPG wheels G1 commands are issued with a feed rate that is dependent on the turning speed, simulating the action of the handwheels on the lathe. The jog buttons issues jog commands and most of the other buttons issues real-time commands such as Hold or Cycle start. It is also possible to hardwire some of the button states to the corresponding Grbl input signals.

For the lathe version I am currently working on I am adding canvases (or dialogs) that will be used for some simple tasks such as reducing the diameter of the stock, and possibly threading if the Grbl version supports that. There is a common canvas for streaming task data, this may be used to stream data from a SD card (not yet implemented).

Keyboard handling microcontroller:

Due to limited IO on the MPG microcontroller a separate processor is employed for handling the keyboard and LEDs. Up to 25 keys can be added (in a matrix) and 8 LEDs are supported. Keypresses are sent to the MPG controller via I2C, and there is a strobe signal for telling MPG controller that a key is pressed. The strobe signal suppports different key modes such as single shot, autorepeat and continuous - configurable per key.


Testbench setup

Pi Pico breakout board

Pico PCB top

Pico PCB bottom


2021-08-30