Welcome! Log In Create A New Profile

Advanced

LPC17xx RepRap Firmware 3.1.1 with TMC2209 support

Posted by gloomyandy 
LPC17xx RepRap Firmware 3.1.1 with TMC2209 support
June 18, 2020 09:49AM
Folks,
I've now pretty much completed adding TMC2209 support to the LPC port of RRF. This code is based upon the Duet expansion board implementation (thanks again @DC42) but has a lot of modifications to allow it to be used on the LPC. The two main features now supported are stall detection and sensorless homing you can see these in actions here:
[www.youtube.com]

In addition this release includes the capability to upload new WiFi firmware builds to the ESP8266 module directly from the LPC (and from DWC), but note that to do this will almost certainly require hardware modifications. The same changes also allows you to obtain debug information from the WiFi firmware via the serial port. There are also a fair number of other changes (many of the to support the major features above), some details of these can be found here:
[github.com]

To use the new TMC2209 features requires an addition to the board.txt file (to specify the pins used for the DIAG signals from the drivers) and obviously requires that the DIAG pins are routed to those pins (either directly by the board or via jumper wires), Jay_s will be updating the Wiki with the details but for now you will need an entry of the form:
stepper.TmcDiagPins = {(pin 0), (pin 1), ...}

where (pin 0) is the DIAG pin for drive 0. By default no pins are defined and if you do not want to use stall detection for a drive set the pin to NoPin. Getting stall detection working can be tricky and sensorless homing will almost certainly require some tuning. I have provided sample homing files along with the binaries. One thing to note is that the TMC2209 only supports stall detection when using Stealthchop mode so take care to make sure that is enabled and that the stealthchop/spreadcycle threshold is not set to too low a speed. As always the Duet help pages provide a lot of information that may also be of help:
[duet3d.dozuki.com]

