Code Monkey home page Code Monkey logo

mks-servo57d's People

Contributors

makerbase-motor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mks-servo57d's Issues

Using CAN version with ESP32

I've been trying to use MKS SERVO42_CAN with an ESP32 but no ideia why I'm getting no response back. It looks like the commands are making to MKS, but not sure whether or not it was sent correctly.

I'm using the lib arduino-CAN.

Here it is the code I've been using:

#include <CAN.h>

#define SERVO_RX_PIN 16
#define SERVO_TX_PIN 17

void setup() {
  CAN.setPins(SERVO_RX_PIN, SERVO_TX_PIN);

  // start the CAN bus at 500 kbps
  if (!CAN.begin(500E3)) {
    Serial.println("Starting CAN failed!");
    while (1)
      ;
  } else {
    Serial.println("CAN Initialized");
  }

  Serial.begin(115200);
  while (!Serial) {
    ;  // wait for serial port to connect. Needed for native USB port only
  }
  delay(3000);
}

void loop() {
  sendCommand();
  readResponse();

  delay(1000);
}

void sendCommand() {
  // CAN.beginPacket(1);  // CAN ID
  
  CAN.beginPacket(1, 2, false);  // CAN ID, DLC, RTR
  CAN.write(0x30);               // function code
  CAN.write(0x31);               // CRC
  CAN.endPacket();
}

void readResponse() {
  unsigned long sTime;  //timing start time

  sTime = millis();  //get the current moment
  while (1) {
    // try to parse packet
    int packetSize = CAN.parsePacket();

    if (packetSize) {
      // received a packet
      Serial.print("Received ");

      if (CAN.packetExtended()) {
        Serial.print("extended ");
      }

      if (CAN.packetRtr()) {
        // Remote transmission request, packet contains no data
        Serial.print("RTR ");
      }

      Serial.print("packet with id 0x");
      Serial.print(CAN.packetId(), HEX);

      if (CAN.packetRtr()) {
        Serial.print(" and requested length ");
        Serial.println(CAN.packetDlc());
      } else {
        Serial.print(" and length ");
        Serial.println(packetSize);

        // only print packet data for non-RTR packets
        while (CAN.available()) {
          Serial.print((char)CAN.read());
        }
        Serial.println();
      }

      Serial.println();
    }

    if ((millis() - sTime) > 2000) {  //Judging whether to time out
      break;                          //timeout, exit while(1)
    }
  }
}

I appreciate any guidance.

If CanRSP is enabled, Clear speed mode parameter command have undocumented response

Clear Speed mode command is sent (0xff, 0xca) the motor at first send response with data 0xff, 0x1 = Succes, which is OK.

But only when CanRSP is enabled, there is another can message with data 0xff, 0x2 which is not documented and it probably means Speed mode stop.

And now I see, the undocumented message is also sent when Save speed mode parameter is called. #4

Modbus programs

Can you please add to this repository the modbus programs you published on Baidu please?

Firmware update

Why aren't you providing the firmware updates? I understand you may not want to share the code but can't you at least provide the compiled code so we can update the firmware?

Motor Running Current

Hi, Can you please add motor current to the modbus so we can get the motor running current. Thanks

Changing PID Parameters?

Is it possible to change the position loops PID parameters? The previous S42C had a control tool available able to do this.

Can-bus command Table

is there a Documentation for all usable Can commands as a table?
It is cumbersome to extract them from the manual

Is the software open source?

Is this project open source?
Are there plans to upload the source code here?
Can you supply links to an appropriate toolchain for the NATION controller and means to up/download software?
Regards,
Wolf

RS485 communication commands

hi, i have 1.0.5 version of rs485 and i am having issues with responses.
i can calibrate the motor read the encoder and do all sort of things but when i try to move it in position mode or read the motor status i get half a response for example:
01 10 00 F5 00 04 08 00 64 00 00 00 00 00 00
returns:
01 10 00
thats it.

and when i try to read motor status:
01 04 00 F1 00 01
i get
01 04 00

please advise how to proceed

Stall error and motor status not working properly

I have Mks servo 57D 1.0.4. Microstepping is set 16. Lock protection is enabled. Mplyer option is disabled. CanRSP is disabled. Motor mode SR_VFOC.

Test case:

  • max current set to 500
  • I send relative motion by pulses with speed=1000
  • I am continuously reading status of motor until it responds with Stopped state or until stall error is set on OUT_1.

What happens:
The motor is not able to fullfill the speed, is rotating on slower speed and the shaft angle error gradually increases. The stall indication error is not indicated and moreover, the motor is still moving even when the status returned is 1 = motor stop.

What should happen:
I think that from very big shaft error for a long time, Stall Error should be set and the status should never return stopped state when the motor is in fact still moving.

With slower speed or higher current, when the motor is able to follow the speed, everything work as expected, but would be nice to have stall indication to be more strict when the speed is for example manually changed by holding the shaft for some time.

Create mode: Synchronized Position Control

Is this a new feature request or can you please provide an example of this with existing capability?

Allow writing a CAN object "motor group".

Only allow two or three motors per group to limit CAN traffic.

If motors belong to the same group, one motor becomes "leader" and transmits its axis position to "follower" motors in the same motor group.

Write config to one motor in the group leader and the rest followers.

If a motor is assigned follower, the motors must synchronize their position with the leader at all times. If they fail, they must tell the leader.

Allow sending position command to the leader motor in any individual group, and the follower motors will automatically follow the leader but be very close to identical position.

Is there a better way to do this?

Reverse Lookup Error with 17Ohm Motor

Closed loop with the same MKS-SERVO57D works fine with <10Ohm motor (coil resistance) but calibration fails with 17Ohm motor with "Reverse Lookup Error". Open loop with the 17Ohm motor works as well. While I'm aware the manual states "Note: The motor internal resistance should be less than 10 ohms.", I don't quite get how the calibration of the sensor depends on it, given that open loop stepping works fine and the motor does move back and forth during the calibration procedure. Has anyone more information about the cause of the error (manual just says "check the shaft") or the <10Ohm limitation?

Save parameter in speed mode stops the speed mode

I find it little strange, that if you want to use speed mode after power up, you have to actually run the motor in speed mode and then call Save (0xff, 0xc8). But calling save also stops the motor!

It would be maybe better to either:

  • have command Save speed mode contain all params of speed mode (dir, speed, ...) - so you can save it without running it
  • not to stop the motor with Save command

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.