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

    Reporting Current 1HCL Encoder Count and Position Error Flag

    Scheduled Pinned Locked Moved Unsolved
    Duet Hardware and wiring
    2
    2
    122
    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.
    • davidjryanundefined
      davidjryan
      last edited by davidjryan

      I have a non-printer application that consists of a Duet 6HC in CNC mode with 3 3HC boards, and 3 1HCL boards over CAN. All boards and DWC are at firmware 3.5.1

      For my initial testing of closed loop mode, I have a NEMA 17 with quadrature encoder connected to one of the 1HCL boards.
      Everything wired up and tuned out just fine. When I force a position error by holding the motor shaft while performing a move, I get this in DWC:

      5/28/2024, 10:07:40 AM         Warning: Driver 50.0 warning: position tolerance exceeded
      

      I also get this when I go to far with the error:

      Event notification
      Driver 50.0 error: failed to maintain position
      

      So, all is well on the setup and wiring front. I can run open loop and closed loop modes without issue.

      Our system is in SBC mode with a Pi 5 running the latest Duet Bookworm image.
      We have a Python app on the Pi using dsf to communicate to the Duet. It is displaying information and performing control similar to DWC. We are using the app because we don't want to give our users as much control/access as DWC. We are reading the object model every half second or so (we are working on implementing the "subscription" method of reporting changes only through dsf).

      M122 B50 reports (edited to just show up to the "pos" value...):

      5/28/2024, 10:07:46 AM	M122 B50
      Diagnostics for board 50:
      Duet EXP1HCL rev 1.0a or earlier firmware version 3.5.1 (2024-04-19 14:42:46)
      Bootloader ID: SAME5x bootloader version 2.8 (2023-07-25)
      All averaging filters OK
      Never used RAM 75428, free system stack 184 words
      Tasks: Move(3,nWait 7,0.0%,108) CLSend(3,nWait 6,0.0%,148) HEAT(2,nWait 6,0.0%,106) CanAsync(5,nWait 4,0.0%,67) 
      Driver 0: pos -15976, 80.0 steps/mm, ok, SG min n/a, mspos 8, reads 21606, writes 21606 timeouts 0, steps req 0 done 0
      

      Running the motor a quarter turn or so and another M122 B50 reports:

      5/28/2024, 10:08:16 AM	M122 B50
      Diagnostics for board 50:
      Duet EXP1HCL rev 1.0a or earlier firmware version 3.5.1 (2024-04-19 14:42:46)
      Bootloader ID: SAME5x bootloader version 2.8 (2023-07-25)
      All averaging filters OK
      Never used RAM 75428, free system stack 184 words
      Driver 0: pos -11988, 80.0 steps/mm, ok, SG min n/a, mspos 8, reads 43734, writes 43736 timeouts 0, steps req 0 done 0
      

      I found these additions in the object model when I added the 1HCLs and enabled closed-loop mode:
      3d497951-17e7-4590-9943-f9149e90854b-image.png

      I see a few of the values update in real time, but there is no "latch" when a warning or error occurs.
      I couldn't find the pos value anywhere nor a latched boolean signifying the position warning or error.

      I'm currently monitoring those values in the python code and then latching my own bit to "remember" the fault.

      My questions:
      How do I get the "pos" value, either in G-code or from dsf call? I.e., -15976 and -11988 from the above snippets
      How do I detect the warning and/or error that is generated when the encoder error exceeds the values set in config.g? I.e., the warning and error messages above

      I saw this in the wishlist:
      https://forum.duet3d.com/topic/34183/implement-m593-3-read-motor-driver-encoder-in-the-1hcl?_=1716905999470
      So, I've added my voice for the feature.

      dc42undefined 1 Reply Last reply Reply Quote 0
      • davidjryanundefined davidjryan marked this topic as a question
      • dc42undefined
        dc42 administrators @davidjryan
        last edited by dc42

        @davidjryan I realise this is a very late response; however the motor position will be available in the object model in release 3.6.0, which we expect to release within the next few days.

        The position warning and error detection can be captured by an event handler macro. See https://docs.duet3d.com/en/User_manual/RepRapFirmware/Events.

        Duet WiFi hardware designer and firmware engineer
        Please do not ask me for Duet support via PM or email, use the forum
        http://www.escher3d.com, https://miscsolutions.wordpress.com

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