Servo Alarm Wiring and Coding
-
I'm using some Teknic servos with my Duet 6XD and have the alarm wires connected to a 3HC expansion board. The reason I have it wired this way is because of the way the Teknic servos output their alarm signal. It's not truly an alarm wire, it's referred to as a HLFB or "High level feed back" wire that can do various complicated things I, however, have it configured to switch on/off when the servo is enabled or disabled. If the servo is over-torqued, or misses steps, it will shut down for safety and become "disabled". This is the only useful configuration of the HLFB connection with regard to interfacing with a Duet. Because of it's functionality, I cannot simply connect it to the error pin on the 6XD, as the Duet firmware assumes the state of the pin is "OK" on startup (In which the Teknic servo is outputting a signal that states the motor is disabled, but not in shutdown) so when the servos become "enabled" the Duet firmware takes that switched signal as a driver error because it has now changed states. To combat this communication conflict, I have it configured as follows:
section of config.g
M950 J16 C"^121.io0.in" ; assign input for X HLFB+ M950 J17 C"^6.io0.in" ; assign input for Y1 HLFB+ M950 J18 C"^6.io1.in" ; assign input for Y2 HLFB+ M950 J19 C"^6.io2.in" ; assign input for Z1 HLFB+ M950 J20 C"^6.io3.in" ; assign input for Z2 HLFB+ M950 J21 C"^6.io4.in" ; assign input for Z3 HLFB+ M950 J22 C"^6.io5.in" ; assign input for Z4 HLFB+ M581 P16:17:18:19:20:21:22 T2 S0 R1 ; configure external trigger 2, active to inactive, when printing
trigger2.g
; this only exists b/c I had to use an additional 3HC to connect the HLFB outputs becasue the teknic motors only indicate servo enable & not in shutdown, and currently the firmware assumes the startup state of the error pin ; is NOT in an error state, so when the servo enables, the duet thinks it's an error. ; config.g configures the 7 servo HLFB pins and associates them with this trigger. ; the below code will check the status of the io.in pins and artifically raise a driver-error event for the coorospoinding servo ; servo enabled + not in shutdown = 0 ; servo disabled | in shutdown = 1 if sensors.gpIn[16].value == 0 ; if x servo is disabled or in shutdown M957 E"driver-error" D0 B121 ; raise driver error event, driver 0, CAN 121, P??? if sensors.gpIn[17].value == 0 ; if Y1 servo is disabled or in shutdown M957 E"driver-error" D0 B0 ; raise driver error event, driver 0, CAN 0, P??? if sensors.gpIn[18].value == 0 ; if Y2 servo is disabled or in shutdown M957 E"driver-error" D1 B0 ; raise driver error event, driver 1, CAN 0, P??? if sensors.gpIn[19].value == 0 ; if Z1 servo is disabled or in shutdown M957 E"driver-error" D2 B0 ; raise driver error event, driver 2, CAN 0, P??? if sensors.gpIn[20].value == 0 ; if Z2 servo is disabled or in shutdown M957 E"driver-error" D3 B0 ; raise driver error event, driver 3, CAN 0, P??? if sensors.gpIn[21].value == 0 ; if Z3 servo is disabled or in shutdown M957 E"driver-error" D4 B0 ; raise driver error event, driver 4, CAN 0, P??? if sensors.gpIn[22].value == 0 ; if Z4 servo is disabled or in shutdown M957 E"driver-error" D5 B0 ; raise driver error event, driver 5, CAN 0, P???
This wiring scheme and code only sort of works. If something is being printed and a servo goes into shutdown, the trigger works and the print is paused. However, I have discovered an issue with this method, if something is NOT being printed, but the user is manually jogging an axis, homing an axis, etc. The shutdown signal is ignored. Does anyone here have a recommendation for how it could work in non-printing moves as well?
Thank you!
-
@p8blr I think it's because you have the trigger definition in M581 with R1 parameter. Change it to R0. From Gcode dictionary:
https://docs.duet3d.com/en/User_manual/Reference/Gcodes#m581-configure-external-triggerR Condition: whether to trigger at any time (R0, default), only when printing a file from SD card (R1), or only when not printing a file from SD card (R2, supported in RRF 3.2 and later). R-1 temporarily disables the trigger.
Ian
-
@droftarts Thank you for your reply. I should have added more details; the reason I don't have the R parameter set to 0 is that I don't want to trigger a driver error just because the servo gets disabled. For example, I have safety switches on the printer doors that cut power to the servos when the doors are opened. So I suppose that I really only want the driver error to occur when a movement is commanded, but the servo is not enabled.
Thanks!