The WiFi UART interface will also require changes to your board.txt file. You need to define the pins used by the UART (the builds I have provided have support for UART0 and UART3 defined (both of these are available on the SKR V1.4 board), this takes the form:
8266wifi.serialRxTxPins = {RXPin, TXPin}

so on the SKR V1.4 you can use...
8266wifi.serialRxTxPins = {4.29, 4.28}

for the UART connected to the SKR WiFi header or
8266wifi.serialRxTxPins =  {0.3, 0.2}

to use the UART connected to the TFT header.
You will also need to hook up the ESP8266 UART pins (marked RX/TX on most modules) and to allow the LPC to put the module in to flash mode you may need to change the resistor that goes to the GPIO0 pin from the 2200 Ohm specified in the Wiki to a lower value, I used 47 Ohm.

I've created a set of test builds for anyone to try. These can be found here:
[drive.google.com]
Re: LPC17xx RepRap Firmware 3.1.1 with TMC2209 support
June 19, 2020 03:00PM
Thanks, I will flash it this night at home.
I am running in a skr 1.3 + 4 tmc2209 + 1 lv8729.
Can you show your config to see sensorless part as a start point to tune?
thanks again
Re: LPC17xx RepRap Firmware 3.1.1 with TMC2209 support
June 19, 2020 03:12PM
The link I provided above to the firmware downloads includes a set of sample homing files. You will almost certainly need to change them to get sensorless homing working. In particular make sure that when you define your stepper drivers with M569 you specify the use of stealthchop (D3) and that you use a value for V that keeps the motors in stealthchop mode during homing operations (try V40). You will also probably need to adjust the H and S setting when setting the stall parameters using M915.
Re: LPC17xx RepRap Firmware 3.1.1 with TMC2209 support
June 20, 2020 01:43PM
Hello,
I can't make it work sensorless, it doesn't stop.
SKR 1.3 with jumpers for sensorless in X and Y.



M122 (drivers section):
Error status: 0
Driver 0: standstill, SG min/max 94/94, error r/w 0/1, ifcnt 138, cnt r/w 1489/13, timeout 0, failedOp 0xff
Driver 1: standstill, SG min/max 238/238, error r/w 0/1, ifcnt 152, cnt r/w 1489/13, timeout 0, failedOp 0xff
Driver 2: standstill, SG min/max 2/2, error r/w 0/1, ifcnt 133, cnt r/w 1489/12, timeout 0, failedOp 0xff
Driver 3: standstill, SG min/max 2/2, error r/w 0/1, ifcnt 115, cnt r/w 1491/10, timeout 0, failedOp 0xff
Date/time: 2020-06-20 18:37:51

M122 P200:
m122 p200
== Configurable Board.txt Settings ==
lpc.board = biquskr_1.3
leds.diagnostic = 1.18
stepper.enablePins = { 2.1 2.8 0.21 2.12 0.10 }
stepper.stepPins = { 2.2 0.19 0.22 2.13 0.1 }
stepper.directionPins = { 2.6 0.20 2.11 0.11 0.0 }
stepper.digipotFactor = 0.00
stepper.TmcUartPins = { 1.17 1.15 1.10 1.8 1.1 }
stepper.numSmartDrivers = 4
stepper.TmcDiagPins = { 1.27 1.29 NoPin NoPin NoPin }
heat.tempSensePins = { 0.23 0.24 NoPin NoPin }
heat.spiTempSensorCSPins = { NoPin NoPin }
heat.spiTempSensorChannel = 0
atx.powerPin = NoPin
atx.powerPinInverted = false
sdCard.internal.spiFrequencyHz = 25000000
sdCard.external.csPin = NoPin
sdCard.external.cardDetectPin = NoPin
sdCard.external.spiFrequencyHz = 4000000
sdCard.external.spiChannel = 255
softwareSPI.pins = { NoPin NoPin NoPin }
SSP0.pins = { 0.15 0.17 0.18 0.16 }
sbc.lpcTfrReadyPin = 1.31
serial.aux.rxTxPins = { 0.3 0.2 }
adc.prefilter.enable = true
adc.preFilter.numberSamples = 8
adc.preFilter.sampleRate = 10000

== Hardware Serial ==
AUX Serial: UART 0

== Software PWM ==
Pin 2.5 @ 250Hz (Enabled)
Pin 2.7 @ 250Hz (Enabled)
Pin 2.3 @ 500Hz (Enabled)
Pin 2.4 @ 500Hz (Enabled)

== Servo PWM ==
Hardware PWM = 50Hz [ NoPin NoPin NoPin NoPin NoPin NoPin ]
Timer2 PWM = 50Hz [ NoPin NoPin NoPin ]
=== Duet Control Server ===
Duet Control Server v3.1.1
Code buffer space: 2048
Configured SPI speed: 8000000 Hz
Full transfers per second: 32.69


my drives definition:
; Drives
M569 P0 S1 D3 V40 T0.1:0.1:0.02:0.02 ; physical drive 0 goes forwards using TMC220x driver timings
M569 P1 S0 D3 V40 T0.1:0.1:0.02:0.02 ; physical drive 1 goes backwards using TMC220x driver timings
M569 P2 S1 D3 T0.1:0.1:0.02:0.02 ; physical drive 2 goes forwards using TMC220x driver timings
M569 P3 S1 D3 T0.1:0.1:0.02:0.02 ; physical drive 2 goes forwards using TMC220x driver timings
M569 P4 S0 T1.0:1.0:0.2:0.2





I am trying with yours homes.g and different sensibilities but never detect diag signal
confused smiley

Edited 1 time(s). Last edit at 06/20/2020 01:44PM by ESTIMULO.
Re: LPC17xx RepRap Firmware 3.1.1 with TMC2209 support
June 20, 2020 02:05PM
Just get homex.g working first, I'm pretty sure that things work as at least 2 other people now have this working, so there is something about what you are doing that is different. What H value are you using on your stall detection settings. What sort of stepper motors do you have are they 0.9 or 1.8 degrees, what voltage are you running them at, what sort of printer do you have? What TMC2209 modules do you have? Post a picture of the modules and the jumper pins on the board. Make sure you have removed any endstops from the x- and y- sockets on the board.
Re: LPC17xx RepRap Firmware 3.1.1 with TMC2209 support
June 20, 2020 04:39PM
@ESTIMULO,

I have a skr 1.3 and 1.8 degree motors, I had to drop the acceleration and increase the movement speed to get it to work, here is my homex :

M201 x500 ; drop acceleration
M400 ; Wait for motion to stop
G91 ; Use relative moves
G1 H2 X0.01 Z0.01 ; Move X a small amount to enable
M400 ; Wait for stop
G4 P200 ; Delay to allow TMC to detect stopped state
M915 p0 s10 H150 r0 ; Configure stall detect
M574 X1 S3 ; Configure X endstop
M913 X50 Z50 ; Lower X and Z power
G4 P200 ; Delay to ensure settings are made
G1 H2 Z5 F2500 ; lift Z relative to current position
g1 H1 X5 F2500 ; back away from endstop
M400
M915 p0 s10 H150 r0 ; Configure stall detect
G4 P200
G1 H1 X-230 F3000 ; Move towards endstop until it stalls
M400 ; Wait until all stopped
M915 p0 s10 H150 r0 ; Configure stall detect
G4 P200 ; Delay to ensure settings are made
g1 H1 X10 F2000 ; back away from endstop
M400
M915 p0 s10 H150 r0 ; Configure stall detect
G4 P200
G1 H1 X-230 F3000 ; Move towards endstop until it stalls
M915 p0 s10 H150 r0 ; Configure stall detect to be less sensitive
G1 X1 F1000 ; Move away from stop and clear stall
G1 H2 Z-5 F2500 ; Return Z to original position
M400 ; wait complete
G90 ; Absolute positioning
M913 X100 Z100 ; back to full power
M915 P0 S20 H200 R1 ; Report any stalls
M201 X3000 ; reset acceleration

Edited 1 time(s). Last edit at 06/21/2020 12:34AM by Micktol.
Re: LPC17xx RepRap Firmware 3.1.1 with TMC2209 support
June 20, 2020 05:14PM
woooooh thanks!! with your settings home X is working perfectly


EDIT: sensorless working in X and Y. I am so happy with your port. Thanks

Edited 1 time(s). Last edit at 06/20/2020 05:25PM by ESTIMULO.
Re: LPC17xx RepRap Firmware 3.1.1 with TMC2209 support
June 21, 2020 12:32AM
@ESTIMULO,

I have an i3 Cartesian printer and in order to get homeall to work correctly with the file posted by gloomyandy, It was also necessary to change the F setting to 6000 in the G1 moves of X and Y.


I use this setting to report stalls M915 p1 S60 H100 r2 but it will need to be tuned to your motors.

Edited 1 time(s). Last edit at 06/21/2020 12:41AM by Micktol.
Re: LPC17xx RepRap Firmware 3.1.1 with TMC2209 support
June 22, 2020 10:14AM
Folks,
I've updated the test build to 3.1.1-10, this has some extra debug to help track down an occasional heater problem. If you see your heater readings producing crazy values (like 2000+ degrees), please do the following...
1. Run m122 and copy the output so you can post it here.
2. Run m122 p201 and see if the temperature readings change at all

Thanks
Re: LPC17xx RepRap Firmware 3.1.1 with TMC2209 support
June 22, 2020 11:11AM
where is the test build? the one i find in your github is from 22/06, is that one?
I have this 2000+ degrees bug from time to time
thanks,

EDIT: flashed and has no sensorless support sad smiley
I go back to previous version.

Edited 1 time(s). Last edit at 06/22/2020 11:19AM by ESTIMULO.
Re: LPC17xx RepRap Firmware 3.1.1 with TMC2209 support
June 22, 2020 11:17AM
The test builds are in the link given in the original post....
[drive.google.com]
Re: LPC17xx RepRap Firmware 3.1.1 with TMC2209 support
June 23, 2020 06:18PM
I've just updated the test builds to 3.1.1-11 these builds contain a couple of potential bug fixes that I'd like people to try...
* Fix a division by zero the the PWM frequency is set to zero. This can happen at the end of playing a beep on the LCD display and potentially in other places and results in the firmware resetting.
* Gather more information and attempt to fix the occasional problem of temperature sensors reporting 2000 degrees+ results.
* Ensure that PWM pins are allocated and released correctly, I'm not aware of anyone hitting this problem, but I'd like to ensure that my fix does not cause any other problems.

The builds are available here: [drive.google.com]
Re: LPC17xx RepRap Firmware 3.1.1 with TMC2209 support
June 26, 2020 03:48PM
Help

I am trying to get my SKR 1.3 work with sensor less homing using reprap firmware

Is there a way to convert my Marlin settings to RepRap? My marlin TMC2209 current is set to 800 and my stall setting is 127. How do I convert this and where do I enter it in Reprap. I fully understand Marlin but lost with Reprap

Cheers,

Crunch
Re: LPC17xx RepRap Firmware 3.1.1 with TMC2209 support
June 28, 2020 06:53AM
The current settings for both Marlin and RRF are in mA so should just go across. To see the gcode commands used with RRF firmware see the following:
[duet3d.dozuki.com]
To set current settings you use M906 :[duet3d.dozuki.com]
The stall detection thresholds are different, On Marlin I think they run from 0 to 255 with 255 being the most sensitive value. RRF (for the LPC) uses values which have the range -127 to +127 with -127 being the most sensitive value. You set these values using the M915 command [duet3d.dozuki.com] In your case 127 would convert to 0 for RRF.

You should probably read the Duet3d Stall detection documentation (see first post). These settings will need to be adjusted for your system and you may need to use different values to those used in Marlin.

Edited 2 time(s). Last edit at 06/28/2020 06:55AM by gloomyandy.
Re: LPC17xx RepRap Firmware 3.1.1 with TMC2209 support
June 28, 2020 07:01AM
I've just release version 3.1.1-12 which contains all of the updates contained in the various test builds from this thread: [github.com]

Thanks for the help testing these builds.
Re: LPC17xx RepRap Firmware 3.1.1 with TMC2209 support
June 29, 2020 10:35AM
Team,

Please post a known good boards.txt and config for use on a skr 1.3 with tmc2209 that i may learn and work from using the latest firmware on SBC.

Cheers,


Crunch

Edited 1 time(s). Last edit at 06/29/2020 10:36AM by Crunch69.
Re: LPC17xx RepRap Firmware 3.1.1 with TMC2209 support
June 29, 2020 10:40AM
See comment on discord

//Config for BIQU SKR v1.3 
lpc.board = biquskr_1.3
sbc.lpcTfrReadyPin = 1.31 
adc.prefilter.enable =true
stepper.numSmartDrivers = 3

Edited 1 time(s). Last edit at 06/29/2020 10:40AM by jay_s.


Based in Darlington, North East
Re: LPC17xx RepRap Firmware 3.1.1 with TMC2209 support
July 03, 2020 03:04PM
Is it possible to make this work with the esp-01s module and skr1.4?
Re: LPC17xx RepRap Firmware 3.1.1 with TMC2209 support
July 03, 2020 03:12PM
Well it certainly works with the SKR V1.4. but the RRF WiFi support will not work with the esp-01. I suppose you might be able to hook up the rx/tx lines from an esp-01 to the SKR UART and feed gcode in that way using something like esp3d, but I'm not aware of anyone doing that and you really miss out on most of the advantages of rrf by doing that, so I'm not sure it makes much sense.
Re: LPC17xx RepRap Firmware 3.1.1 with TMC2209 support
July 03, 2020 04:31PM
Ok, too bad. It would have saved me a lot of space and ugly cables. I guess I will need to wait for the esp8266 modules to arrive.

Edited 1 time(s). Last edit at 07/04/2020 03:23PM by niku.
Re: LPC17xx RepRap Firmware 3.1.1 with TMC2209 support
July 06, 2020 04:52PM
I've merged the code described here into the main version of the firmware (3.1.1-12), please see this thread: [reprap.org]
Sorry, only registered users may post in this forum.

Click here to login