1HCL 1.0 closed loop controller
-
@dc42 ; General preferences
M575 P1 S1 B57600 ; enable support for PanelDue
G90 ; send absolute coordinates...
M83 ; ...but relative extruder moves
M550 P"Hemera" ; set printer name; Network
M552 P192.168.1.74 S1 ; enable network and acquire dynamic address via DHCP
M586 P0 S1 ; enable HTTP
M586 P1 S0 ; disable FTP
M586 P2 S0 ; disable Telnet; Drives
G4 S1 ;wait for expansion boards to start
M569.1 P50.0 T2 C5 E5:10 ; Configure the 1HCL board at CAN address 50 with a quadrature encoder on the motor shaft that has 20 steps per motor full step.
M569.1 P51.0 T2 C5 E5:10 ; Configure the 1HCL board at CAN address 51 with a quadrature encoder on the motor shaft that has 20 steps per motor full step.
M569 P50.0 D4 S1 ; Configure the motor on the 1HCL at can address 50 as being in closed-loop drive mode (D4), Open loop (D2) and not reversed (S1) X axis
M569 P51.0 D4 S1 ; Configure the motor on the 1HCL at can address 51 as being in closed-loop drive mode (D4), Open loop (D2) and not reversed (S1) Y axis
M569 P0.0 S1 ; physical drive 0.0 goes forwards
M569 P0.1 S1 ; physical drive 0.1 goes forwards
M584 X50.0 Y51.0 Z0.0 E0.1 ; set drive mapping
M350 X16 Y16 Z16 E16 I1 ; configure microstepping with interpolation
M92 X106.50 Y106.50 Z400.00 E420.00 ; set steps per mm
M566 X900.00 Y900.00 Z60.00 E120.00 ; set maximum instantaneous speed changes (mm/min)
M203 X6000.00 Y6000.00 Z180.00 E1200.00 ; set maximum speeds (mm/min)
M201 X500.00 Y500.00 Z20.00 E250.00 ; set accelerations (mm/s^2)
M906 X1000 Y1000 Z800 E800 I30 ; set motor currents (mA) and motor idle factor in per cent
M84 S30 ; Set idle timeout
M917 X10 Y10 ; Set the closed loop axes to have a holding current of zero; Axis Limits
M208 X0 Y0 Z0 S1 ; set axis minima
M208 X235 Y235 Z235 S0 ; set axis maxima; Endstops
M574 X1 S1 P"io1.in" ; configure active-high endstop for low end on X via pin !^io1.in
M574 Y1 S1 P"io2.in" ; configure active-high endstop for low end on Y via pin !^io2.in
M574 Z1 S2 ; configure Z-probe endstop for low end on Z
M591 D0 P7 C"io5.in" L7 R55:150 E22 S1 ;Bigtree smart filament moniter v2 set to moniter between 55%-150% of 7 counts over a distance of 22mm; Z-Probe
M950 S0 C"io7.out" ; create servo pin 0 for BLTouch
M558 P9 C"io7.in" H5 F120 T6000 ; set Z probe type to bltouch and the dive height + speeds
G31 P500 X60 Y0 Z2.5 ; set Z probe trigger value, offset and trigger height
M557 X15:200 Y15:200 S20 ; define mesh grid; Heaters
M308 S0 P"temp0" Y"thermistor" T100000 B4138 ; configure sensor 0 as thermistor on pin temp0 Bed Heater
M950 H0 C"out1" T0 ; create bed heater output on out1 and map it to sensor 0
M307 H0 B1 S5.00 ; enable bang-bang mode for the bed heater and set PWM limit
M140 H0 ; map heated bed to heater 0
M143 H0 S120 ; set temperature limit for heater 0 to 120C
M308 S1 P"temp1" Y"thermistor" T100000 B4138 ; configure sensor 1 as thermistor on pin temp1
M950 H1 C"out2" T1 ; create nozzle heater output on out2 and map it to sensor 1
M307 H1 B0 S1.00 ; disable bang-bang mode for heater and set PWM limit
M143 H1 S280 ; set temperature limit for heater 1 to 280C; Fans
M950 F0 C"out8" Q500 ; create fan 0 on pin out8 and set its frequency
M106 P0 C"Tool Fan" S0 H-1 ; set fan 0 name and value. Thermostatic control is turned off
;M950 F1 C"out6" Q500 ; create fan 1 on pin out6 and set its frequency
M950 F1 C"!out6+out6.tach" ; Fan 1 uses out6, but we are using a PWM fan so the output needs to be inverted, and using out6.tach as a tacho input
M950 F2 C"out7" Q500 ; create fan 2 on pin out7 and set its frequency
M106 P1 C"Extruder" S1 H1 T50 ; set fan 1 name and value. Thermostatic control is turned on; Tools
M563 P0 D0 H1 F0 ; define tool 0
G10 P0 X0 Y0 Z0 ; set tool 0 axis offsets
G10 P0 R0 S0 ; set initial tool 0 active and standby temperatures to 0C; Custom settings are not defined
; Miscellaneous
M911 S10 R11 P"M913 X0 Y0 G91 M83 G1 Z3 E-5 F1000" ; set voltage thresholds and actions to run on power loss -
@supertb1 looks like you haven't run M303 heater tuning on either of your heaters, so you have incomplete M307 commands.
-
@dc42 OK thanks... I will get that done... any idea why Duet2and3Firmware-3.4.0 is causing the board to lock up? or do you think the heater tune is the answer?
-
@dc42 This is what I came up with on my heater calibrations:
M307 H0 R0.395 K0.368:0.000 D5.05 E1.35 S1.00 B0
M307 H1 R4.905 K0.241:0.035 D7.64 E1.35 S1.00 B0 V24.0
Do I try and perform Duet2and3Firmware-3.4.0.zip again? or is there something else I need to do? -
@supertb1 said in 1HCL 1.0 closed loop controller:
Do I try and perform Duet2and3Firmware-3.4.0.zip again? or is there something else I need to do?
Just to verify, you are uploading the whole zip file to the system tab in DWC? Correct?
Can you send M122 and M98 P"config.g" in the gcode console and copy and paste the results here?
Are you using a raspberry pi?
-
@phaedrux
To answer your question I am using the DWC to upload the Zip file as is with out unziping it in any way and no there is no Raspberry Pi or any other kind of USB handler. It is strictly Duet equipment in a stand alone format in the control box. Incedently I did get a good response back on the Y axis in closed loop so I am excited to get to that part. Let me know your thoughts please.
M122
=== Diagnostics ===
RepRapFirmware for Duet 3 MB6HC version 3.4.0 (2022-03-15 18:57:24) running on Duet 3 MB6HC v1.01 or later (standalone mode)
Board ID: 08DJM-956BA-NA3TJ-6J9F2-3SD6J-9B9AT
Used output buffers: 1 of 40 (13 max)
=== RTOS ===
Static ram: 151000
Dynamic ram: 96256 of which 0 recycled
Never used RAM 103416, free system stack 200 words
Tasks: NETWORK(ready,25.4%,237) ETHERNET(notifyWait,0.0%,184) HEAT(notifyWait,0.0%,321) Move(notifyWait,0.0%,352) CanReceiv(notifyWait,0.0%,797) CanSender(notifyWait,0.0%,374) CanClock(delaying,0.0%,339) TMC(notifyWait,8.0%,92) MAIN(running,66.4%,1101) IDLE(ready,0.1%,30), total 100.0%
Owned mutexes:
=== Platform ===
Last reset 00:01:45 ago, cause: power up
Last software reset at 2022-04-19 16:25, reason: User, GCodes spinning, available RAM 103216, slot 2
Software reset code 0x0003 HFSR 0x00000000 CFSR 0x00000000 ICSR 0x00400000 BFAR 0x00000000 SP 0x00000000 Task MAIN Freestk 0 n/a
Error status: 0x00
Aux0 errors 0,0,0
Step timer max interval 127
MCU temperature: min 19.7, current 30.8, max 31.0
Supply voltage: min 24.2, current 24.2, max 24.3, under voltage events: 0, over voltage events: 0, power good: yes
12V rail voltage: min 12.0, current 12.1, max 12.2, under voltage events: 0
Heap OK, handles allocated/used 0/0, heap memory allocated/used/recyclable 0/0/0, gc cycles 0
Events: 0 queued, 0 completed
Driver 0: standstill, SG min 0, mspos 8, reads 59917, writes 14 timeouts 0
Driver 1: standstill, SG min 0, mspos 8, reads 59917, writes 14 timeouts 0
Driver 2: standstill, SG min 0, mspos 8, reads 59920, writes 11 timeouts 0
Driver 3: standstill, SG min 0, mspos 8, reads 59920, writes 11 timeouts 0
Driver 4: standstill, SG min 0, mspos 8, reads 59920, writes 11 timeouts 0
Driver 5: standstill, SG min 0, mspos 8, reads 59921, writes 11 timeouts 0
Date/time: 2022-04-19 20:48:29
Slowest loop: 2.39ms; fastest: 0.05ms
=== Storage ===
Free file entries: 10
SD card 0 detected, interface speed: 25.0MBytes/sec
SD card longest read time 1.5ms, write time 0.0ms, max retries 0
=== Move ===
DMs created 125, segments created 0, maxWait 0ms, bed compensation in use: none, comp offset 0.000
=== MainDDARing ===
Scheduled moves 0, completed 0, hiccups 0, stepErrors 0, LaErrors 0, Underruns [0, 0, 0], CDDA state -1
=== AuxDDARing ===
Scheduled moves 0, completed 0, hiccups 0, stepErrors 0, LaErrors 0, Underruns [0, 0, 0], CDDA state -1
=== Heat ===
Bed heaters 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1, chamber heaters -1 -1 -1 -1, ordering errs 0
=== GCodes ===
Segments left: 0
Movement lock held by null
HTTP is idle in state(s) 0
Telnet is idle in state(s) 0
File is idle in state(s) 0
USB is idle in state(s) 0
Aux is idle in state(s) 0
Trigger is idle in state(s) 0
Queue is idle in state(s) 0
LCD is idle in state(s) 0
SBC is idle in state(s) 0
Daemon is idle in state(s) 0
Aux2 is idle in state(s) 0
Autopause is idle in state(s) 0
Code queue is empty
=== Filament sensors ===
Extruder 0 sensor: no data received
=== CAN ===
Messages queued 957, received 1698, lost 0, boc 0
Longest wait 6ms for reply type 6018, peak Tx sync delay 6, free buffers 50 (min 49), ts 526/525/0
Tx timeouts 0,0,0,0,0,0
=== Network ===
Slowest loop: 4.39ms; fastest: 0.02ms
Responder states: HTTP(0) HTTP(0) HTTP(0) HTTP(0) HTTP(0) HTTP(0) FTP(0) Telnet(0), 0 sessions Telnet(0), 0 sessions
HTTP sessions: 1 of 8-
Ethernet -
State: active
Error counts: 0 0 1 0 0
Socket states: 5 2 2 2 2 0 0 0M98 P"config.g"
HTTP is enabled on port 80
FTP is disabled
TELNET is disabled
M122 B50.0
Diagnostics for board 50:
Duet EXP1HCL firmware version 3.4.0 (2022-03-15 08:58:59)
Bootloader ID: SAME5x bootloader version 2.4 (2021-12-10)
All averaging filters OK
Never used RAM 52288, free system stack 192 words
Tasks: Move(notifyWait,0.0%,152) HEAT(notifyWait,0.0%,88) CanAsync(notifyWait,0.0%,70) CanRecv(notifyWait,0.0%,79) CanClock(notifyWait,0.0%,72) TMC(notifyWait,34.6%,360) CLSend(notifyWait,0.0%,152) MAIN(running,63.7%,407) IDLE(ready,0.0%,30) AIN(notifyWait,1.7%,265), total 100.0%
Last reset 00:04:37 ago, cause: power up
Last software reset data not available
Closed loop enabled: yes, pre-error threshold: 5.00, error threshold: 10.00, encoder type rotaryQuadrature, reverse polarity: no, position 1, raw count = 0, tuning mode: 0, tuning error: 0x1, collecting data: no
Control loop runtime (ms): min=0.003, max=0.012, frequency (Hz): min=11364, max=17045
Driver 0: pos 0, 106.5 steps/mm,not tuned, SG min 0, mspos 8, reads 2343, writes 34 timeouts 0, steps req 0 done 0
Moves scheduled 0, completed 0, in progress 0, hiccups 0, step errors 0, maxPrep 0, maxOverdue 0, maxInc 0, mcErrs 0, gcmErrs 0
Peak sync jitter -7/7, peak Rx sync delay 195, resyncs 0/0, no step interrupt scheduled
VIN voltage: min 24.3, current 24.3, max 24.4
V12 voltage: min 12.1, current 12.1, max 12.1
MCU temperature: min 22.7C, current 25.6C, max 25.8C
Last sensors broadcast 0x00000000 found 0 45 ticks ago, 0 ordering errs, loop time 0
CAN messages queued 2258, send timeouts 0, received 2511, lost 0, free buffers 37, min 37, error reg 0
dup 0, oos 0/0/0/0, bm 0, wbm 0, rxMotionDelay 0M122 B51.0
Diagnostics for board 51:
Duet EXP1HCL firmware version 3.4.0 (2022-03-15 08:58:59)
Bootloader ID: SAME5x bootloader version 2.4 (2021-12-10)
All averaging filters OK
Never used RAM 52288, free system stack 182 words
Tasks: Move(notifyWait,0.0%,152) HEAT(notifyWait,0.0%,88) CanAsync(notifyWait,0.0%,70) CanRecv(notifyWait,0.0%,79) CanClock(notifyWait,0.0%,72) TMC(notifyWait,34.6%,360) CLSend(notifyWait,0.0%,152) MAIN(running,63.7%,417) IDLE(ready,0.0%,30) AIN(notifyWait,1.7%,265), total 100.0%
Last reset 00:05:21 ago, cause: power up
Last software reset data not available
Closed loop enabled: yes, pre-error threshold: 5.00, error threshold: 10.00, encoder type rotaryQuadrature, reverse polarity: no, position 1, raw count = 0, tuning mode: 0, tuning error: 0x1, collecting data: no
Control loop runtime (ms): min=0.003, max=0.011, frequency (Hz): min=11364, max=17442
Driver 0: pos 0, 106.5 steps/mm,not tuned, SG min 0, mspos 8, reads 655, writes 34 timeouts 0, steps req 0 done 0
Moves scheduled 0, completed 0, in progress 0, hiccups 0, step errors 0, maxPrep 0, maxOverdue 0, maxInc 0, mcErrs 0, gcmErrs 0
Peak sync jitter -4/4, peak Rx sync delay 195, resyncs 0/0, no step interrupt scheduled
VIN voltage: min 24.3, current 24.3, max 24.4
V12 voltage: min 12.2, current 12.2, max 12.2
MCU temperature: min 22.1C, current 25.8C, max 25.8C
Last sensors broadcast 0x00000000 found 0 140 ticks ago, 0 ordering errs, loop time 0
CAN messages queued 2610, send timeouts 0, received 2909, lost 0, free buffers 37, min 37, error reg 0
dup 0, oos 0/0/0/0, bm 0, wbm 0, rxMotionDelay 0 -
-
At least it looks like all of the boards are up to date now, so it did apply the firmware.
It may help to see a video of the entire firmware zip file upload process so we can see what it's doing along the way.
-
@phaedrux https://www.youtube.com/watch?v=N9KXrUuBpnk
It took this time... thank god... ok so I tried to home my "X" axis in closed loop and it failed to home properly. The console reports:
4/20/2022, 3:31:42 PM Error: Driver 50.0 error: failed to maintain position
4/20/2022, 3:31:41 PM Warning: Driver 50.0 warning: tuning failed
Warning: Driver 50.0 new tuning error(s): The measured motion was inconsistent.
4/20/2022, 3:31:40 PM Error: Driver 50.0 error: failed to maintain position
4/20/2022, 3:31:37 PM Error: Driver 50.0 error: failed to maintain position
Error: Driver 50.0 error: failed to maintain position -
@phaedrux Y axis and Z axis home fine
Here is my HomeX:
M569 P50.0 D0 ; Turn off closed loopG91 ; relative positioning
G1 H2 Z5 F6000 ; lift Z relative to current position
G1 H1 X-240 F3000 ; move quickly to X axis endstop and stop there (first pass)
G1 H2 X5 F6000 ; go back a few mm
G1 H1 X-240 F240 ; move slowly to X axis endstop once more (second pass)G90 ; absolute positioning
G1 X50 F3000 ; Move to a known-safe position
M400 ; Wait for the move to complete
G4 P500 ; Wait for the motor to settle
M569 P50.0 D4 ; Turn closed loop back on
M569.6 P50.0 V31 ; Perform the tuning manoeuvres for a quadrature encoder
G1 X0 ; Move back to X0G1 H2 Z0 F6000 ; lower Z again
-
Glad it worked this time. Hopefully that means everything is up to date and in sync now and should stay that way going forward.
As for the homing and closed loop, I'm not really familiar. Best I can do is point you to the M569.x gcode command documentation here:
https://docs.duet3d.com/User_manual/Reference/Gcodes#m5696-execute-closed-loop-tuning-move
Let me know how you proceed and we can figure it out.
-
@dc42 In open loop what would cause the 1HCL board to report a failed to maintain position on a homing sequence? As soon as I move the axis it makes the same report, as soon as I restart the main board it makes that report
-
@supertb1 are you sure that the driver is in open loop mode? Try using D2 instead of D0 in the M569 command to set the driver to open loop mode.
-
@dc42 Yes sir, that is how it is set at the moment, would resetting the board help?
; Drives
G4 S1 ;wait for expansion boards to start
M569.1 P50.0 T2 C5 E5:10 ; Configure the 1HCL board at CAN address 50 with a quadrature encoder on the motor shaft that has 20 steps per motor full step.
M569.1 P51.0 T2 C5 E5:10 ; Configure the 1HCL board at CAN address 51 with a quadrature encoder on the motor shaft that has 20 steps per motor full step.
M569 P50.0 D2 S1 ; Configure the motor on the 1HCL at can address 50 as being in closed-loop drive mode (D4), Open loop (D2) and not reversed (S1) X axis
M569 P51.0 D4 S1 ; Configure the motor on the 1HCL at can address 51 as being in closed-loop drive mode (D4), Open loop (D2) and not reversed (S1) Y axis
M569 P0.0 S1 ; physical drive 0.0 goes forwards
M569 P0.1 S1 ; physical drive 0.1 goes forwards
M584 X50.0 Y51.0 Z0.0 E0.1 ; set drive mapping
M350 X16 Y16 Z16 E16 I1 ; configure microstepping with interpolation
M92 X80.50 Y81.70 Z407.00 E420.00 ; set steps per mm
M566 X900.00 Y900.00 Z60.00 E120.00 ; set maximum instantaneous speed changes (mm/min)
M203 X6000.00 Y6000.00 Z180.00 E1200.00 ; set maximum speeds (mm/min)
M201 X500.00 Y500.00 Z20.00 E250.00 ; set accelerations (mm/s^2)
M906 X1000 Y1000 Z800 E800 I30 ; set motor currents (mA) and motor idle factor in per cent
M84 S30 ; Set idle timeout
M917 X100 Y100 ; Set the closed loop axes to have a holding current of zero; homex.g
; called to home the X axis
;
; generated by RepRapFirmware Configuration Tool v3.3.10 on Fri Apr 08 2022 20:56:07 GMT-0500 (Central Daylight Time)
G91 ; relative positioning
G1 H2 Z5 F6000 ; lift Z relative to current position
G1 H1 X-240 F1800 ; move quickly to X axis endstop and stop there (first pass)
G1 H2 X5 F6000 ; go back a few mm
G1 H1 X-240 F360 ; move slowly to X axis endstop once more (second pass)
G1 H2 Z-5 F6000 ; lower Z again
G90 ; absolute positioning
; homex.g -
@supertb1 I was referring to this line in your homex.g file:
M569 P50.0 D0 ; Turn off closed loop
-
@dc42 I added that line to the first line of code in my home”x” and I’m still getting the same error “ driver 50.0 error: failed to maintain position. It is homing in open loop and is working that way but the error persists… I’m going to put it back in close loop and see what it does. I put it back into closed loop and of course the error persists. I switch the cards around and manually operated the switches by hand, the problem follows the motor. I disconnected the motor leads from the board, ran M122 B50 looking for the raw count being zero, then moved the motor armature and ran M122 B50 again and no change in the raw count so I think I have a bad encoder on my motor. I guess I am back to the drawing board on my end... aside from this issue I have all my other areas of concern addressed. Thank you all for your help @dc42, @Phaedrux
-
@supertb1 what exactly is the sequence that gives rise to that error message? Does it occur during homing; or when homing is complete; or when you attempt an axis movement after homing? Has the driver been switched back to closed loop mode when it occurs?
-
@dc42 it happens immediately upon initiation of homing sequence, on command movement and at board reset in both open and closed loop, it will home in both open and close loop but in close loop it will not maintain position. I am going to take the motor apart to try and understand what is happening better… more to follow
-
@supertb1 I popped the side cover off the motor and found the A+ wire had a bad solder joint, put it all back together and now when I home the axis it still returns 4/22/2022, 8:43:39 PM Error: Driver 50.0 error: failed to maintain position
And then it displays drive 50.0 tuned successfully measured hysteresis 0.17 step… go figure… it is holding position and everything. So last question, how do I get the error to go away? -
@supertb1 so is the only problem now that in open loop mode when you are homing and have not tuned, you are getting the "filed to maintain position" message?
-
@dc42 no it is giving the alarm on a tuned closed loop homing cycle… it is doing it on my other system that I recently updated… the alarm has something to do with one of the updates I think