Problem with Duet3D 1HCL+Duet3D Magnetic encoder V0.3+MSR5000
-
Good morning everyone,
I bought a Duet3D 1HCL card and a Duet3D Magnetic Encoder v0.3 that I'm trying to configure with an MSR5000 linear magnetic encoder applied on the axis of a Cartesian printer to have a very high precision reference in the Z axis.
I had a little difficulty configuring the Duet 3D encoder applied to the Nema 23 motor shaft but I managed it with the following codes in the config.g file.
; Drives M569.1 P40.0 T1 C5 R25 I0 D0 E2:4 M569 P40.0 S1 D4 ; physical drive 40.0 goes forwards** M569 P0.0 S0 ; physical drive 0.0 goes forwards M569 P0.1 S0 ; physical drive 0.1 goes forwards M569 P0.3 S1 ; physical drive 0.3 goes forwards M569 P0.4 S0 ; physical drive 0.4 goes forwards M584 X0.0 Y0.1 Z40.0 E0.3:0.4 ; set drive mapping M350 Z256 I0 ; configure microstepping without interpolation M350 X16 Y16 E16:16 I1 ; configure microstepping with interpolation M92 X80.35 Y80.75 Z1287.00 E140:440 ; set steps per mm M566 X900.00 Y900.00 Z600.00 E120.00:120 ; set maximum instantaneous speed changes (mm/min) M203 X10000.00 Y10000.00 Z10000.00 E1200.00:1200.00 ; set maximum speeds (mm/min) M906 X1000 Y1000 Z3500 E800:800 I40 ; set motor currents (mA) and motor idle factor in per cent M201 X3000.00 Y3000.00 Z3100.00 E2500.00:2500.00 ; set accelerations (mm/s^2) M84 S10 ; Set idle timeout
Now I've reached the point that the 1HCL card is able to communicate with both encoders and by executing the M122 B40 command I can get this information.
M122 B40 Diagnostics for board 40: Duet EXP1HCL firmware version 3.5.0-beta.3 (2023-04-14 13:08:48) Bootloader ID: SAME5x bootloader version 2.4 (2021-12-10) All averaging filters OK Never used RAM 23536, free system stack 184 words Tasks: EncCal(nWait,0.0%,474) Move(nWait,0.0%,156) HEAT(nWait,0.0%,82) CanAsync(nWait,0.0%,63) CanRecv(nWait,0.0%,77) CanClock(nWait,0.0%,70) TMC(nWait,55.4%,334) CLSend(nWait,0.0%,152) MAIN(running,42.6%,271) IDLE(ready,0.0%,29) AIN(nWait,2.0%,267), total 100.0% Last reset 00:32:15 ago, cause: power up Last software reset data not available Closed loop enabled: yes, pre-error threshold: 2.00, error threshold: 4.00, encoder type linearComposite, position 0 Shaft: Encoder reverse polarity: yes, full rotations 0, last angle 1187, minCorrection=-8.4, maxCorrection=10.9, agc 0, mag 4750, no error Lin: Encoder reverse polarity: no, raw count 0 Tuning mode: 0, tuning error: 0x1, collecting data: no Control loop runtime (us): min=5, max=36, frequency (Hz): min=8721, max=16667 Driver 0: pos 0, 1287.0 steps/mm,not tuned/calibrated, SG min n/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 -6/7, peak Rx sync delay 203, resyncs 0/0, next timer interrupt due in 20 ticks, enabled, next step interrupt due in 2843319205 ticks, disabled VIN voltage: min 24.2, current 24.2, max 24.2 V12 voltage: min 12.1, current 12.2, max 12.2 MCU temperature: min 18.9C, current 26.9C, max 26.9C Last sensors broadcast 0x00000030 found 2 75 ticks ago, 0 ordering errs, loop time 0 CAN messages queued 23249, send timeouts 0, received 17425, lost 0, free buffers 37, min 37, error reg 0 dup 0, oos 0/0/0/0, bm 0, wbm 0, rxMotionDelay 0 Accelerometer: none I2C bus errors 12, naks 0, other errors 0
The only problem is that now the Z axis motor stops once the machine zero key has been pressed, it does not move and it does not perform the Homing procedure.
Can anyone help me?
P.S.
Version of firmware -
-
Does the axis move if you set the motor to open loop mode?
-
Have you run the magnetic encoder calibration procedure for the shaft encoder? See item 2 in the table at https://docs.duet3d.com/User_manual/Tuning/Duet_3_1HCL_tuning#runtime-tuning.
-
-
- Yes
- Yes, I did this yesterday when I was trying to run just the Duet encoder motor on the shaft without the MSR5000 (M569.1 T3)
If I try now this is the result.
21/5/2023, 16:47:02: M596.6 P40.0 V1: Warning: M596.6: Command is not supported 21/5/2023, 16:47:05: M596.6 P40.0 V2: Warning: M596.6: Command is not supported
-
@Italiano85 I tried restarting the printer and entering the code M569.6 P40.0 V2 I got this response.
21/5/2023, 16:51:33 M569.6 P40.0 V2 Error: M569.6: Drive is not enabled 21/5/2023, 16:51:29 M569.6 P40.0 V1 Error: M569.6: Drive is not enabled
Then I tried to press the Home button which just blocked the engine, then I tried to send the command M569.6 P40.0 V2
within a few seconds the printer started to calibrate the axis and once finished it sent the Z axis carriage at full speed in the opposite homing direction.
I had to press the emergency button.
-
@Italiano85 @dc42
After many tests, and having found a calibration for the nema 23 motor, I managed to make the calibrations with two separate macro files.Macro 1
M569 P40.0 D0 M98 P"homez.g" G4 S2 G1 Z100 F2000 M569.1 P40.0 T3 R30 I2000 D0 E2:4 M569 P40.0 D4 G4 S2 M569.6 P40.0 V2
Macro 1 does the calibration only with the magnetic encoder on the shaft, and is successful with this result:
Driver 40.0 calibration succeeded, measured backlash is 0.135 step Original encoder reading errors: min -13.1, max 15.2, rms 6.4 Corrections made: min -8.9, max 10.9, rms 6.2
Macro 2 which calibrates the direction of the linear encoder is successful with the result attached below, but as soon as I have finished the calibrations and I try to move the Z axis the machine goes out of control, making jerky movements.
Macro 2
M569 P40.0 D0 M98 P"homez.g" G4 S2 G90 G1 Z100 F500 M569.1 P40.0 T1 C2000 R30 I2000 D0 E2:4 M569 P40.0 D4 G4 S2 M569.6 P40.0 V1 G1 Z0
Result
M98 P"0:/macros/T1_LREnc" Driver 40.0 basic tuning succeeded, measured backlash 0.509 step
Test Result
Diagnostics for board 40: Duet EXP1HCL firmware version 3.5.0-beta.3 (2023-04-14 13:08:48) Bootloader ID: SAME5x bootloader version 2.4 (2021-12-10) All averaging filters OK Never used RAM 23536, free system stack 184 words Tasks: EncCal(nWait,0.0%,474) Move(nWait,0.0%,156) HEAT(nWait,0.0%,82) CanAsync(nWait,0.0%,63) CanRecv(nWait,0.0%,77) CanClock(nWait,0.0%,70) TMC(nWait,58.9%,336) CLSend(nWait,0.0%,152) MAIN(running,39.3%,271) IDLE(ready,0.1%,29) AIN(nWait,1.7%,267), total 100.0% Last reset 00:20:53 ago, cause: power up Last software reset data not available Closed loop enabled: yes, pre-error threshold: 2.00, error threshold: 4.00, encoder type linearComposite, position -155 Shaft: Encoder reverse polarity: yes, full rotations -1, last angle 12012, minCorrection=-8.9, maxCorrection=10.9, agc 0, mag 4757, no error Lin: Encoder reverse polarity: yes, raw count 155 Tuning mode: 0, tuning error: 0, collecting data: no Control loop runtime (us): min=6, max=44, frequency (Hz): min=8523, max=16304 Driver 0: pos 0, 80.3 steps/mm,position tolerance exceededMoves 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 -6/5, peak Rx sync delay 223, resyncs 0/0, next timer interrupt due in 7 ticks, enabled, next step interrupt due in 3354668361 ticks, disabled VIN voltage: min 24.2, current 24.2, max 24.2 V12 voltage: min 12.1, current 12.2, max 12.2 MCU temperature: min 28.4C, current 29.0C, max 29.2C Last sensors broadcast 0x00000030 found 2 18 ticks ago, 0 ordering errs, loop time 0 CAN messages queued 15066, send timeouts 0, received 11287, lost 0, free buffers 37, min 37, error reg 0 dup 0, oos 0/0/0/0, bm 0, wbm 0, rxMotionDelay 0 Accelerometer: none I2C bus errors 12, naks 0, other errors 0
Anyone have any suggestions?
-
@Italiano85 please try running using the magnetic encoder only, to see whether the magnetic encoder calibration. You can leave the linear encoder connected, just change the encoder mode in the M569.1 command from T1 to T3.
Which firmware version are you running, on the main board and on the 1HCL boards?
-
Used Firmware
Calibration result T3 only
M98 P"0:/macros/T3_REnc" Driver 40.0 calibration succeeded, measured backlash is 0.138 step Original encoder reading errors: min -14.4, max 14.5, rms 6.0 Corrections made: min -8.4, max 9.3, rms 5.7
1HCL board diagnostics
m122 b40 Diagnostics for board 40: Duet EXP1HCL firmware version 3.5.0-beta.3 (2023-04-14 13:08:48) Bootloader ID: SAME5x bootloader version 2.4 (2021-12-10) All averaging filters OK Never used RAM 23392, free system stack 178 words Tasks: EncCal(nWait,0.7%,184) Move(nWait,0.0%,115) HEAT(nWait,0.0%,82) CanAsync(nWait,0.0%,63) CanRecv(nWait,0.0%,43) CanClock(nWait,0.0%,70) TMC(nWait,57.0%,318) CLSend(nWait,0.0%,152) MAIN(running,40.3%,289) IDLE(ready,0.3%,29) AIN(nWait,1.8%,267), total 100.0% Last reset 00:01:31 ago, cause: power up Last software reset data not available Closed loop enabled: yes, pre-error threshold: 2.00, error threshold: 4.00, encoder type rotaryAS5047, position 11552 Encoder reverse polarity: yes, full rotations 0, last angle 11552, minCorrection=-8.4, maxCorrection=9.3, agc 0, mag 4757, no error Tuning mode: 0, tuning error: 0, collecting data: no Control loop runtime (us): min=4, max=40, frequency (Hz): min=5137, max=17442 Driver 0: pos -21438, 80.3 steps/mm,ok, SG min 0, mspos 520, reads 36075, writes 13503 timeouts 0, steps req 3 done 161Moves scheduled 7, completed 7, in progress 0, hiccups 0, step errors 0, maxPrep 17, maxOverdue 0, maxInc 0, mcErrs 0, gcmErrs 0 Peak sync jitter -4/6, peak Rx sync delay 219, resyncs 0/0, next timer interrupt due in 11 ticks, enabled, next step interrupt due in 4269949897 ticks, disabled VIN voltage: min 24.1, current 24.2, max 24.2 V12 voltage: min 12.1, current 12.2, max 12.2 MCU temperature: min 20.2C, current 24.0C, max 24.2C Last sensors broadcast 0x00000030 found 2 38 ticks ago, 0 ordering errs, loop time 0 CAN messages queued 1292, send timeouts 0, received 1008, lost 0, free buffers 37, min 37, error reg 0 dup 0, oos 0/0/0/0, bm 0, wbm 0, rxMotionDelay 285, adv 37081/37199 Accelerometer: none I2C bus errors 12, naks 0, other errors 0
In T3 mode with only one encoder it works, where could be the problem?
-
This post is deleted! -
@Italiano85 said in Problem with Duet3D 1HCL+Duet3D Magnetic encoder V0.3+MSR5000:
M569.1 P40.0 T1 C2000 R30 I2000 D0 E2:4
- Set the I term to zero until you have movement working. An excessively large I term can cause instability.
- How did you determine that C2000 was the correct value?
-
- OK,i had pulled that value there from the closed loop plugin by running the autotune
- I put that value there because the numbers close to 2000 ± (~50)
they work, others give errors
Error: Driver 40.0 basic tuning failed, the measured motion was more than expected, measured counts/rev is about 1963.4 Warning: Driver 40.0 warning: tuning/calibration failed
With the value I=500 now it seems that it works, in these days I will try to find the best calibration.
I'll keep it updated.
Thanks a lot for your support.
-
@dc42 ;
I have another question to ask, if I wanted to activate the brake of the 1HCL board so that when the motor moves it is deactivated and when the motor stops in a position of the Z axis an electromagnet along the carriage is activated, it is possible to do it using the config file?
The way the 1HCL is currently configured the 24V always goes out even when the engine is running, so I can't use it.
; Drives M569.1 P40.0 T1 R30 I50 D0 E2:4 C1985 M569.7 P40.0 C"out0" S500 M569 P40.0 S1 D4 ; physical drive 40.0 goes forwards
-
@Italiano85 said in Problem with Duet3D 1HCL+Duet3D Magnetic encoder V0.3+MSR5000:
I have another question to ask, if I wanted to activate the brake of the 1HCL board so that when the motor moves it is deactivated and when the motor stops in a position of the Z axis an electromagnet along the carriage is activated, it is possible to do it using the config file?
The brake solenoid will be automatically activated (to release the brake) when you enable the motor either by using M17 or implicitly by commanding movement, and automatically deactivated (to engage the brake) when you use M18 or M84 to turn off the driver. There is no facility to engage the brake simply because the motor stops moving; but you should not need to do that because the motor should hold position, if in open loop mode you have a suitable standstill current fraction, and in closed loop mode you have a suitable I parameter in the M569 command I typically use 200).
BTW we have substantial improvements coming to the 1HCL firmware in 3.5beta4.