Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made PWM frequency changable by $33 setting #4

Open
wants to merge 58 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
063b1f6
Config for K40
cprezzi May 10, 2017
0471485
Added $33 for PWM frequency and defaults for K40
cprezzi May 10, 2017
b48c3c7
Error corrected in config.h (missing ")" on LIMIT_MASK)
cprezzi May 10, 2017
17121a2
Corrected release link in README.md
cprezzi May 10, 2017
f7083b9
Added 4.axes (A) and moved default settings to defaults.h and cpu-map.h
cprezzi May 11, 2017
da94635
Merge remote-tracking branch 'upstream/master'
cprezzi May 16, 2017
d85bfa8
Added default settings for PWM_OFF_VALUE, PWM_MIN_VALUE and PMW_MAX_V…
cprezzi May 18, 2017
1f0ab33
Merged new $ params
cprezzi May 18, 2017
b28fd39
Merge branch 'master' into more-axis
cprezzi May 18, 2017
73cdb2f
Corrected stepper invert mask for K40
cprezzi May 18, 2017
8856b3f
Corrected K40 defaults
cprezzi May 18, 2017
50c13a1
Moved homing origin to bottom/left instead of top/right
cprezzi May 18, 2017
83c1b57
Merge branch 'master' into more-axis
cprezzi May 26, 2017
eeb206e
Adjusted config.h
cprezzi Jun 21, 2017
1498388
Added Links for Make and ARM Toolchain.
cprezzi Jun 21, 2017
ba4e837
Added Links for Make Tool and ARM Toolchain.
cprezzi Jun 21, 2017
b24e01d
Merge branch 'master' of https://github.com/cprezzi/grbl-LPC
cprezzi Jun 21, 2017
f904fff
Highlight make as command.
cprezzi Jun 21, 2017
06e9bf8
Made CPU-MAP per Board instead of MCU
cprezzi Jul 12, 2017
54ae403
Made A-Axis switchable in config.h
cprezzi Jul 12, 2017
a661778
Made board switchable in config.h
cprezzi Jul 12, 2017
4366150
Always use MIN endstop pins (independant of board!)
cprezzi Jul 12, 2017
dc92bf5
Support coolant flood and mist for remix board
cprezzi Aug 3, 2017
4252f75
Merge branch 'more-axis'
cprezzi Aug 3, 2017
96ad0af
Set coolant pins for all supported boards in cpu-map.h
cprezzi Aug 3, 2017
5ad7af8
Activated HOMING_FORCE_POSITIVE_SPACE and added SPINDLE_PWM_PIN_2_4 p…
cprezzi Oct 8, 2017
92b093e
Corrected G10 L20 P0 command (setZero)
cprezzi Oct 8, 2017
97f22ff
Added Dockerfile
jorgerobles Apr 30, 2018
f1976d8
Merge pull request #6 from jorgerobles/master
cprezzi Apr 30, 2018
0721e57
Ported spindle enable pin + FEED_HOLD, CYCLE_START and DOOR_SWITCH pins
cprezzi Jul 5, 2018
fb20eeb
Added config option to have PWM on P1.23 for MKS SBase
cprezzi Dec 26, 2018
86875c2
Added a description to each option, including the option codes
bkp23 Jan 8, 2019
ac6817f
Merge pull request #14 from bkp23/defaults_comments
cprezzi Jan 9, 2019
a7ba369
Added comments throughout code
bkp23 Apr 29, 2019
8ff3d53
Revert simple code changes so only comments have been changed
bkp23 Apr 30, 2019
b09170d
Merge pull request #21 from bkp23/master
cprezzi Apr 30, 2019
9b6300a
impliment changes to allow probing to work and map the probe pin to p…
tscofield Jul 26, 2019
ffdd368
Add additional info to help new users
tscofield Jul 26, 2019
e21a807
Merge pull request #28 from tscofield/build_doc
cprezzi Jul 26, 2019
04f8621
Merge pull request #27 from tscofield/probe
cprezzi Jul 26, 2019
843c7b0
Merge branch 'master' of https://github.com/cprezzi/grbl-LPC
cprezzi Nov 18, 2019
84070bf
Workaround for coolant mist control
cprezzi Nov 18, 2019
fd1d6d3
Update README.md
cprezzi Dec 10, 2019
85555b0
Update README.md
cprezzi Dec 10, 2019
4572d01
Update README.md
cprezzi Dec 10, 2019
0cd6bcc
Add open drain configuration per axis
Jan 7, 2020
47248cb
Merge pull request #37 from johnsonm/open-drain
cprezzi Jan 8, 2020
a2186bb
Update README.md
cprezzi Jan 15, 2020
7e3d624
Config changes to compile for C3d Mini / K40
cprezzi Feb 11, 2020
c37deda
Merge branch 'master' of https://github.com/cprezzi/grbl-LPC
cprezzi Feb 11, 2020
48a79be
Compiled bin files for all boards
cprezzi Feb 11, 2020
6776409
Fix for safety door, feed hold and cycle start bits
Mar 29, 2020
bbba813
Merge pull request #42 from betgear/door_fix
cprezzi Mar 30, 2020
8904dbb
Fix for issue #49
tscofield Dec 2, 2020
6da1169
Merge pull request #53 from tscofield/probe
cprezzi Feb 19, 2021
f6762ca
Update README.md
cprezzi Mar 31, 2022
5eede4d
Update cpu_map.h
cprezzi Mar 31, 2022
72d029e
Update cpu_map.h
cprezzi Apr 11, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions DOCKER_LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2016 Ryan

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
32 changes: 32 additions & 0 deletions DOCKER_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Arm Embedded Docker Environment
Minimal docker environment for building arm-embedded projects

