From c1ffe8b80512fb347b6d0cdb297af69875be9071 Mon Sep 17 00:00:00 2001 From: Daniel Sissom Date: Fri, 24 May 2024 08:44:02 -0500 Subject: [PATCH 01/11] Set problem and limit flags when md90 error status returned. --- dsmApp/src/MD90Driver.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dsmApp/src/MD90Driver.cpp b/dsmApp/src/MD90Driver.cpp index 522a6b4..7240165 100644 --- a/dsmApp/src/MD90Driver.cpp +++ b/dsmApp/src/MD90Driver.cpp @@ -298,20 +298,31 @@ asynStatus MD90Axis::poll(bool *moving) case 3: // Move stopped break; case 4: // Homing error + setIntegerParam(pC_->motorStatusProblem_, 1); break; case 5: // Stance error + setIntegerParam(pC_->motorStatusProblem_, 1); break; case 6: // Stance complete break; case 7: // Open loop move error + setIntegerParam(pC_->motorStatusProblem_, 1); break; case 8: // Closed loop move error + setIntegerParam(pC_->motorStatusProblem_, 1); break; case 9: // Closed loop move complete break; case 10: // End of travel error + setIntegerParam(pC_->motorStatusProblem_, 1); + if (position > 0) { + setIntegerParam(pC_->motorStatusHighLimit_, 1); + } else { + setIntegerParam(pC_->motorStatusLowLimit_, 1); + } break; case 11: // Ramp move error + setIntegerParam(pC_->motorStatusProblem_, 1); break; default: break; From 629c55bba49c9e5a41124cbad84ac7c9b1a2ed74 Mon Sep 17 00:00:00 2001 From: Daniel Sissom Date: Fri, 24 May 2024 09:42:53 -0500 Subject: [PATCH 02/11] Updated move command for md90. --- dsmApp/src/MD90Driver.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dsmApp/src/MD90Driver.cpp b/dsmApp/src/MD90Driver.cpp index 7240165..001c202 100644 --- a/dsmApp/src/MD90Driver.cpp +++ b/dsmApp/src/MD90Driver.cpp @@ -174,10 +174,11 @@ asynStatus MD90Axis::move(double position, int relative, double minVelocity, dou status = sendAccelAndVelocity(acceleration, maxVelocity); + // Position specified in nanometers if (relative) { - sprintf(pC_->outString_, "#%02dI%+d", axisNo_, NINT(position)); + sprintf(pC_->outString_, "CRM %d", NINT(position)); } else { - sprintf(pC_->outString_, "#%02dG%+d", axisNo_, NINT(position)); + sprintf(pC_->outString_, "CLM %d", NINT(position)); } status = pC_->writeReadController(); return status; From 8101fcae722956a5923301300ac44a29a2c6b761 Mon Sep 17 00:00:00 2001 From: Daniel Sissom Date: Fri, 24 May 2024 09:46:58 -0500 Subject: [PATCH 03/11] Updated home command for md90. --- dsmApp/src/MD90Driver.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/dsmApp/src/MD90Driver.cpp b/dsmApp/src/MD90Driver.cpp index 001c202..7f40972 100644 --- a/dsmApp/src/MD90Driver.cpp +++ b/dsmApp/src/MD90Driver.cpp @@ -191,11 +191,7 @@ asynStatus MD90Axis::home(double minVelocity, double maxVelocity, double acceler status = sendAccelAndVelocity(acceleration, maxVelocity); - if (forwards) { - sprintf(pC_->outString_, "#%02dH+", axisNo_); - } else { - sprintf(pC_->outString_, "#%02dH-", axisNo_); - } + sprintf(pC_->outString_, "HOM"); status = pC_->writeReadController(); return status; } From 1b366684d0f17f3b5552901ec86602244d3e039c Mon Sep 17 00:00:00 2001 From: Daniel Sissom Date: Fri, 24 May 2024 13:41:25 -0500 Subject: [PATCH 04/11] Changed some record field values to better match the md90. --- iocs/dsmIOC/iocBoot/iocDsm/motor.substitutions.md90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iocs/dsmIOC/iocBoot/iocDsm/motor.substitutions.md90 b/iocs/dsmIOC/iocBoot/iocDsm/motor.substitutions.md90 index 90a5a28..2e0aed8 100644 --- a/iocs/dsmIOC/iocBoot/iocDsm/motor.substitutions.md90 +++ b/iocs/dsmIOC/iocBoot/iocDsm/motor.substitutions.md90 @@ -1,6 +1,6 @@ file "$(MOTOR)/db/basic_asyn_motor.db" { pattern -{P, N, M, DTYP, PORT, ADDR, DESC, EGU, DIR, VELO, VBAS, ACCL, BDST, BVEL, BACC, MRES, PREC, DHLM, DLLM, INIT} -{DSM:, 0, "m$(N)", "asynMotor", MD900, 0, "Bottom", mm, Pos, 2.0, 0.1, .2, 0, 1, .2, -.001, 3, 16, 0, ""} +{P, N, M, DTYP, PORT, ADDR, DESC, EGU, DIR, VELO, VBAS, ACCL, BDST, BVEL, BACC, MRES, PREC, DHLM, DLLM, INIT} +{DSM:, 0, "m$(N)", "asynMotor", MD900, 0, "MD-90", mm, Pos, 2.0, 0.1, .2, 0, 1, .2, .001, 3, 20000, -20000, ""} } From c2cbaf6bfd4c8b74366bd595ea93b3c766e458c4 Mon Sep 17 00:00:00 2001 From: Daniel Sissom Date: Fri, 24 May 2024 13:41:54 -0500 Subject: [PATCH 05/11] Updated ioc to send enable power supply command to md90. --- iocs/dsmIOC/iocBoot/iocDsm/st.cmd.md90 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/iocs/dsmIOC/iocBoot/iocDsm/st.cmd.md90 b/iocs/dsmIOC/iocBoot/iocDsm/st.cmd.md90 index 68f6a8e..c40aa73 100644 --- a/iocs/dsmIOC/iocBoot/iocDsm/st.cmd.md90 +++ b/iocs/dsmIOC/iocBoot/iocDsm/st.cmd.md90 @@ -5,7 +5,7 @@ dbLoadDatabase("../../dbd/dsm.dbd") dsm_registerRecordDeviceDriver(pdbbase) -# Port 2 on a Moxa +# Network device #!drvAsynIPPortConfigure("serial0", "192.168.1.16:4002",0,0,0) # Local serial port #!drvAsynSerialPortConfigure("serial0", "/dev/ttyS0", 0, 0, 0) @@ -24,6 +24,11 @@ asynOctetSetOutputEos("serial0", 0, "\r") asynSetTraceIOMask("serial0", 0, 2) #asynSetTraceMask("serial0", 0, 255) +# Turn on the power supply +asynOctetConnect("initConnection", "serial0", 0) +asynOctetWrite("initConnection", "EPS") +asynOctetDisconnect('test') + MD90CreateController("MD900", "serial0", 1, 100, 5000) ### Motors From a1827ca152706f7e3312274b23910b592e27e54a Mon Sep 17 00:00:00 2001 From: Daniel Sissom Date: Fri, 24 May 2024 14:15:16 -0500 Subject: [PATCH 06/11] Updated ioc to set motor deadband to minimum. --- iocs/dsmIOC/iocBoot/iocDsm/st.cmd.md90 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/iocs/dsmIOC/iocBoot/iocDsm/st.cmd.md90 b/iocs/dsmIOC/iocBoot/iocDsm/st.cmd.md90 index c40aa73..3dbb750 100644 --- a/iocs/dsmIOC/iocBoot/iocDsm/st.cmd.md90 +++ b/iocs/dsmIOC/iocBoot/iocDsm/st.cmd.md90 @@ -24,9 +24,10 @@ asynOctetSetOutputEos("serial0", 0, "\r") asynSetTraceIOMask("serial0", 0, 2) #asynSetTraceMask("serial0", 0, 255) -# Turn on the power supply +# Turn on the power supply and set the deadband asynOctetConnect("initConnection", "serial0", 0) asynOctetWrite("initConnection", "EPS") +asynOctetWrite("initConnection", "SDB 10") asynOctetDisconnect('test') MD90CreateController("MD900", "serial0", 1, 100, 5000) From 7b3675fbdf2d1fa573463fa3ba5fd5d1f1c937c9 Mon Sep 17 00:00:00 2001 From: Daniel Sissom Date: Fri, 24 May 2024 14:31:22 -0500 Subject: [PATCH 07/11] Updated internal units to encoder steps (10 nm). --- dsmApp/src/MD90Driver.cpp | 5 +++-- iocs/dsmIOC/iocBoot/iocDsm/motor.substitutions.md90 | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dsmApp/src/MD90Driver.cpp b/dsmApp/src/MD90Driver.cpp index 7f40972..a0e5976 100644 --- a/dsmApp/src/MD90Driver.cpp +++ b/dsmApp/src/MD90Driver.cpp @@ -174,7 +174,8 @@ asynStatus MD90Axis::move(double position, int relative, double minVelocity, dou status = sendAccelAndVelocity(acceleration, maxVelocity); - // Position specified in nanometers + // Position specified in encoder steps (10 nm), but motor move commands are in nanometers + position = position * 10; if (relative) { sprintf(pC_->outString_, "CRM %d", NINT(position)); } else { @@ -268,7 +269,7 @@ asynStatus MD90Axis::poll(bool *moving) // TODO: Will need to add some more error handling for the motor return codes. - // Read the current motor position + // Read the current motor position in encoder steps (10 nm) sprintf(pC_->outString_, "GEC"); comStatus = pC_->writeReadController(); if (comStatus) goto skip; diff --git a/iocs/dsmIOC/iocBoot/iocDsm/motor.substitutions.md90 b/iocs/dsmIOC/iocBoot/iocDsm/motor.substitutions.md90 index 2e0aed8..f1751fa 100644 --- a/iocs/dsmIOC/iocBoot/iocDsm/motor.substitutions.md90 +++ b/iocs/dsmIOC/iocBoot/iocDsm/motor.substitutions.md90 @@ -2,5 +2,5 @@ file "$(MOTOR)/db/basic_asyn_motor.db" { pattern {P, N, M, DTYP, PORT, ADDR, DESC, EGU, DIR, VELO, VBAS, ACCL, BDST, BVEL, BACC, MRES, PREC, DHLM, DLLM, INIT} -{DSM:, 0, "m$(N)", "asynMotor", MD900, 0, "MD-90", mm, Pos, 2.0, 0.1, .2, 0, 1, .2, .001, 3, 20000, -20000, ""} +{DSM:, 0, "m$(N)", "asynMotor", MD900, 0, "MD-90", mm, Pos, 2.0, 0.1, .2, 0, 1, .2, .01, 2, 20000, -20000, ""} } From 9403c24df055fd51d9bc08d3d2e18e8112d560a4 Mon Sep 17 00:00:00 2001 From: Daniel Sissom Date: Fri, 24 May 2024 14:56:20 -0500 Subject: [PATCH 08/11] Changed substitutions file to use millimeters instead of micrometers. --- iocs/dsmIOC/iocBoot/iocDsm/motor.substitutions.md90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iocs/dsmIOC/iocBoot/iocDsm/motor.substitutions.md90 b/iocs/dsmIOC/iocBoot/iocDsm/motor.substitutions.md90 index f1751fa..4a6fc6d 100644 --- a/iocs/dsmIOC/iocBoot/iocDsm/motor.substitutions.md90 +++ b/iocs/dsmIOC/iocBoot/iocDsm/motor.substitutions.md90 @@ -1,6 +1,6 @@ file "$(MOTOR)/db/basic_asyn_motor.db" { pattern -{P, N, M, DTYP, PORT, ADDR, DESC, EGU, DIR, VELO, VBAS, ACCL, BDST, BVEL, BACC, MRES, PREC, DHLM, DLLM, INIT} -{DSM:, 0, "m$(N)", "asynMotor", MD900, 0, "MD-90", mm, Pos, 2.0, 0.1, .2, 0, 1, .2, .01, 2, 20000, -20000, ""} +{P, N, M, DTYP, PORT, ADDR, DESC, EGU, DIR, VELO, VBAS, ACCL, BDST, BVEL, BACC, MRES, PREC, DHLM, DLLM, INIT} +{DSM:, 0, "m$(N)", "asynMotor", MD900, 0, "MD-90", mm, Pos, 2.0, 0.1, .2, 0, 1, .2, .00001, 2, 20, -20, ""} } From 6c841c9041b31ade424ae35ef7dbd5e6938ee0f0 Mon Sep 17 00:00:00 2001 From: Daniel Sissom Date: Fri, 24 May 2024 15:47:01 -0500 Subject: [PATCH 09/11] Fixed to disconnect real initConnection. --- iocs/dsmIOC/iocBoot/iocDsm/st.cmd.md90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iocs/dsmIOC/iocBoot/iocDsm/st.cmd.md90 b/iocs/dsmIOC/iocBoot/iocDsm/st.cmd.md90 index 3dbb750..7d72961 100644 --- a/iocs/dsmIOC/iocBoot/iocDsm/st.cmd.md90 +++ b/iocs/dsmIOC/iocBoot/iocDsm/st.cmd.md90 @@ -28,7 +28,7 @@ asynSetTraceIOMask("serial0", 0, 2) asynOctetConnect("initConnection", "serial0", 0) asynOctetWrite("initConnection", "EPS") asynOctetWrite("initConnection", "SDB 10") -asynOctetDisconnect('test') +asynOctetDisconnect('initConnection') MD90CreateController("MD900", "serial0", 1, 100, 5000) From 9a3d3d773dfc2b04f65893c1af604bacab0c5ffa Mon Sep 17 00:00:00 2001 From: Daniel Sissom Date: Fri, 24 May 2024 15:57:58 -0500 Subject: [PATCH 10/11] Updated subst with usable velocities and description comments. --- .../iocBoot/iocDsm/motor.substitutions.md90 | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/iocs/dsmIOC/iocBoot/iocDsm/motor.substitutions.md90 b/iocs/dsmIOC/iocBoot/iocDsm/motor.substitutions.md90 index 4a6fc6d..40e4e4a 100644 --- a/iocs/dsmIOC/iocBoot/iocDsm/motor.substitutions.md90 +++ b/iocs/dsmIOC/iocBoot/iocDsm/motor.substitutions.md90 @@ -1,6 +1,26 @@ file "$(MOTOR)/db/basic_asyn_motor.db" { pattern -{P, N, M, DTYP, PORT, ADDR, DESC, EGU, DIR, VELO, VBAS, ACCL, BDST, BVEL, BACC, MRES, PREC, DHLM, DLLM, INIT} -{DSM:, 0, "m$(N)", "asynMotor", MD900, 0, "MD-90", mm, Pos, 2.0, 0.1, .2, 0, 1, .2, .00001, 2, 20, -20, ""} +{P, N, M, DTYP, PORT, ADDR, DESC, EGU, DIR, VELO, VBAS, VMAX, ACCL, BDST, BVEL, BACC, MRES, PREC, DHLM, DLLM, INIT} +{DSM:, 0, "m$(N)", "asynMotor", MD900, 0, "MD-90", mm, Pos, 0.5, 0.025, 0.625, 0, 0, 0.03, 0, .00001, 2, 20, -20, ""} } + +# P IOC prefix +# N Port number +# M Record name pattern +# DTYP Datatype +# PORT Port +# ADDR Address +# DESC Description +# EGU Engineering units +# DIR Direction +# VELO Velocity (EGU / s) +# VBAS Minimum velocity (EGU / s) +# VMAX Maximum velocity (EGU / s) (not getting set here with basic_asyn_motor.db) +# ACCL Acceleration (time in seconds until VELO) +# BDST Backlash distance +# MRES Motor step size (EGU) +# PREC Display precision number of decimal places +# DHLM Dial high travel limit (EGU) +# DLLM Dial low travel limit (EGU) +# INIT Initialization string (seems to be unused/broken) From 9fa37e8cd0f583858d82f3696de12bc973866c0d Mon Sep 17 00:00:00 2001 From: Daniel Sissom Date: Fri, 24 May 2024 16:14:26 -0500 Subject: [PATCH 11/11] Set max velocity in ioc launch script. --- iocs/dsmIOC/iocBoot/iocDsm/st.cmd.md90 | 1 + 1 file changed, 1 insertion(+) diff --git a/iocs/dsmIOC/iocBoot/iocDsm/st.cmd.md90 b/iocs/dsmIOC/iocBoot/iocDsm/st.cmd.md90 index 7d72961..28be557 100644 --- a/iocs/dsmIOC/iocBoot/iocDsm/st.cmd.md90 +++ b/iocs/dsmIOC/iocBoot/iocDsm/st.cmd.md90 @@ -42,3 +42,4 @@ iocInit # This IOC does not use save/restore, so set values of some PVs dbpf("DSM:m0.RTRY", "0") dbpf("DSM:m0.TWV", "0.1") +dbpf("DSM:m0.VMAX", "0.625")