Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Configuring Teknic Servo HLFB as Error Pin on Duet 6XD and 1XD

    Scheduled Pinned Locked Moved
    Duet Hardware and wiring
    2
    4
    165
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • p8blrundefined
      p8blr
      last edited by

      I have some Teknic CPM-SDHP-3446P-ELN motors and a combination of Duet 6XDs and 1XDs and I'm trying to make the HLFB wire from the servo signal the duet to pause a print if the motors over-torque or lose steps.

      How exactly would I set this up? It appears that the servo can be wired multiple ways.

      Also, what is the name of the event trigger and how would that work? The HLFB conducts when the motor is enabled and not in a shutdown state, which may not necessarily mean that the motor is in an error state, it might just not be enabled yet so maybe I would code something like this?

      config.g

      ; driver 0-5 error inputs are not configured in config.g
      M950 J4 C"!^40.io0.in" ; create input pin number 4 on 1XD board at CAN address 40 for servo error
      M581 P4 S0 T3 R1 ; invoke trigger 3 when an active-to-inactive edge is detected on input 4 and a file is being printed from SD card
      

      driver0-error.g

      if driver0 == "enabled"  ; not sure what variable to use here to see if axis was commanded to be enabled
         M25  ; pause print
         echo "Cannot move servo 0. Servo may be in a fault state"
      

      trigger3.g

      if driver6 == "enabled"  ; not sure what variable to use here to see if axis was commanded to be enabled
         M25  ; pause print
         echo "Cannot move servo 6. Servo may be in a fault state"
      

      From the manual:
      hlfb sinking.png
      hlfb sourcing.png
      hlfb current.png
      mode.png

      p8blrundefined 1 Reply Last reply Reply Quote 0
      • p8blrundefined
        p8blr @p8blr
        last edited by p8blr

        @p8blr From what I've discovered, the duet firmware assumes the state of the error pin on startup is "not an error", but the best you can configure the teknic motors to do is treat the HLFB wire as "enabled & not in shutdown" or "disabled or maybe in shutdown", and because the servos aren't enabled on startup, the duet's assumption will always be wrong. Until this is configurable by Duet or Teknic, this can't work.

        Here's my workaround: I added another expansion board!!! I wired the servos with the "sinking" output as Teknic recommends.

        in 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

        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???
        

        Any suggestions on improving the functionality? I've not created driver-error.g so the printer should just send a popup message in DWC and pause the print - which is essentially what I want when a servo goes into shutdown.

        Also what does the P parameter do in M957? I was reading through the Events documentation and all it says is "Lower 16 bits of driver status word" and I have no idea what that means.

        Thanks!

        droftartsundefined 1 Reply Last reply Reply Quote 0
        • droftartsundefined
          droftarts administrators @p8blr
          last edited by

          @p8blr I guess you don't want to enable the driver in config.g? If that's okay, you can enable it with M17, and set the error pin afterwards.

          I can't find a variable in the OM that says if a drive is enabled or disabled. I've asked @dc42 if there is one; if there isn't, we can probably get it added. If available, think it would be better to check this before raising a driver fault, like you did at first.

          Because M957 is usually used for testing the Events system, the P parameter allows you do inject the "Lower 16 bits of driver status word". This is usually reported automatically, though I'm not sure what it actually means, or how useful it is, either! I suspect it is more for internal drivers, and would return null for external drivers. I think this is only reported/useful when logging is enabled. I've updated the notes on the parameters in M957.

          Ian

          Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

          p8blrundefined 1 Reply Last reply Reply Quote 0
          • p8blrundefined
            p8blr @droftarts
            last edited by

            @droftarts I don't think I want to enable the servos on startup because then if the servos were ever disabled with a M18 for instance, that would trigger a driver-error because the HLFB wire would switch.

            Question about the M957 being used for testing, would it cause the printer to pause if sent during a print?

            Thanks

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Unless otherwise noted, all forum content is licensed under CC-BY-SA