## Usage
Run interactively with ```docker run -it --rm -v `pwd`:/root ryankurte/docker-arm-embedded /bin/bash```.
This will create a temporal instance (changes will be dropped on exit) with a binding from the current directory to the root user home directory.

If you are using selinux you may need to add a ```:z``` to the end of the -v parameter to indicate the mount is shared.

```docker run -it --rm -v `pwd`:/root:z ryankurte/docker-arm-embedded /bin/bash```

https://docs.docker.com/storage/bind-mounts/

### Building grbl-LPC
Update the grbl/config.h and uncomment the CPU_MAP define statement for the board you are compiling for

```
git submodule init
git submodule update
make
```

The resulting firmware file is build/firmware.bin

## Includes:
- build-essential (native)
- make, cmake
- gawk, genromfs, ccache
- arm-none-eabi from [launchpad.net](https://launchpad.net/~terry.guo/+archive/ubuntu/gcc-arm-embedded)
- [Yotta](http://yotta.mbed.com/)


62 changes: 62 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
FROM ubuntu:latest
MAINTAINER Ryan Kurte <ryankurte@gmail.com>
LABEL Description="Docker image for building arm-embedded projects"

# General dependencies
RUN apt-get update && apt-get install -y \
git \
subversion \
curl \
cmake \
make \
automake \
autoconf \
python-setuptools \
ninja-build \
python-dev \
libtool \
unzip \
libffi-dev \
libssl-dev \
libusb-1.0.0 \
libusb-1.0.0-dev \
software-properties-common \
python-software-properties \
gawk \
genromfs \
ccache \
clang \
build-essential \
python3 \
python3-dev \
python3-pip \
libprotobuf-dev \
protobuf-compiler \
libprotobuf-c-dev \
protobuf-c-compiler \
python-protobuf

# arm-none-eabi custom ppa
RUN add-apt-repository ppa:team-gcc-arm-embedded/ppa && \
apt-get update && \
apt-get install -y gcc-arm-embedded

# Yotta
RUN easy_install pip && \
pip install yotta && \
mkdir -p /usr/local/lib/yotta_modules \
chown $USER /usr/local/lib/yotta_modules \
chmod 755 /usr/local/lib/yotta_modules

# Pyserial for serial programming
RUN pip install pyserial

# STLink util
RUN git clone https://github.com/texane/stlink.git && \
cd stlink && mkdir build && cd build && \
cmake .. && make && make install

# Cleanup
RUN apt-get clean && \
rm -rf /var/lib/apt

23 changes: 16 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
![GitHub Logo](https://github.com/gnea/gnea-Media/blob/master/Grbl%20Logo/Grbl%20Logo%20250px.png?raw=true)

***
Old releases are in the `Release` tab. See [cprezzi's branch](https://github.com/cprezzi/grbl-LPC) for more recent releases.
Note: cprezzi's branch disables current control and has defaults more suitable for other boards.
Note: this branch defaults stepper current to zero and has defaults for more boards and machines.
***
This is GRBL 1.1 ported to the LPC1769. It can run on Smoothieboard.
This is GRBL 1.1 ported to the LPC1769.
It can run on the following boards:
- Smoothieboard
- Cohesion3D Remix and Mini
- MKS SBase
- Azteeg X5

Usage notes:
SKR boards don't work, because pin mapping is messed!

**Usage notes:**
* This uses a different usb-serial driver than Smoothieware. Windows 10 should recognize it automatically.
If it doesn't, try installing VCOM_lib/usbser.inf.
* This doesn't pass the sdcard to the host. Once installed you need to use a micro sdcard adaptor to replace or change it.
Expand All @@ -24,14 +30,17 @@ New configuration settings
* $34 is PWM off value in %
* $35 is PWM min value in %
* $36 is PWM max value in %
* $140, $141, $142 are X, Y, Z current (amps)
* $140, $141, $142, $143 are X, Y, Z, E0 current (amps)
* Default to 0.0 A to avoid burning out your motors
* Your motors will likely stall if you don't set these!

Build notes:
**Build notes:**
* You should use virtual machines, if you use multiple toolchains on the same PC.
* Install make if not already there (for Windows see http://gnuwin32.sourceforge.net/packages/make.htm)
* Install the ARM embeded toolchain (see https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads)
* Include ```make``` and the ```arm-none-eabi-*``` tools in your path.
* Run ```git submodule init``` and ```git submodule update``` before building.
* Make produces 2 files:
* Run ```make```, which produces 2 files:
* ```build/firmware.bin```: this is compatible with the sdcard bootloader.
* ```build/grbl.hex```: this is not compatible with the sdcard bootloader. It loads using Flash Magic
and is primarilly for developers who don't want to keep swapping sdcards. If you flash this,
Expand Down
8 changes: 8 additions & 0 deletions doc/markdown/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ $27=1.000
$30=1000.
$31=0.
$32=0
$33=5000
$100=250.000
$101=250.000
$102=250.000
Expand All @@ -63,6 +64,9 @@ $122=10.000
$130=200.000
$131=200.000
$132=200.000
$140=0.000
$141=0.000
$142=0.000
```

#### $x=val - Save Grbl setting
Expand Down Expand Up @@ -227,6 +231,10 @@ When enabled, Grbl will move continuously through consecutive `G1`, `G2`, or `G3

When disabled, Grbl will operate as it always has, stopping motion with every `S` spindle speed command. This is the default operation of a milling machine to allow a pause to let the spindle change speeds.

#### $33 - Spindle/Laser PWM frequency

This sets the PWM frequency.

#### $100, $101 and $102 – [X,Y,Z] steps/mm

Grbl needs to know how far each step will take the tool in reality. To calculate steps/mm for an axis of your machine you need to know:
Expand Down
Binary file added doc/media/Thumbs.db
Binary file not shown.
2 changes: 1 addition & 1 deletion grbl-lpc/current_control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void current_init()
set_current(0, settings.current[0]);
set_current(1, settings.current[1]);
set_current(2, settings.current[2]);
set_current(3, DEFAULT_A_CURRENT);
set_current(3, settings.current[3]);
#endif
}

Expand Down
14 changes: 7 additions & 7 deletions grbl-lpc/delay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@

void delay_init()
{
LPC_TIM3->CTCR = 0; // timer mode
LPC_TIM3->PR = 0; // no prescale
LPC_TIM3->MCR = 0; // no MR actions
LPC_TIM3->CCR = 0; // no capture
LPC_TIM3->EMR = 0; // no external match
LPC_TIM3->TCR = 0b10; // reset
LPC_TIM3->TCR = 0b01; // enable
LPC_TIM3->CTCR = 0; // Count Control (0=TimerMode, 1-3=EdgeCounterMode)
LPC_TIM3->PR = 0; // no Prescale (TC increments ever PR+1 clocks)
LPC_TIM3->MCR = 0; // no Match Control actions
LPC_TIM3->CCR = 0; // no Capture Control actions
LPC_TIM3->EMR = 0; // no External Match (controls external match pins)
LPC_TIM3->TCR = 0b10; // reset Timer Control (0b10=Reset, 0b01=Enable)
LPC_TIM3->TCR = 0b01; // enable Timer Control (0b10=Reset, 0b01=Enable)
}
33 changes: 17 additions & 16 deletions grbl-lpc/flash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,37 +25,38 @@ static constexpr unsigned flash_addr = 0xF000; // Last 4k sec
static constexpr unsigned flash_size = 1024; // Only using 1k of a 4k sector
static char *flash_memory = (char *)flash_addr; // Flash memory
static char flash_buffer[flash_size] __attribute__((aligned(4))); // Copy of flash memory
using Iap = void(unsigned[], unsigned[]); // IAP entry point
static const Iap *iap = (Iap *)0x1FFF1FF1; // IAP entry point
using Iap = void(unsigned[], unsigned[]); // IAP entry point function
static const Iap *iap = (Iap *)0x1FFF1FF1; // IAP entry point address

void eeprom_init()
{
memcpy(flash_buffer, flash_memory, flash_size);
memcpy(flash_buffer, flash_memory, flash_size); // Copy flash memory into local flash buffer
}

void eeprom_commit()
{
if (!memcmp(flash_buffer, flash_memory, flash_size))
return;
return; // No changes to commit
unsigned prepCommand[5] = {
50,
flash_sector,
flash_sector,
50, // Prepare sector(s) for write operation
flash_sector, // Start sector
flash_sector, // End sector
};
unsigned eraseCommand[5] = {
52,
flash_sector,
flash_sector,
SystemCoreClock / 1000,
52, // Erase sector(s)
flash_sector, // Start sector
flash_sector, // End sector
SystemCoreClock / 1000, // CPU clock frequency in kHz
};
unsigned writeCommand[5] = {
51,
flash_addr,
(unsigned)flash_buffer,
flash_size,
SystemCoreClock / 1000,
51, // Copy RAM to Flash
flash_addr, // Destination flash address (256-byte boundary)
(unsigned)flash_buffer, // Source RAM address (word boundary)
flash_size, // Number of bytes to write (must be: 256, 512, 1024, 4096)
SystemCoreClock / 1000, // CPU clock frequency in kHz
};
unsigned output[5];
// Run In-Application Programming (IAP) routines
iap(prepCommand, output);
iap(eraseCommand, output);
iap(prepCommand, output);
Expand Down
Loading