Skip to content

Commit c37deda

Browse files
committed
Merge branch 'master' of https://github.com/cprezzi/grbl-LPC
2 parents 7e3d624 + a2186bb commit c37deda

File tree

3 files changed

+82
-4
lines changed

3 files changed

+82
-4
lines changed

README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,16 @@
44
Old releases are in the `Release` tab. See [cprezzi's branch](https://github.com/cprezzi/grbl-LPC) for more recent releases.
55
Note: cprezzi's branch disables current control and has defaults more suitable for other boards.
66
***
7-
This is GRBL 1.1 ported to the LPC1769. It can run on Smoothieboard.
7+
This is GRBL 1.1 ported to the LPC1769.
8+
It can run on the following boards:
9+
- Smoothieboard
10+
- Cohesion3D Remix and Mini
11+
- MKS SBase
12+
- Azteeg X5
813

9-
Usage notes:
14+
SKR boards don't work, because pin mapping is messed!
15+
16+
**Usage notes:**
1017
* This uses a different usb-serial driver than Smoothieware. Windows 10 should recognize it automatically.
1118
If it doesn't, try installing VCOM_lib/usbser.inf.
1219
* This doesn't pass the sdcard to the host. Once installed you need to use a micro sdcard adaptor to replace or change it.
@@ -28,13 +35,13 @@ New configuration settings
2835
* Default to 0.0 A to avoid burning out your motors
2936
* Your motors will likely stall if you don't set these!
3037

31-
Build notes:
38+
**Build notes:**
3239
* You should use virtual machines, if you use multiple toolchains on the same PC.
3340
* Install make if not already there (for Windows see http://gnuwin32.sourceforge.net/packages/make.htm)
3441
* Install the ARM embeded toolchain (see https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads)
3542
* Include ```make``` and the ```arm-none-eabi-*``` tools in your path.
3643
* Run ```git submodule init``` and ```git submodule update``` before building.
37-
* ```make``` produces 2 files:
44+
* Run ```make```, which produces 2 files:
3845
* ```build/firmware.bin```: this is compatible with the sdcard bootloader.
3946
* ```build/grbl.hex```: this is not compatible with the sdcard bootloader. It loads using Flash Magic
4047
and is primarilly for developers who don't want to keep swapping sdcards. If you flash this,

grbl/config.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,18 @@
244244
// not throw an alarm message.
245245
#define CHECK_LIMITS_AT_INIT
246246

247+
// Open Drain configuration
248+
// In order to use stepper drivers with optocoupler input, you may need to use
249+
// open drain configuration. In this configuration, STEP, DIR, and ENABLE each
250+
// expose separate positive and negative pins. The positive pins on the driver
251+
// are tied directly to +5V, and the negative pins are separately routed to the
252+
// STEP, DIR, and ENABLE pins on the controller board, which function as
253+
// low-side switches to ground.
254+
//#define OPEN_DRAIN_X
255+
//#define OPEN_DRAIN_Y
256+
//#define OPEN_DRAIN_Z
257+
//#define OPEN_DRAIN_A
258+
247259
// ---------------------------------------------------------------------------------------
248260
// ADVANCED CONFIGURATION OPTIONS:
249261

grbl/stepper.c

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,65 @@ void st_wake_up()
223223
// Initialize stepper output bits to ensure first ISR call does not step.
224224
st.step_outbits = step_port_invert_mask;
225225

226+
// Set any ports configured as open drain here
227+
// https://sites.google.com/site/johnkneenmicrocontrollers/input_output/io_1768
228+
// https://sites.google.com/site/johnkneenmicrocontrollers/18b-i2c/i2c_lpc1768#linkC1768
229+
#ifdef OPEN_DRAIN_X
230+
LPC_PINCON->PINMODE_OD2 |= 1<<0; // Bit P2.0 is open drain Step
231+
LPC_PINCON->PINMODE4 &= ~(3<<0);
232+
LPC_PINCON->PINMODE4 |= (2<<0); // P2.0 has no pull up/down resistor
233+
234+
LPC_PINCON->PINMODE_OD0 |= 1<<5; // Bit P0.5 is open drain Dir
235+
LPC_PINCON->PINMODE0 &= ~(3<<10);
236+
LPC_PINCON->PINMODE0 |= (2<<10); // P0.5 has no pull up/down resistor
237+
238+
LPC_PINCON->PINMODE_OD0 |= 1<<4; // Bit P0.4 is open drain Enable
239+
LPC_PINCON->PINMODE0 &= ~(3<<8);
240+
LPC_PINCON->PINMODE0 |= (2<<8); // P0.4 has no pull up/down resistor
241+
#endif
242+
243+
#ifdef OPEN_DRAIN_Y
244+
LPC_PINCON->PINMODE_OD2 |= 1<<1; // Bit P2.1 is open drain Step
245+
LPC_PINCON->PINMODE4 &= ~(3<<2);
246+
LPC_PINCON->PINMODE4 |= (2<<2); // P2.1 has no pull up/down resistor
247+
248+
LPC_PINCON->PINMODE_OD0 |= 1<<11; // Bit P0.11 is open drain Dir
249+
LPC_PINCON->PINMODE0 &= ~(3<<22);
250+
LPC_PINCON->PINMODE0 |= (2<<22); // P0.11 has no pull up/down resistor
251+
252+
LPC_PINCON->PINMODE_OD0 |= 1<<10; // Bit P0.10 is open drain Enable
253+
LPC_PINCON->PINMODE0 &= ~(3<<20);
254+
LPC_PINCON->PINMODE0 |= (2<<20); // P0.10 has no pull up/down resistor
255+
#endif
256+
257+
#ifdef OPEN_DRAIN_Z
258+
LPC_PINCON->PINMODE_OD2 |= 1<<2; // Bit P2.2 is open drain Step
259+
LPC_PINCON->PINMODE4 &= ~(3<<4);
260+
LPC_PINCON->PINMODE4 |= (2<<4); // P2.2 has no pull up/down resistor
261+
262+
LPC_PINCON->PINMODE_OD0 |= 1<<20; // Bit P0.20 is open drain Dir
263+
LPC_PINCON->PINMODE1 &= ~(3<<8);
264+
LPC_PINCON->PINMODE1 |= (2<<8); // P0.20 has no pull up/down resistor
265+
266+
LPC_PINCON->PINMODE_OD0 |= 1<<19; // Bit P0.19 is open drain Enable
267+
LPC_PINCON->PINMODE1 &= ~(3<<6);
268+
LPC_PINCON->PINMODE1 |= (2<<6); // P0.19 has no pull up/down resistor
269+
#endif
270+
271+
#ifdef OPEN_DRAIN_A
272+
LPC_PINCON->PINMODE_OD2 |= 1<<3; // Bit P2.3 is open drain Step
273+
LPC_PINCON->PINMODE4 &= ~(3<<6);
274+
LPC_PINCON->PINMODE4 |= (2<<6); // P2.2 has no pull up/down resistor
275+
276+
LPC_PINCON->PINMODE_OD0 |= 1<<22; // Bit P0.22 is open drain Dir
277+
LPC_PINCON->PINMODE1 &= ~(3<<12);
278+
LPC_PINCON->PINMODE1 |= (2<<12); // P0.22 has no pull up/down resistor
279+
280+
LPC_PINCON->PINMODE_OD0 |= 1<<21; // Bit P0.21 is open drain Enable
281+
LPC_PINCON->PINMODE1 &= ~(3<<10);
282+
LPC_PINCON->PINMODE1 |= (2<<10); // P0.21 has no pull up/down resistor
283+
#endif
284+
226285
// Initialize step pulse timing from settings. Here to ensure updating after re-writing.
227286
#ifdef STEP_PULSE_DELAY
228287
// Set total step pulse time after direction pin set. Ad hoc computation from oscilloscope.

0 commit comments

Comments
 (0)