From 7ce63b47b84da5c51539a5a3869db2eccf3e7e2a Mon Sep 17 00:00:00 2001 From: Tero K Date: Sun, 7 Dec 2014 17:22:57 +0200 Subject: Added params for Ioni --- simplemotion_defs.h | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/simplemotion_defs.h b/simplemotion_defs.h index c0a0e78..7892683 100644 --- a/simplemotion_defs.h +++ b/simplemotion_defs.h @@ -265,24 +265,31 @@ //flag bits & general #define SMP_DRIVE_FLAGS 567 //bitfield bits: - #define FLAG_DISABLED_AT_STARTUP BV(0) - #define FLAG_NO_DCBUS_FAULT BV(1) - #define FLAG_INVERT_ENCODER BV(3) - #define FLAG_INVERT_MOTOR_DIRECTION BV(4) /*invert positive direction*/ - #define FLAG_DISABLE_DEADTIMECORR_LO_SPEED BV(5) - #define FLAG_USE_PULSE_IN_ACCEL_LIMIT BV(7) - #define FLAG_2PHASE_AC_MOTOR BV(9) - #define FLAG_ALLOW_VOLTAGE_CLIPPING BV(10) - #define FLAG_USE_INPUT_LP_FILTER BV(11) - #define FLAG_USE_PID_CONTROLLER BV(12)//PIV is the default if bit is 0 - #define FLAG_INVERTED_HALLS BV(13) - #define FLAG_USE_HALLS BV(14) + #define FLAG_DISABLED_AT_STARTUP BV(0) + #define FLAG_NO_DCBUS_FAULT BV(1)/*obsolete?*/ + #define FLAG_ENABLE_DIR_INPUT_ON_ABS_SETPOINT BV(2) /*if 1, then use direction input signal for analog and PWM setpoint mode*/ + #define FLAG_INVERT_ENCODER BV(3) + #define FLAG_INVERT_MOTOR_DIRECTION BV(4) /*invert positive direction*/ + #define FLAG_ENABLE_REQUIRES_PULSING BV(5) /*enable signal must be fed 50hz-1khz toggling signal to validate enable status*/ + #define FLAG_USE_PULSE_IN_ACCEL_LIMIT BV(7)/*obsolete*/ + #define FLAG_2PHASE_AC_MOTOR BV(9)/*obsolete*/ + #define FLAG_ALLOW_VOLTAGE_CLIPPING BV(10) + #define FLAG_USE_INPUT_LP_FILTER BV(11) + #define FLAG_USE_PID_CONTROLLER BV(12)//PIV is the default if bit is 0/*obsolete*/ + #define FLAG_INVERTED_HALLS BV(13) + #define FLAG_USE_HALLS BV(14) #define FLAG_MECH_BRAKE_DURING_PHASING BV(15) #define SMP_MOTION_FAULT_THRESHOLD 568 #define SMP_HV_VOLTAGE_HI_LIMIT 569 #define SMP_HV_VOLTAGE_LOW_LIMIT 570 #define SMP_MOTOR_MAX_SPEED 572 +//in Ioni only +#define SMP_ELECTRICAL_MODE 573 + #define EL_MODE_STANDARD 0 + #define EL_MODE_IONICUBE 1 + #define EL_MODE_IONIZER 2 + //primary feedback loop 200-299 #define SMP_VEL_I 200 -- cgit v1.2.3 From d170e5a2879147453709d67061be12c60446c0df Mon Sep 17 00:00:00 2001 From: Tero K Date: Sun, 7 Dec 2014 17:47:17 +0200 Subject: Add SMP_ADDRESS_OFFSET=14 and sync with Ioni development --- simplemotion_defs.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/simplemotion_defs.h b/simplemotion_defs.h index 7892683..fb6cf6d 100644 --- a/simplemotion_defs.h +++ b/simplemotion_defs.h @@ -98,6 +98,8 @@ #define SMP_RETURN_PARAM_LEN 10 #define SMP_TIMEOUT 12 #define SMP_CUMULATIVE_STATUS 13 //error bits are set here if any, (SMP_CMD_STATUS_... bits). clear by writing 0 +#define SMP_ADDRESS_OFFSET 14 /*used to set or offset device address along physical method, i.e. DIP SW + offset to allow greater range of addresses than switch allows. */ + //bit mask #define SM_BUFCMD_STAT_IDLE 1 @@ -142,6 +144,7 @@ // continue to .. 200 + /* * List of motor control parameters. * @@ -231,15 +234,21 @@ //for drive internal use only: #define _MOTOR_LAST 7 + + + +//position follow error trip point +//velocity follow error trip point. units: velocity command (counts per PIDcycle * divider) + //#define CFG_INPUT_FILTER_LEN 30 #define SMP_CONTROL_MODE 559 //control mode choices: #define CM_TORQUE 3 #define CM_VELOCITY 2 #define CM_POSITION 1 + #define CM_NONE 0 #define SMP_INPUT_MULTIPLIER 560 #define SMP_INPUT_DIVIDER 561 -//setpoint source #define SMP_INPUT_REFERENCE_MODE 562 //choices: #define SMP_INPUT_REFERENCE_MODE_SERIALONLY 0 @@ -414,8 +423,9 @@ #define SMP_SCOPE_CHANNEL_SELECT 905 #define SMP_MECH_BRAKE_RELEASE_DELAY 910 -#define SMP_BRAKE_STOP_ENGAGE_DELAY 911 +#define SMP_MECH_BRAKE_ENGAGE_DELAY 911 #define SMP_DYNAMIC_BRAKING_SPEED 912 +#define SMP_BRAKE_STOP_ENGAGE_DELAY SMP_MECH_BRAKE_ENGAGE_DELAY /* SMP_BRAKE_STOP_ENGAGE_DELAY is old name, kept for compatibility*/ //////////////////////////////////////////////////////////////////////////////////RUNTIME PARAMS 5000-9999 -- cgit v1.2.3 From 6a57d137a8b382078ef5cafd8f38709c341952cf Mon Sep 17 00:00:00 2001 From: Tero Kontkanen Date: Mon, 8 Dec 2014 21:35:57 +0200 Subject: Added DFU mode parameters --- simplemotion_defs.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/simplemotion_defs.h b/simplemotion_defs.h index fb6cf6d..5a02cc2 100644 --- a/simplemotion_defs.h +++ b/simplemotion_defs.h @@ -88,6 +88,11 @@ #define SMP_NULL 0 #define SMP_NODE_ADDRSS 1 #define SMP_BUS_MODE 2 +//possible values: + #define SMP_BUS_MODE_DFU 0 + #define SMP_BUS_MODE_NORMAL 1 + #define _SMP_BUS_MODE_LAST 1 + #define SMP_SM_VERSION 3 #define SMP_SM_VERSION_COMPAT 4 #define SMP_BUS_SPEED 5 @@ -480,6 +485,7 @@ //#define RUNTIME_FEATURES1 6000 #define SMP_SERIAL_NR 6002 +#define SMP_UID_NR 6003 #define SMP_DRIVE_CAPABILITIES 6006 #define SMP_FIRMWARE_VERSION 6010 #define SMP_FIRMWARE_BACKWARDS_COMP_VERSION 6011 @@ -535,6 +541,8 @@ //bootloaded status #define SMP_BOOTLOADER_STAT 193 #define BOOTLOADER_STAT_FLASH_VERIFIED_OK BV(0) +#define SMP_BOOTLOADER_WRITE_OTP 194 + /*DFU Bootloader parameters end*/ -- cgit v1.2.3 From 4a8a19bb837bd615816030d99a2ee192f032bef3 Mon Sep 17 00:00:00 2001 From: Tero K Date: Thu, 11 Dec 2014 02:06:32 +0200 Subject: Add device temperature parameter --- simplemotion_defs.h | 1 + 1 file changed, 1 insertion(+) diff --git a/simplemotion_defs.h b/simplemotion_defs.h index fb6cf6d..c04e7b0 100644 --- a/simplemotion_defs.h +++ b/simplemotion_defs.h @@ -496,6 +496,7 @@ #define SMP_TORQUE_CMD_OVERRIDE 8001 #define SMP_OVERRIDE_COMMUTATION_FREQ 8003 #define SMP_OVERRIDE_REGENRES_DUTY 8004 +#define SMP_DEVICE_TEMPERATURE 8007//reported in 0.01 celsius steps /*IO side CPU sends encoder counter at index every time index is encountered. homing uses this info */ #define SMP_INDEX_PULSE_LOCATION 8005 -- cgit v1.2.3 From c06bbfd7ec3324751b5af7229e4bd85df72dfb23 Mon Sep 17 00:00:00 2001 From: Tero Kontkanen Date: Thu, 11 Dec 2014 14:45:22 +0200 Subject: add SMP_CURRENT_LIMITED_TO_MA 8008 (actual current limit (based on user settings, device temperature, voltage etc)) --- simplemotion_defs.h | 1 + 1 file changed, 1 insertion(+) diff --git a/simplemotion_defs.h b/simplemotion_defs.h index 1f9380e..267724d 100644 --- a/simplemotion_defs.h +++ b/simplemotion_defs.h @@ -503,6 +503,7 @@ #define SMP_OVERRIDE_COMMUTATION_FREQ 8003 #define SMP_OVERRIDE_REGENRES_DUTY 8004 #define SMP_DEVICE_TEMPERATURE 8007//reported in 0.01 celsius steps +#define SMP_CURRENT_LIMITED_TO_MA 8008//actual current limit (based on user settings, device temperature, voltage etc) /*IO side CPU sends encoder counter at index every time index is encountered. homing uses this info */ #define SMP_INDEX_PULSE_LOCATION 8005 -- cgit v1.2.3 From 64b2e70da82c4910fafda4ec63ce9e34eef3cb65 Mon Sep 17 00:00:00 2001 From: Tero Kontkanen Date: Thu, 11 Dec 2014 16:16:28 +0200 Subject: add SMP_CURRENT_LIMIT_REASON parameter --- simplemotion_defs.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/simplemotion_defs.h b/simplemotion_defs.h index 267724d..6ae11fe 100644 --- a/simplemotion_defs.h +++ b/simplemotion_defs.h @@ -504,6 +504,12 @@ #define SMP_OVERRIDE_REGENRES_DUTY 8004 #define SMP_DEVICE_TEMPERATURE 8007//reported in 0.01 celsius steps #define SMP_CURRENT_LIMITED_TO_MA 8008//actual current limit (based on user settings, device temperature, voltage etc) +#define SMP_CURRENT_LIMIT_REASON 8009 //last reason why current was clampled + #define CURR_LIMIT_REASON_NONE 0 + #define CURR_LIMIT_REASON_VOLTAGE_SATURATION 1 + #define CURR_LIMIT_REASON_SETTINGS 2 + #define CURR_LIMIT_REASON_I2T 3 + #define CURR_LIMIT_REASON_DRIVE_TEMPERATURE 4 /*IO side CPU sends encoder counter at index every time index is encountered. homing uses this info */ #define SMP_INDEX_PULSE_LOCATION 8005 -- cgit v1.2.3 From 6a6a9168979f045c95d1c65310fd8f03662ba7f3 Mon Sep 17 00:00:00 2001 From: Tero K Date: Sun, 14 Dec 2014 19:30:18 +0200 Subject: add SMP_FAULT_BEHAVIOR --- simplemotion_defs.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/simplemotion_defs.h b/simplemotion_defs.h index 6ae11fe..5c726e1 100644 --- a/simplemotion_defs.h +++ b/simplemotion_defs.h @@ -101,9 +101,21 @@ #define SMP_BUFFERED_CMD_PERIOD 8 #define SMP_RETURN_PARAM_ADDR 9 #define SMP_RETURN_PARAM_LEN 10 +/*SMP_TIMOUT defines how long device waits for one packet to transmit before discarding it. unit 0.1 milliseconds*/ #define SMP_TIMEOUT 12 #define SMP_CUMULATIVE_STATUS 13 //error bits are set here if any, (SMP_CMD_STATUS_... bits). clear by writing 0 #define SMP_ADDRESS_OFFSET 14 /*used to set or offset device address along physical method, i.e. DIP SW + offset to allow greater range of addresses than switch allows. */ +/* SMP_FAULT_BEHAVIOR defines maximum amount of time between to valid received SM packets to device and other SM + * fault behavior that affect drive operation. + * + * If comm is broken longer than watchdog time, drive will go fault stop state. + * Can be used for additional safety stop when drives are controlled only onver SM bus. + * + * -default value 0 means infinite time and also SM comm errors will not cause device faultstop + * -value 1 means that drive will have watchdog disabeld but will faultstop on any SM command error + * -values 2-99 reserved for future use + * -value >100 defines watchdog, it means drive fault stop on any SM command error or if no valid commands arrive within number of 0.1*millisconds. */ +#define SMP_FAULT_BEHAVIOR 15 //bit mask -- cgit v1.2.3 From 839c41ca408bd90207bfbf17a3712578ebd6f56b Mon Sep 17 00:00:00 2001 From: Tero K Date: Sun, 21 Dec 2014 02:15:19 +0200 Subject: 1) protocol image added 2) added clearer names for SM subpacket types --- doc/SMV2Protocol.svg | 643 +++++++++++++++++++++++++++++++++++++++++++++++++++ simplemotion_defs.h | 77 ++++-- 2 files changed, 705 insertions(+), 15 deletions(-) create mode 100644 doc/SMV2Protocol.svg diff --git a/doc/SMV2Protocol.svg b/doc/SMV2Protocol.svg new file mode 100644 index 0000000..8be482b --- /dev/null +++ b/doc/SMV2Protocol.svg @@ -0,0 +1,643 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + Subpacket 1 + 1 bytePackettype + 0 or 1 bytesNumber of payloadbytes unlessfixed lenght defined by packet type + 1 byteTarget deviceaddress 1-255 or 0 if broadcast to all devices + 0-120 bytesPayload datamade ofsubpackets + 2 byteCRC checksum + + + 2 bitssubpackettype andlenght + 6, 14, 22 or 30 bitsValue data(write / read valueof parameter) + Subpacket N + + + 2 bitssubpackettype andlenght + 6, 14, 22 or 30 bitsValue data(write / read valueof parameter) + . . . + + + SimpleMotion V2 outbound or inbound packet + + 3 - 125 bytes total + + Packet typesOutbound (host to devices):- execute payload subpackets instantly- place payload subpackets in buffer executed by timed fashion- get device clock value (used to sync buffered execution)Inbound (device to host)- Return data packets (one type for each outbound type), these contain payload data (read values) or clock value + + Subpacket typesOutbound- set parameter address where next values are written to, 2 bytes long- write parameter value, 3 or 4 bytes longInbound- SM bus status value, 1 byte long- read parameter value, 2, 3 or 4 bytes longEach outbound subpacket will give one inbound subpacket in return when devicesends the response to a SM packet. Content of inbound subpackets are defined bywritable parameters SMP_RETURN_PARAM_ADDR and SMP_RETURN_PARAM_LEN. + SimpleMotion V2 Protocol + + diff --git a/simplemotion_defs.h b/simplemotion_defs.h index 5c726e1..06810f2 100644 --- a/simplemotion_defs.h +++ b/simplemotion_defs.h @@ -32,14 +32,7 @@ #endif -//SMP command types -#define SMPCMD_SETPARAMADDR 2 -#define SMPCMD_24B 1 -#define SMPCMD_32B 0 -#define SMPRET_OTHER 3 -#define SMPRET_16B 2 -#define SMPRET_24B 1 -#define SMPRET_32B 0 + /* @@ -59,15 +52,69 @@ //mask for addresses #define SMP_ADDRESS_BITS_MASK 0x1FFF //E=1110 +/* + * SM payload command types and return value types. + */ //SMP packet header bits (2 bits). These determine content length and type -#define SMPCMD_SET_PARAM_ADDR 2 -#define SMPCMD_24B 1 -#define SMPCMD_32B 0 -#define SMPRET_CMD_STATUS 3 -#define SMPRET_16B 2 -#define SMPRET_24B 1 -#define SMPRET_32B 0 +#define SMPCMD_SETPARAMADDR 2 //Deprecated name, dont use these. Use new names seen below +#define SMPCMD_SET_PARAM_ADDR 2 //Deprecated name, dont use these. Use new names seen below +#define SMPCMD_24B 1 //Deprecated name, dont use these. Use new names seen below +#define SMPCMD_32B 0 //Deprecated name, dont use these. Use new names seen below +#define SMPRET_CMD_STATUS 3 //Deprecated name, dont use these. Use new names seen below +#define SMPRET_OTHER 3 //Deprecated name, dont use these. Use new names seen below +#define SMPRET_16B 2 //Deprecated name, dont use these. Use new names seen below +#define SMPRET_24B 1 //Deprecated name, dont use these. Use new names seen below +#define SMPRET_32B 0 //Deprecated name, dont use these. Use new names seen below + +// +//new naming for the above values (more clear meanings): +// + +//OUTBOUND SM COMMAND PAYLOAD SUBPACKET TYPES +//each SMCMD_INSTANT_CMD and SMCMD_BUFFERED_CMD payload is filled with subpackets of following types + //sets param address (one of SMP_ defines) where next written value goes to. + //consumes 2 bytes from payload buffer. + #define SM_SET_WRITE_ADDRESS 2 + //writes value to previously defined address. consumes 3 bytes (24 bits) from payload buffer. + //can hold value size up to 22 bits. bits above 22 are clipped (transmitted as 0s) + #define SM_WRITE_VALUE_24B 1 + //writes value to previously defined address. consumes 4 bytes (32 bits) from payload buffer. + //can hold value size up to 30 bits. bits above 30 are clipped (transmitted as 0s) + #define SM_WRITE_VALUE_32B 0 + +//INBOUND SM COMMAND PAYLOAD SUBPACKET TYPES +//each outbound subpacket will return one of these. the type and address what is being returned +//is defined by parameters SMP_RETURN_PARAM_ADDR and SMP_RETURN_PARAM_LEN + //return value contains SM bus status bits (possible faults etc). + //consumes 1 byte from payload buffer + #define SM_RETURN_STATUS 3 + //return value contains a read value from address defined by SMP_RETURN_PARAM_ADDR + //consumes 2 byte from payload buffer. can contain value up to 14 bits. value greater than 14 bits is clipped (padded with 0s) + #define SM_RETURN_VALUE_16B 2 + //return value contains a read value from address defined by SMP_RETURN_PARAM_ADDR + //consumes 3 byte from payload buffer. can contain value up to 14 bits. value greater than 22 bits is clipped (padded with 0s) + #define SM_RETURN_VALUE_24B 1 + //return value contains a read value from address defined by SMP_RETURN_PARAM_ADDR + //consumes 4 byte from payload buffer. can contain value up to 30 bits. value greater than 14 bits is clipped (padded with 0s) + #define SM_RETURN_VALUE_32B 0 + +/* subpacket format + * + * header: + * 2 bits packet type which defines also lenght of subpacket + * data: + * rest of subpacket contains the transmitted value + * + * example: + * SM_WRITE_VALUE_32B packet looks like this + * + * -2 first bits are 00 + * -next 30 bits carry the value + * + * SMV2 library takes care of forming subpackets so user only needs to care about using the macros above + * + */ //if command is to set param addr to this -> NOP #define SMP_ADDR_NOP 0x3fff -- cgit v1.2.3 From dd2e3f34221a6dce4740bdd42bb59fa6a6273ed5 Mon Sep 17 00:00:00 2001 From: Tero K Date: Mon, 12 Jan 2015 14:48:27 +0200 Subject: add SMP_POS_FF 222 --- simplemotion_defs.h | 1 + 1 file changed, 1 insertion(+) diff --git a/simplemotion_defs.h b/simplemotion_defs.h index 06810f2..c6275e5 100644 --- a/simplemotion_defs.h +++ b/simplemotion_defs.h @@ -370,6 +370,7 @@ #define SMP_VEL_P 202 #define SMP_VEL_FF 220 #define SMP_ACC_FF 221 +#define SMP_POS_FF 222 //anti dither limits #define SMP_ANTIDITHER_MODE 230 -- cgit v1.2.3 From d37c97b90b3b25088c9f951772b345f2907e4650 Mon Sep 17 00:00:00 2001 From: Tero K Date: Wed, 21 Jan 2015 00:39:25 +0200 Subject: add MOTOR_STEPPER_2PHA motor mode definition --- doc/SMV2Protocol.png | Bin 0 -> 490470 bytes simplemotion_defs.h | 2 ++ 2 files changed, 2 insertions(+) create mode 100644 doc/SMV2Protocol.png diff --git a/doc/SMV2Protocol.png b/doc/SMV2Protocol.png new file mode 100644 index 0000000..7325afc Binary files /dev/null and b/doc/SMV2Protocol.png differ diff --git a/simplemotion_defs.h b/simplemotion_defs.h index c6275e5..9f79663 100644 --- a/simplemotion_defs.h +++ b/simplemotion_defs.h @@ -295,6 +295,8 @@ #define MOTOR_AC_VECTOR_2PHA 2 /*2 phase ac or bldc */ //3 phase AC motor #define MOTOR_AC_VECTOR 3 /*3 phase ac or bldc */ + //2 phase stepper + #define MOTOR_STEPPER_2PHA 4 /*2 phase stepper */ //for drive internal use only: #define _MOTOR_LAST 7 -- cgit v1.2.3 From 4528fb57b364a3520b411627ec440e2d6e294fe1 Mon Sep 17 00:00:00 2001 From: Tero Kontkanen Date: Thu, 12 Feb 2015 01:35:49 +0200 Subject: add some documentation --- simplemotion_defs.h | 60 ++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 55 insertions(+), 5 deletions(-) diff --git a/simplemotion_defs.h b/simplemotion_defs.h index 9f79663..6282416 100644 --- a/simplemotion_defs.h +++ b/simplemotion_defs.h @@ -17,6 +17,51 @@ * 8191 NOP command. if SM command SMPCMD_SET_PARAM_ADDR with SMP_ADDR_NOP as parameter is sent, no actions are taken in nodes. it's NOP (no operation) command. */ +/* SMV2 protocol change log: + * Version 20: + * -V20 was introduced with Argon FW 1.0.0 and present at least until 1.4.0 + * Version 21 (is backwards compatible in syntax but not in setpoint behavior, see details below): + * -V25 was introduced with IONI + * -setpoint calculation is different: + * now there is only one common setpoint and all ABS and INC commands (buffered & instant) + * change the same variable. In V20 there was separate setpoint variables for each stream + * (instant & buffered) and for INC and ABS separately and finally all setpoints were summed together. + * Formula for total setpoint is = SMV2setpoint+OptionalPhysicalSetpoint (step/dir, analog etc) + * -in buffered stream, only setpoint commands execute on timed pace. all others execute as fast as possible. + * this makes it possible to insert any parameter read/write commands in middle of buffered motion. + * -implemented watchdog functionality in new param SMP_FAULT_BEHAVIOR + * -added param SMP_ADDRESS_OFFSET + */ + +/* Important when using SMV2 protocol: + * + * SMP_SM_VERSION_COMPAT defines the oldest SM bus version in which the current version is + * fully backwards compatible. If you write app that supports SM bus versions between N and M (i.e. N=20 M=25), + * then check that connected device complies with the test (pseudo code): + * + * + smuint32 NEWEST_SUPPORTED_SMV2_VERSION=M; + smuint32 OLDEST_SUPPORTED_SMV2_VERSION=N; + smuint32 smv2version=getParam(SMP_SM_VERSION); + smuint32 smv2compatversion=getParam(SMP_SM_COMPAT_VERSION); + + if(smv2version>NEWEST_SUPPORTED_SMV2_VERSION && smv2compatversion>NEWEST_SUPPORTED_SMV2_VERSION) + { + error("SimpleMotion protocol version too new, not supported by this software version. Check for upgrades. Connected SMV2 Version: " + smv2version); + return false; + } + if(smv2version100 defines watchdog, it means drive fault stop on any SM command error or if no valid commands arrive within number of 0.1*millisconds. */ + * Parameter is bit field: + * bit 0 (LSB): enable device fault stop on any SM comm error (CRC, invalid value etc) + * bits 1-7: reserved, always 0 + * bits 8-17: watchdog timeout value. nonzero enables watchdog. scale: 1 count=10ms, so allows 0.01-10.230 s delay. + * bits 18-32: reserved, always 0 + */ #define SMP_FAULT_BEHAVIOR 15 @@ -250,7 +300,7 @@ #define SMP_FIRST_FAULT 8115 #define SMP_STATUS 553 //bitfield bits: - #define STAT_POWER_ON BV(0) + #define STAT_RESERVED_ BV(0) #define STAT_TARGET_REACHED BV(1)//this is 1 when trajectory planner target reached #define STAT_FERROR_RECOVERY BV(2) #define STAT_RUN BV(3)//run is true only if motor is being actually driven. run=0 clears integrators etc -- cgit v1.2.3 From 2ab282e4b49d7a3db5328a214fc60e7f1da3b67a Mon Sep 17 00:00:00 2001 From: Tero K Date: Thu, 5 Mar 2015 02:27:18 +0200 Subject: added SMP_SYSTEM_CONTROL_RESTART_TO_DFU_MODE --- simplemotion_defs.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/simplemotion_defs.h b/simplemotion_defs.h index 6282416..7371fa7 100644 --- a/simplemotion_defs.h +++ b/simplemotion_defs.h @@ -327,6 +327,8 @@ #define SMP_SYSTEM_SAMPLE_TEST_VARIABLES 8 //production testing function #define SMP_SYSTEM_START_PRODUCTION_TEST 16 //production testing function #define SMP_SYSTEM_STOP_PRODUCTION_TEST 32 //production testing function + //restart device into DFU mode + #define SMP_SYSTEM_CONTROL_RESTART_TO_DFU_MODE 64 //follow error tolerance for position control: #define SMP_POS_FERROR_TRIP 555 -- cgit v1.2.3 From b907c318e62c6baaf02dcf867ccb0992a43cfdf3 Mon Sep 17 00:00:00 2001 From: Tero K Date: Sat, 7 Mar 2015 19:00:47 +0200 Subject: added SMP_SYSTEM_CONTROL_GET_FLAGS = 128 --- simplemotion_defs.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/simplemotion_defs.h b/simplemotion_defs.h index 7371fa7..252f991 100644 --- a/simplemotion_defs.h +++ b/simplemotion_defs.h @@ -329,6 +329,8 @@ #define SMP_SYSTEM_STOP_PRODUCTION_TEST 32 //production testing function //restart device into DFU mode #define SMP_SYSTEM_CONTROL_RESTART_TO_DFU_MODE 64 + //read miscellaneous device specific flag bits + #define SMP_SYSTEM_CONTROL_GET_FLAGS 128 //follow error tolerance for position control: #define SMP_POS_FERROR_TRIP 555 -- cgit v1.2.3 From 83005ef72921ff5c6f165637694437d84451bbaa Mon Sep 17 00:00:00 2001 From: Tero K Date: Mon, 9 Mar 2015 01:13:20 +0200 Subject: add SMP_CB2_START_HOMING --- simplemotion_defs.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/simplemotion_defs.h b/simplemotion_defs.h index 252f991..5968b7f 100644 --- a/simplemotion_defs.h +++ b/simplemotion_defs.h @@ -487,21 +487,23 @@ //bitfiled values: //CB1 & CB2 enables must be 1 to have drive enabled //Control bits 1 are controlled by host software - #define SMP_CB1_ENABLE BV(0) + #define SMP_CB1_ENABLE BV(0)//software enable #define SMP_CB1_CLEARFAULTS BV(1) - #define SMP_CB1_QUICKSTOP BV(2) - #define SMP_CB1_USE_TRAJPLANNER BV(3) + #define SMP_CB1_QUICKSTOP BV(2)//not implemented at the moment + #define SMP_CB1_USE_TRAJPLANNER BV(3)//not implemented at the moment + #define SMP_CB1_START_HOMING BV(4)//write 1 here to start homing //not implemented at the moment #define SMP_STATIC_CBS1 (SMP_CB1_ENABLE|SMP_CB1_USE_TRAJPLANNER) #define SMP_CONTROL_BITS2 2534 //bitfiled values: //both enables must be 1 to have drive enabled - //Control bits 2 are controlled by physical inputs - #define SMP_CB2_ENABLE BV(0) + //Control bits 2 are controlled by physical inputs, dont try to write on these thu SMV2. reading is ok + #define SMP_CB2_ENABLE BV(0)//hadrware enable pin #define SMP_CB2_ENA_POS_FEED BV(1) #define SMP_CB2_ENA_NEG_FEED BV(2) #define SMP_CB2_HOMESW_ON BV(3) #define SMP_CB2_CLEARFAULTS BV(4) + #define SMP_CB2_START_HOMING BV(5) //trajectory planner #define SMP_TRAJ_PLANNER_ACCEL 800 -- cgit v1.2.3 From d82010d72c0e379492ac49a47a498b88890568d6 Mon Sep 17 00:00:00 2001 From: Tero K Date: Tue, 14 Apr 2015 14:47:25 +0300 Subject: Add SMP_SYSTEM_CONTROL_MEASURE_MOTOR_RL --- simplemotion_defs.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/simplemotion_defs.h b/simplemotion_defs.h index 5968b7f..45bee87 100644 --- a/simplemotion_defs.h +++ b/simplemotion_defs.h @@ -331,6 +331,17 @@ #define SMP_SYSTEM_CONTROL_RESTART_TO_DFU_MODE 64 //read miscellaneous device specific flag bits #define SMP_SYSTEM_CONTROL_GET_FLAGS 128 + /*start measure motor RL function. + * poll debug param 5 for state + * -100 fail + * 700 busy + * 800 success -new RL values inserted in drive params + * + * SMP_STATUS must obey: + * requiredStats=STAT_INITIALIZED|STAT_RUN|STAT_ENABLED|STAT_VOLTAGES_OK; + deniedStats=STAT_FERROR_RECOVERY|STAT_PERMANENT_STOP|STAT_STO_ACTIVE|STAT_FAULTSTOP|STAT_HOMING; + */ + #define SMP_SYSTEM_CONTROL_MEASURE_MOTOR_RL 256 //follow error tolerance for position control: #define SMP_POS_FERROR_TRIP 555 -- cgit v1.2.3 From c194c8b12961a9d492a0b3de89a9470695c8ad70 Mon Sep 17 00:00:00 2001 From: Tero K Date: Sat, 25 Apr 2015 18:13:33 +0300 Subject: Defined feedback device choices --- simplemotion_defs.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/simplemotion_defs.h b/simplemotion_defs.h index 45bee87..3561b6f 100644 --- a/simplemotion_defs.h +++ b/simplemotion_defs.h @@ -478,7 +478,17 @@ #define SMP_AXIS_UNITS 492 //0=none 1=qei1 2=qei2 3=resolver 4=ssi 5=biss #define SMP_FB1_DEVICE_SELECTION 493 + #define SMP_FBD_NONE 0 + #define SMP_FBD_INCR1 1 + #define SMP_FBD_INCR2 2 + #define SMP_FBD_RESOLVER 3 + #define SMP_FBD_SSI 4 + #define SMP_FBD_BISS 5 + #define SMP_FBD_SINCOS16X 6 + #define SMP_FBD_SINCOS64X 7 + #define SMP_FBD_SINCOS256X 8 #define SMP_FB2_DEVICE_SELECTION 494 + //in 1/2500 seconds. #define SMP_GOAL_FAULT_FILTER_TIME 495 //in speed scale -- cgit v1.2.3 From 6c01ad9e90ac6352259f36531b645e657f932077 Mon Sep 17 00:00:00 2001 From: Tero K Date: Wed, 29 Apr 2015 13:30:16 +0300 Subject: Added SMP_SIMWHEEL_MODE parameter --- simplemotion_defs.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/simplemotion_defs.h b/simplemotion_defs.h index 3561b6f..eac01f8 100644 --- a/simplemotion_defs.h +++ b/simplemotion_defs.h @@ -571,6 +571,25 @@ #define SMP_DYNAMIC_BRAKING_SPEED 912 #define SMP_BRAKE_STOP_ENGAGE_DELAY SMP_MECH_BRAKE_ENGAGE_DELAY /* SMP_BRAKE_STOP_ENGAGE_DELAY is old name, kept for compatibility*/ +/*Racing simulator wheel torque control specific settings, currently IONI only. Values: + * 0 = disabled, standard drive operation + * nonzero = calculate value by: + * round(allowed_rotation_in_counts/100)*100 + mode + * + * where mode: + * 0=only rotation limit on + * 1=rotation limit and analog trimpot torque scaling on. Analog input 0-5V sets torque scale to 10-100% + * + * example 1: we want rotation limit of 8192 encoder counts (for each direction) and no scaling input, we + * use value 8200. + * + * example 2: we want rotation limit of 8192 encoder counts (for each direction) and torque + * command scaling input, we use value 8201 + * + * Tip: use Granity Ctrl+P (Shortcut) dialog to set value: + * http://granitedevices.com/wiki/Reading_and_writing_an_arbitrary_parameter_with_Granity + */ +#define SMP_SIMWHEEL_MODE 920 //////////////////////////////////////////////////////////////////////////////////RUNTIME PARAMS 5000-9999 -- cgit v1.2.3 From 5e1d1035cd3389f928c5e734ba6b18e075530c7c Mon Sep 17 00:00:00 2001 From: Tero K Date: Wed, 29 Apr 2015 13:36:18 +0300 Subject: Change name of SM_SIMWHEEL_MODE to SMP_TORQUE_MODE_ATTRIBUTES --- simplemotion_defs.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/simplemotion_defs.h b/simplemotion_defs.h index eac01f8..2eeed8f 100644 --- a/simplemotion_defs.h +++ b/simplemotion_defs.h @@ -571,14 +571,16 @@ #define SMP_DYNAMIC_BRAKING_SPEED 912 #define SMP_BRAKE_STOP_ENGAGE_DELAY SMP_MECH_BRAKE_ENGAGE_DELAY /* SMP_BRAKE_STOP_ENGAGE_DELAY is old name, kept for compatibility*/ -/*Racing simulator wheel torque control specific settings, currently IONI only. Values: +/*Special torque mode specific settings, currently IONI only. Values: * 0 = disabled, standard drive operation * nonzero = calculate value by: * round(allowed_rotation_in_counts/100)*100 + mode * * where mode: * 0=only rotation limit on - * 1=rotation limit and analog trimpot torque scaling on. Analog input 0-5V sets torque scale to 10-100% + * 1=rotation limit and analog trimpot torque scaling on. + * Analog input 0-5V sets torque scale to 10-100%. Note: cant use analog input for torque setpoint now. + * 2-99=reserved for future use * * example 1: we want rotation limit of 8192 encoder counts (for each direction) and no scaling input, we * use value 8200. @@ -589,7 +591,7 @@ * Tip: use Granity Ctrl+P (Shortcut) dialog to set value: * http://granitedevices.com/wiki/Reading_and_writing_an_arbitrary_parameter_with_Granity */ -#define SMP_SIMWHEEL_MODE 920 +#define SMP_TORQUE_MODE_ATTRIBUTES 920 //////////////////////////////////////////////////////////////////////////////////RUNTIME PARAMS 5000-9999 -- cgit v1.2.3 From 47eb82f2f17522b7cc37e7595866e7a42699ca83 Mon Sep 17 00:00:00 2001 From: Tero K Date: Wed, 29 Apr 2015 14:19:20 +0300 Subject: Update SMP_TORQUE_MODE_ATTRIBUTES specifications --- simplemotion_defs.h | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/simplemotion_defs.h b/simplemotion_defs.h index 2eeed8f..07b2164 100644 --- a/simplemotion_defs.h +++ b/simplemotion_defs.h @@ -571,25 +571,27 @@ #define SMP_DYNAMIC_BRAKING_SPEED 912 #define SMP_BRAKE_STOP_ENGAGE_DELAY SMP_MECH_BRAKE_ENGAGE_DELAY /* SMP_BRAKE_STOP_ENGAGE_DELAY is old name, kept for compatibility*/ -/*Special torque mode specific settings, currently IONI only. Values: +/*Special torque mode specific settings, currently IONI only. This paramterer is a bitfield + * defined as: bits 0-7: option bits, bits 8-29: rotation angle limit (in feedback counts). + * + * Guide: * 0 = disabled, standard drive operation - * nonzero = calculate value by: - * round(allowed_rotation_in_counts/100)*100 + mode + * nonzero = calculate value by: round(allowed_rotation_in_counts/256)*256 + modebits * - * where mode: - * 0=only rotation limit on - * 1=rotation limit and analog trimpot torque scaling on. - * Analog input 0-5V sets torque scale to 10-100%. Note: cant use analog input for torque setpoint now. - * 2-99=reserved for future use + * where modebits is a bitfield defined as: + * bit 0: input scaling. if true, analog input 0-5V sets torque scale to 10-100%. Note: cant use analog input for torque setpoint now. + * bits 1-7: reserved for future use. * - * example 1: we want rotation limit of 8192 encoder counts (for each direction) and no scaling input, we - * use value 8200. + * example 1: we want rotation limit of 8000 encoder counts (for each direction) and no scaling input, we + * use value 7936. * - * example 2: we want rotation limit of 8192 encoder counts (for each direction) and torque - * command scaling input, we use value 8201 + * example 2: we want rotation limit of 8000 encoder counts (for each direction) and torque + * command scaling input, we use value 7937 + + * example 3: no rotation limit but just saling is on: use value 1 * - * Tip: use Granity Ctrl+P (Shortcut) dialog to set value: - * http://granitedevices.com/wiki/Reading_and_writing_an_arbitrary_parameter_with_Granity + * Tip: use Granity Ctrl+P (Shortcut) dialog to set value: + * http://granitedevices.com/wiki/Reading_and_writing_an_arbitrary_parameter_with_Granity */ #define SMP_TORQUE_MODE_ATTRIBUTES 920 -- cgit v1.2.3 From cab877d673a59cd8610af34d8ac66a072d99293c Mon Sep 17 00:00:00 2001 From: Tero K Date: Tue, 20 Oct 2015 15:44:37 +0300 Subject: Added first order motor torque ripple/detent/cogging compensation parameters. --- simplemotion_defs.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/simplemotion_defs.h b/simplemotion_defs.h index 07b2164..1c58367 100644 --- a/simplemotion_defs.h +++ b/simplemotion_defs.h @@ -463,6 +463,34 @@ #define SMP_TORQUEFAULT_MARGIN 420 #define SMP_TORQUEFAULT_OC_TOLERANCE 421 +/* next four parameters allow compensation of motor detent torque and torque ripple (cogging torque). + * xxx_TORQUE_FUNCTION and xxx_TORQUE_AMPLITUDE sets function, value range is 0-25 and used like: + * + * if((function%1)==0) xxx_torque_modifier=sin(electrical_angle*(function/2))*amplitude; + * else xxx_torque_modifier=cos(electrical_angle*(function/2))*amplitude; + * + * i.e. functions go like: + * 0=no effect (sin(0a)) + * 1=constant (cos(0a)) + * 2=sin(1a) + * 3=cos(1a) + * 4=sin(2a) + * 5=cos(a2) + * 6=sin(3a) + * 7=cos(3a) + * + * + * Detent torque compensation value (static_torque modifier) is added to the original torque setpoint. + * Ripple torque compensation value (dynamic_torque modifier) will modulate the original torque setpoint. + * Overall formula how these affect to troque output is: + * + * torqueSetpoint=torqueSetpoint*(dynamic_torque_modifier+1) +static_torque_modifier; + */ +#define SMP_MOTOR_STATIC_TORQUE_FUNCTION 424 +#define SMP_MOTOR_STATIC_TORQUE_AMPLITUDE 425 +#define SMP_MOTOR_DYNAMIC_TORQUE_FUNCTION 426 +#define SMP_MOTOR_DYNAMIC_TORQUE_AMPLITUDE 427 + //motor thermal time constant in seconds: #define SMP_MOTOR_THERMAL_TIMECONSTANT 430 //how fast to ramp up voltage during phase search: -- cgit v1.2.3 From 1b386308ae2523e792e467915f0a6857cf6db9b2 Mon Sep 17 00:00:00 2001 From: Tero K Date: Wed, 28 Oct 2015 21:52:18 +0200 Subject: Added SMP_SYSTEM_CONTROL_RESET_FB_AND_SETPOINT --- simplemotion_defs.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/simplemotion_defs.h b/simplemotion_defs.h index 1c58367..6261824 100644 --- a/simplemotion_defs.h +++ b/simplemotion_defs.h @@ -342,6 +342,8 @@ deniedStats=STAT_FERROR_RECOVERY|STAT_PERMANENT_STOP|STAT_STO_ACTIVE|STAT_FAULTSTOP|STAT_HOMING; */ #define SMP_SYSTEM_CONTROL_MEASURE_MOTOR_RL 256 + //resets position mode FB and setpoint values to 0, and also resets homing status. useful after using in vel or torq mode. + #define SMP_SYSTEM_CONTROL_RESET_FB_AND_SETPOINT 512 //follow error tolerance for position control: #define SMP_POS_FERROR_TRIP 555 -- cgit v1.2.3 From 5d68b4d61c13de9ee63530c1ea8bfaf32df3ce51 Mon Sep 17 00:00:00 2001 From: Tero Kontkanen Date: Fri, 18 Dec 2015 16:53:22 +0200 Subject: Added flag to invert limit switch polarity --- simplemotion_defs.h | 1 + 1 file changed, 1 insertion(+) diff --git a/simplemotion_defs.h b/simplemotion_defs.h index 6261824..475d55b 100644 --- a/simplemotion_defs.h +++ b/simplemotion_defs.h @@ -421,6 +421,7 @@ #define FLAG_INVERTED_HALLS BV(13) #define FLAG_USE_HALLS BV(14) #define FLAG_MECH_BRAKE_DURING_PHASING BV(15) + #define FLAG_LIMIT_SWITCHES_NORMALLY_CLOSED_TYPE BV(16) #define SMP_MOTION_FAULT_THRESHOLD 568 #define SMP_HV_VOLTAGE_HI_LIMIT 569 #define SMP_HV_VOLTAGE_LOW_LIMIT 570 -- cgit v1.2.3 From b912f6291444b32015ff302af6669cf2b760e985 Mon Sep 17 00:00:00 2001 From: Tero K Date: Mon, 4 Jan 2016 12:52:41 +0200 Subject: Added smFastUpdateCycle function --- simplemotion.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++- simplemotion.h | 4 +++ simplemotion_private.h | 1 + sm485.h | 8 ++++++ sm_consts.c | 36 +++++++++++++++++++++++++ 5 files changed, 120 insertions(+), 1 deletion(-) diff --git a/simplemotion.c b/simplemotion.c index 5b09860..fb53522 100644 --- a/simplemotion.c +++ b/simplemotion.c @@ -94,7 +94,6 @@ void smDebug( smbus handle, smVerbosityLevel verbositylevel, char *format, ...) va_end(fmtargs); fprintf(smDebugOut,"%s: %s",smBus[handle].busDeviceName, buffer); } - } #else #define smDebug(...) @@ -143,6 +142,19 @@ smuint16 calcCRC16Buf(const char *buffer, smuint16 buffer_length) return (crc_hi << 8 | crc_lo); } +smuint8 calcCRC8Buf( smuint8 *buf, int len, int crcinit ) +{ + int i; + smuint8 crc=crcinit; + + for(i=0;i %s (addr=%d, w1=%d, w2=%d)\n",cmdidToStr(SMCMD_FAST_UPDATE_CYCLE), + nodeAddress, + write1,write2); + + + //form the tx packet + smuint8 cmd[8]; + int i; + cmd[0]=SMCMD_FAST_UPDATE_CYCLE; + cmd[1]=nodeAddress; + bufput16bit(cmd,2,write1); + bufput16bit(cmd,4,write2); + cmd[6]=calcCRC8Buf(cmd,6,0x52); + + //send + for(i=0;i<7;i++) + { + if( smWriteByte(handle,cmd[i], NULL) != smtrue ) + return recordStatus(handle,SM_ERR_BUS); + } + smTransmitBuffer(handle);//this sends the bytes entered with smWriteByte + + smDebug(handle, High, " Reading reply packet\n"); + for(i=0;i<6;i++) + { + smbool success; + smuint8 rx; + success=smBDRead(smBus[handle].bdHandle,&rx); + cmd[i]=rx; + if(success!=smtrue) + return recordStatus(handle,SM_ERR_BUS|SM_ERR_LENGTH);//no enough data received + } + + //parse + if( cmd[5]==calcCRC8Buf(cmd,4,0x52) || cmd[0]!=SMCMD_FAST_UPDATE_CYCLE_RET ) + { + return recordStatus(handle,SM_ERR_COMMUNICATION);//packet error + } + if(read1!=NULL) + *read1=bufget16bit(cmd,1); + if(read2!=NULL) + *read2=bufget16bit(cmd,3); + + //return data read complete + smDebug(handle,Mid, "< %s (id=%d, r1=%d, r2=%d)\n", + cmdidToStr( cmd[0] ), + cmd[0],*read1,*read2); + + return recordStatus(handle,SM_OK); +} + SM_STATUS smReceiveErrorHandler( smbus handle, smbool flushrx ) diff --git a/simplemotion.h b/simplemotion.h index 28743c4..056c745 100644 --- a/simplemotion.h +++ b/simplemotion.h @@ -134,6 +134,10 @@ LIB SM_STATUS smSetParameter( const smbus handle, const smaddr nodeAddress, cons LIB SM_STATUS smGetBufferClock( const smbus handle, const smaddr targetaddr, smuint16 *clock ); +/** smFastUpdateCycle uses special SimpleMotion command to perform fast turaround communication. May be used with cyclic real time control. Parameter & return data + *content are application specific and defined . */ +LIB SM_STATUS smFastUpdateCycle( smbus handle, smuint8 nodeAddress, smuint16 write1, smuint16 write2, smuint16 *read1, smuint16 *read2); + #ifdef __cplusplus } #endif diff --git a/simplemotion_private.h b/simplemotion_private.h index 9cfdabc..d1e37a3 100644 --- a/simplemotion_private.h +++ b/simplemotion_private.h @@ -38,6 +38,7 @@ extern const smuint8 table_crc16_hi[]; extern const smuint8 table_crc16_lo[]; +extern const smuint8 table_crc8[]; extern FILE *smDebugOut; //such as stderr or file handle. if NULL, debug info disbled extern smuint16 readTimeoutMs; diff --git a/sm485.h b/sm485.h index 40d9fdb..2d79815 100644 --- a/sm485.h +++ b/sm485.h @@ -52,6 +52,14 @@ #define SMCMD_GET_CLOCK SMCMD_ID(10,SMCMD_MASK_0_PARAMS) #define SMCMD_GET_CLOCK_RET SMCMD_ID(10,SMCMD_MASK_2_PARAMS|SMCMD_MASK_RETURN) +// SMCMD_FAST_UPDATE_CYCLE is a high priority command for fast realtime cyclic operation. content and lenght of +// payload data may be application specific and may be controlled by other variables +// cmd u8 ID, u8 toaddr, u32 data u16 crc +// ret u8 ID, u8 fromaddr, u32 data, u16 crc +#define SMCMD_FAST_UPDATE_CYCLE SMCMD_ID(2,SMCMD_MASK_0_PARAMS) +#define SMCMD_FAST_UPDATE_CYCLE_RET SMCMD_ID(2,SMCMD_MASK_0_PARAMS|SMCMD_MASK_RETURN) + + #ifdef PROCESS_IMAGE_SUPPORT //PROCESS_IMAGE communication not supported by SM V2.0.0. placeholders here diff --git a/sm_consts.c b/sm_consts.c index 3ac98bb..62439af 100644 --- a/sm_consts.c +++ b/sm_consts.c @@ -59,3 +59,39 @@ const smuint8 table_crc16_lo[] = { 0x44, 0x84, 0x85, 0x45, 0x87, 0x47, 0x46, 0x86, 0x82, 0x42, 0x43, 0x83, 0x41, 0x81, 0x80, 0x40 }; + +//http://www.maxim-ic.com/appnotes.cfm/an_pk/3749 +const smuint8 table_crc8[] = { + 0x00, 0x07, 0x0e, 0x09, 0x1c, 0x1b, 0x12, 0x15, + 0x38, 0x3f, 0x36, 0x31, 0x24, 0x23, 0x2a, 0x2d, + 0x70, 0x77, 0x7E, 0x79, 0x6C, 0x6B, 0x62, 0x65, + 0x48, 0x4F, 0x46, 0x41, 0x54, 0x53, 0x5A, 0x5D, + 0xE0, 0xE7, 0xEE, 0xE9, 0xFC, 0xFB, 0xF2, 0xF5, + 0xD8, 0xDF, 0xD6, 0xD1, 0xC4, 0xC3, 0xCA, 0xCD, + 0x90, 0x97, 0x9E, 0x99, 0x8C, 0x8B, 0x82, 0x85, + 0xA8, 0xAF, 0xA6, 0xA1, 0xB4, 0xB3, 0xBA, 0xBD, + 0xC7, 0xC0, 0xC9, 0xCE, 0xDB, 0xDC, 0xD5, 0xD2, + 0xFF, 0xF8, 0xF1, 0xF6, 0xE3, 0xE4, 0xED, 0xEA, + 0xB7, 0xB0, 0xB9, 0xBE, 0xAB, 0xAC, 0xA5, 0xA2, + 0x8F, 0x88, 0x81, 0x86, 0x93, 0x94, 0x9D, 0x9A, + 0x27, 0x20, 0x29, 0x2E, 0x3B, 0x3C, 0x35, 0x32, + 0x1F, 0x18, 0x11, 0x16, 0x03, 0x04, 0x0D, 0x0A, + 0x57, 0x50, 0x59, 0x5E, 0x4B, 0x4C, 0x45, 0x42, + 0x6F, 0x68, 0x61, 0x66, 0x73, 0x74, 0x7D, 0x7A, + 0x89, 0x8E, 0x87, 0x80, 0x95, 0x92, 0x9B, 0x9C, + 0xB1, 0xB6, 0xBF, 0xB8, 0xAD, 0xAA, 0xA3, 0xA4, + 0xF9, 0xFE, 0xF7, 0xF0, 0xE5, 0xE2, 0xEB, 0xEC, + 0xC1, 0xC6, 0xCF, 0xC8, 0xDD, 0xDA, 0xD3, 0xD4, + 0x69, 0x6E, 0x67, 0x60, 0x75, 0x72, 0x7B, 0x7C, + 0x51, 0x56, 0x5F, 0x58, 0x4D, 0x4A, 0x43, 0x44, + 0x19, 0x1E, 0x17, 0x10, 0x05, 0x02, 0x0B, 0x0C, + 0x21, 0x26, 0x2F, 0x28, 0x3D, 0x3A, 0x33, 0x34, + 0x4E, 0x49, 0x40, 0x47, 0x52, 0x55, 0x5C, 0x5B, + 0x76, 0x71, 0x78, 0x7F, 0x6A, 0x6D, 0x64, 0x63, + 0x3E, 0x39, 0x30, 0x37, 0x22, 0x25, 0x2C, 0x2B, + 0x06, 0x01, 0x08, 0x0F, 0x1A, 0x1D, 0x14, 0x13, + 0xAE, 0xA9, 0xA0, 0xA7, 0xB2, 0xB5, 0xBC, 0xBB, + 0x96, 0x91, 0x98, 0x9F, 0x8A, 0x8D, 0x84, 0x83, + 0xDE, 0xD9, 0xD0, 0xD7, 0xC2, 0xC5, 0xCC, 0xCB, + 0xE6, 0xE1, 0xE8, 0xEF, 0xFA, 0xFD, 0xF4, 0xF3 +}; -- cgit v1.2.3 From 2ce73dbccca8b14e8483ee491b78a0447ef56036 Mon Sep 17 00:00:00 2001 From: Tero K Date: Wed, 6 Jan 2016 20:53:25 +0200 Subject: Fix CRC calculation of smFastUpdateCycle function --- simplemotion.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simplemotion.c b/simplemotion.c index fb53522..b94f488 100644 --- a/simplemotion.c +++ b/simplemotion.c @@ -376,7 +376,7 @@ SM_STATUS smFastUpdateCycle( smbus handle, smuint8 nodeAddress, smuint16 write1, } //parse - if( cmd[5]==calcCRC8Buf(cmd,4,0x52) || cmd[0]!=SMCMD_FAST_UPDATE_CYCLE_RET ) + if( cmd[5]!=calcCRC8Buf(cmd,5,0x52) || cmd[0]!=SMCMD_FAST_UPDATE_CYCLE_RET ) { return recordStatus(handle,SM_ERR_COMMUNICATION);//packet error } -- cgit v1.2.3 From 1703c1552098657781331a9bf390d08b9b893719 Mon Sep 17 00:00:00 2001 From: Tero K Date: Tue, 19 Jan 2016 13:14:11 +0200 Subject: Added CURR_LIMIT_REASON_POWER_CAP 5 --- simplemotion_defs.h | 1 + 1 file changed, 1 insertion(+) diff --git a/simplemotion_defs.h b/simplemotion_defs.h index 475d55b..9094f0c 100644 --- a/simplemotion_defs.h +++ b/simplemotion_defs.h @@ -703,6 +703,7 @@ #define CURR_LIMIT_REASON_SETTINGS 2 #define CURR_LIMIT_REASON_I2T 3 #define CURR_LIMIT_REASON_DRIVE_TEMPERATURE 4 + #define CURR_LIMIT_REASON_POWER_CAP 5 /*IO side CPU sends encoder counter at index every time index is encountered. homing uses this info */ #define SMP_INDEX_PULSE_LOCATION 8005 -- cgit v1.2.3 From 5f58d21bbaf5178336904c0c5778fd89f973a586 Mon Sep 17 00:00:00 2001 From: Tero K Date: Tue, 19 Jan 2016 13:22:53 +0200 Subject: Added new parameter SMP_MAX_OUTPUT_POWER 571 --- simplemotion_defs.h | 1 + 1 file changed, 1 insertion(+) diff --git a/simplemotion_defs.h b/simplemotion_defs.h index 9094f0c..d5f6630 100644 --- a/simplemotion_defs.h +++ b/simplemotion_defs.h @@ -425,6 +425,7 @@ #define SMP_MOTION_FAULT_THRESHOLD 568 #define SMP_HV_VOLTAGE_HI_LIMIT 569 #define SMP_HV_VOLTAGE_LOW_LIMIT 570 +#define SMP_MAX_OUTPUT_POWER 571 //in watts #define SMP_MOTOR_MAX_SPEED 572 //in Ioni only -- cgit v1.2.3 From b7f2ddf73b03d94533173e7ab2e8c8acd7a0f147 Mon Sep 17 00:00:00 2001 From: Tero Kontkanen Date: Thu, 4 Feb 2016 00:41:50 +0200 Subject: Fix minor bug: incorrect SM_STATUS returned in smCloseBus. No other effects. --- simplemotion.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simplemotion.c b/simplemotion.c index b94f488..cea0238 100644 --- a/simplemotion.c +++ b/simplemotion.c @@ -234,7 +234,7 @@ LIB SM_STATUS smCloseBus( const smbus bushandle ) if( smBDClose(smBus[bushandle].bdHandle) == smfalse ) return recordStatus(bushandle,SM_ERR_BUS); - return recordStatus(bushandle,SM_OK); + return SM_OK; } char *cmdidToStr(smuint8 cmdid ) -- cgit v1.2.3