prod2u_p4_normal_host_contract_v4.schema.json 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. {
  2. "$schema": "https://json-schema.org/draft/2020-12/schema",
  3. "$id": "https://prod2u.local/schemas/prod2u-p4-normal-host-contract-v4.schema.json",
  4. "title": "Prod2U Profile 4 Normal minimal actuator host contract v4",
  5. "type": "object",
  6. "additionalProperties": false,
  7. "required": [
  8. "schema",
  9. "profile",
  10. "profile_id",
  11. "protocol",
  12. "version_source",
  13. "wire",
  14. "frame_types",
  15. "commands",
  16. "unsupported_commands",
  17. "responses",
  18. "motion",
  19. "limit",
  20. "watchdog",
  21. "programming"
  22. ],
  23. "properties": {
  24. "schema": {"const": "prod2u-p4-normal-host-contract-v4"},
  25. "profile": {"const": "prod2u-p4-normal-actuator-binary921-v3"},
  26. "profile_id": {"const": 4},
  27. "protocol": {"const": "binary921-v3"},
  28. "version_source": {"const": "lowercase_git_sha8"},
  29. "wire": {
  30. "type": "object",
  31. "required": [
  32. "magic_hex",
  33. "version",
  34. "seq",
  35. "timestamp_tick",
  36. "header_offsets",
  37. "crc16",
  38. "request_compatibility",
  39. "ordinary_response_order",
  40. "motor_status_response_order",
  41. "temperature_response_order",
  42. "unsolicited_frames"
  43. ],
  44. "properties": {
  45. "magic_hex": {"const": "A55A"},
  46. "version": {"const": 2},
  47. "seq": {"const": 0},
  48. "timestamp_tick": {"const": 0},
  49. "header_offsets": {
  50. "const": {
  51. "magic": [0, 1],
  52. "version": 2,
  53. "profile_id": 3,
  54. "frame_type": 4,
  55. "seq_u32_le": [5, 8],
  56. "timestamp_tick_u32_le": [9, 12],
  57. "payload_length_u8": 13,
  58. "payload": [14, "14+payload_length-1"],
  59. "crc16_le": ["14+payload_length", "15+payload_length"]
  60. }
  61. },
  62. "crc16": {
  63. "const": {
  64. "name": "CRC-16/CCITT-FALSE",
  65. "polynomial": 4129,
  66. "initial": 65535,
  67. "reflect_input": false,
  68. "reflect_output": false,
  69. "xor_output": 0,
  70. "coverage": "version_through_payload_inclusive",
  71. "wire_byte_order": "little-endian"
  72. }
  73. },
  74. "request_compatibility": {"const": "BYTE_EXACT_FROZEN"},
  75. "ordinary_response_order": {"const": ["HOST_ACK"]},
  76. "motor_status_response_order": {"const": ["HOST_ACK", "MOTION_STATUS"]},
  77. "temperature_response_order": {"const": ["TEMPERATURE_SHORT"]},
  78. "unsolicited_frames": {"const": false}
  79. },
  80. "additionalProperties": false
  81. },
  82. "frame_types": {
  83. "const": {
  84. "HOST_CMD": 5,
  85. "HOST_ACK": 6,
  86. "HOST_BATCH_CMD": 7,
  87. "TEMPERATURE_SHORT": 16,
  88. "MOTION_CMD": 17,
  89. "MOTION_STATUS": 18
  90. }
  91. },
  92. "commands": {
  93. "type": "object",
  94. "required": ["get_status", "disable", "get_temperatures", "set_output_snapshot", "jog", "mark_closed", "get_motor_status"],
  95. "properties": {
  96. "get_status": {"$ref": "#/$defs/command"},
  97. "disable": {"$ref": "#/$defs/command"},
  98. "get_temperatures": {"$ref": "#/$defs/temperatureCommand"},
  99. "set_output_snapshot": {"$ref": "#/$defs/snapshotCommand"},
  100. "jog": {"$ref": "#/$defs/jogCommand"},
  101. "mark_closed": {"$ref": "#/$defs/command"},
  102. "get_motor_status": {"$ref": "#/$defs/command"}
  103. },
  104. "additionalProperties": false
  105. },
  106. "unsupported_commands": {
  107. "type": "object",
  108. "required": ["0x29", "0x36"],
  109. "properties": {
  110. "0x29": {"$ref": "#/$defs/unsupported"},
  111. "0x36": {"$ref": "#/$defs/unsupported"}
  112. },
  113. "additionalProperties": false
  114. },
  115. "responses": {
  116. "type": "object",
  117. "required": ["host_ack", "temperature_short", "motion_status"],
  118. "properties": {
  119. "host_ack": {
  120. "type": "object",
  121. "required": ["frame_type", "payload_length", "full_frame_length", "byte_offsets", "state_hash16", "snapshot_detail_bits", "snapshot_result_flag_bits", "status_codes"],
  122. "properties": {
  123. "frame_type": {"const": 6},
  124. "payload_length": {"const": 8},
  125. "full_frame_length": {"const": 24},
  126. "byte_offsets": {"type": "object"},
  127. "state_hash16": {
  128. "type": "object",
  129. "required": ["algorithm", "encoding", "input_order", "semantic"],
  130. "properties": {
  131. "algorithm": {"const": "CRC-16/CCITT-FALSE"},
  132. "encoding": {"const": "u16_le"},
  133. "input_order": {"type": "array", "minItems": 3, "maxItems": 3},
  134. "semantic": {"const": "ACTUAL_APPLIED_SYNCHRONOUS_OUTPUTS"}
  135. },
  136. "additionalProperties": false
  137. },
  138. "snapshot_detail_bits": {"const": {"all_bits": "ZERO"}},
  139. "snapshot_result_flag_bits": {"type": "object"},
  140. "status_codes": {"type": "object"}
  141. },
  142. "additionalProperties": false
  143. },
  144. "temperature_short": {
  145. "type": "object",
  146. "required": ["frame_type", "payload_length", "full_frame_length", "layout", "crc_coverage", "value_order"],
  147. "properties": {
  148. "frame_type": {"const": 16},
  149. "payload_length": {"const": 27},
  150. "full_frame_length": {"const": 35},
  151. "layout": {"const": "A5 5A 02 04 10 1B values[27] crc16_le"},
  152. "crc_coverage": {"const": "02 04 10 1B values[27]"},
  153. "value_order": {
  154. "const": [
  155. "U6.local",
  156. "U6.remote1..8",
  157. "U24.local",
  158. "U24.remote1..8",
  159. "U25.local",
  160. "U25.remote1..8"
  161. ]
  162. }
  163. },
  164. "additionalProperties": false
  165. },
  166. "motion_status": {
  167. "type": "object",
  168. "required": ["frame_type", "payload_length", "full_frame_length", "layout", "position_values", "position_valid_mask", "current_xyz", "target_xyz", "busy_mask", "busy_semantic", "busy_role", "enable_active", "fault_mask", "z_current_target", "z_valid_busy_fault"],
  169. "properties": {
  170. "frame_type": {"const": 18},
  171. "payload_length": {"const": 10},
  172. "full_frame_length": {"const": 26},
  173. "layout": {"type": "string"},
  174. "position_values": {"const": {"UNKNOWN": 255}},
  175. "position_valid_mask": {"const": 0},
  176. "current_xyz": {"const": [255, 255, 255]},
  177. "target_xyz": {"const": [255, 255, 255]},
  178. "busy_mask": {"const": 0},
  179. "busy_semantic": {"const": "ALWAYS_ZERO"},
  180. "busy_role": {"const": "RESERVED_CONSTANT_ZERO"},
  181. "enable_active": {"const": 1},
  182. "fault_mask": {"const": 0},
  183. "z_current_target": {"const": 255},
  184. "z_valid_busy_fault": {"const": 0}
  185. },
  186. "additionalProperties": false
  187. }
  188. },
  189. "additionalProperties": false
  190. },
  191. "motion": {
  192. "type": "object",
  193. "required": ["axes", "execution", "motor_driving_commands", "jog_ack_semantics", "same_axis_jog_while_active", "peer_axis_may_start", "dir_setup_us", "effective_step_rate_hz", "normal_step_stop", "motor_stop_sources"],
  194. "properties": {
  195. "axes": {"const": ["X", "Y"]},
  196. "execution": {"const": "TWO_INDEPENDENT_PARALLEL_EXECUTORS"},
  197. "motor_driving_commands": {"const": ["0x35"]},
  198. "jog_ack_semantics": {"const": "FIRST_STEP_EMITTED"},
  199. "same_axis_jog_while_active": {"const": "IMMEDIATE_RELOAD_AND_RESTART_DIR_SETUP"},
  200. "peer_axis_may_start": {"const": true},
  201. "dir_setup_us": {"const": 1000},
  202. "effective_step_rate_hz": {"const": 1000},
  203. "normal_step_stop": {"const": "NEW_SAME_AXIS_JOG_MAY_TRUNCATE_OLD_STEP"},
  204. "motor_stop_sources": {"const": ["RESET", "POWER_LOSS", "RECONFIGURATION"]}
  205. },
  206. "additionalProperties": false
  207. },
  208. "limit": {
  209. "type": "object",
  210. "required": ["axes", "polarity", "open_voltage_v", "closed_voltage_v", "synchronizer_stages", "pins_retained", "logic_consumer", "used_only_for", "motion_effect", "dir0_jog_ignores_limit", "dir1_jog_ignores_limit", "position_memory", "direction_learning"],
  211. "properties": {
  212. "axes": {"const": ["X", "Y"]},
  213. "polarity": {"const": "ACTIVE_HIGH"},
  214. "open_voltage_v": {"const": 0.0},
  215. "closed_voltage_v": {"const": 3.3},
  216. "synchronizer_stages": {"const": 0},
  217. "pins_retained": {"const": true},
  218. "logic_consumer": {"const": "NONE"},
  219. "used_only_for": {"const": "RETAINED_PINS_NO_LOGIC_CONSUMER"},
  220. "motion_effect": {"const": "NONE"},
  221. "dir0_jog_ignores_limit": {"const": true},
  222. "dir1_jog_ignores_limit": {"const": true},
  223. "position_memory": {"const": false},
  224. "direction_learning": {"const": false}
  225. },
  226. "additionalProperties": false
  227. },
  228. "watchdog": {
  229. "type": "object",
  230. "required": ["timeout_seconds", "accepted_output_arms", "accepted_motion_arms", "armed_get_motor_status_refreshes", "status_query_cannot_arm_or_revive", "expiry_beats_same_cycle_refresh", "expiry_requires_disable_before_rearm", "next_valid_output_clears_timeout_and_rearms", "motor_effect", "non_motor_effect"],
  231. "properties": {
  232. "timeout_seconds": {"const": 5},
  233. "accepted_output_arms": {"const": true},
  234. "accepted_motion_arms": {"const": false},
  235. "armed_get_motor_status_refreshes": {"const": true},
  236. "status_query_cannot_arm_or_revive": {"const": true},
  237. "expiry_beats_same_cycle_refresh": {"const": true},
  238. "expiry_requires_disable_before_rearm": {"const": false},
  239. "next_valid_output_clears_timeout_and_rearms": {"const": true},
  240. "motor_effect": {"const": "NONE"},
  241. "non_motor_effect": {"const": "SAFE_OUTPUTS"}
  242. },
  243. "additionalProperties": false
  244. },
  245. "programming": {
  246. "type": "object",
  247. "required": ["operation", "speed_hz", "attempt_limit", "automatic_retry", "flash_allowed"],
  248. "properties": {
  249. "operation": {"const": "PROGRAM_SRAM"},
  250. "speed_hz": {"const": 200000},
  251. "attempt_limit": {"const": 1},
  252. "automatic_retry": {"const": false},
  253. "flash_allowed": {"const": false}
  254. },
  255. "additionalProperties": false
  256. }
  257. },
  258. "$defs": {
  259. "command": {
  260. "type": "object",
  261. "required": ["frame_type", "command", "payload_length"],
  262. "properties": {
  263. "frame_type": {"type": "integer", "minimum": 0, "maximum": 255},
  264. "command": {"type": "integer", "minimum": 0, "maximum": 255},
  265. "payload_length": {"type": "integer", "minimum": 0, "maximum": 255}
  266. },
  267. "additionalProperties": true
  268. },
  269. "temperatureCommand": {
  270. "type": "object",
  271. "required": ["frame_type", "command", "payload_length", "request_payload_hex", "success_response", "powerup_under_one_second", "nack_policy", "bus_error_status", "bus_error_status_code", "read_order", "addresses", "registers"],
  272. "properties": {
  273. "frame_type": {"const": 5},
  274. "command": {"const": 40},
  275. "payload_length": {"const": 4},
  276. "request_payload_hex": {"const": "28 00 00 00"},
  277. "success_response": {"const": "TEMPERATURE_SHORT_ONLY_NO_ACK"},
  278. "powerup_under_one_second": {"const": "ALL_FF_NO_I2C"},
  279. "nack_policy": {"const": "CURRENT_VALUE_FF_CONTINUE"},
  280. "bus_error_status": {"const": "TEMPERATURE_BUS_ERROR"},
  281. "bus_error_status_code": {"const": 10},
  282. "read_order": {"const": ["U6", "U24", "U25"]},
  283. "addresses": {"const": [73, 72, 75]},
  284. "registers": {"const": [0, 1, 2, 3, 4, 5, 6, 7, 8]}
  285. },
  286. "additionalProperties": false
  287. },
  288. "snapshotCommand": {
  289. "type": "object",
  290. "required": ["frame_type", "command", "payload_length", "full_frame_length", "input_layout", "ptc_range", "fan_range", "binary_values", "xyz_range", "xyz_policy", "motor_effect", "ptc_fan_commit_when_motion_busy", "solenoid_change_when_any_xy_busy", "axis_policy", "response"],
  291. "properties": {
  292. "frame_type": {"const": 7},
  293. "command": {"const": 42},
  294. "payload_length": {"const": 34},
  295. "full_frame_length": {"const": 50},
  296. "input_layout": {"const": "2A flags PTC1..24 FAN1..4 solenoid X Y Z"},
  297. "ptc_range": {"const": [0, 100]},
  298. "fan_range": {"const": [0, 100]},
  299. "binary_values": {"const": [0, 100]},
  300. "xyz_range": {"const": [0, 255]},
  301. "xyz_policy": {"const": "IGNORE_ANY_U8_NO_MOTOR_EFFECT"},
  302. "motor_effect": {"const": "NONE"},
  303. "ptc_fan_commit_when_motion_busy": {"const": true},
  304. "solenoid_change_when_any_xy_busy": {"const": "ALWAYS_COMMIT"},
  305. "axis_policy": {"const": "IGNORE_ANY_U8_NO_MOTOR_EFFECT"},
  306. "response": {"const": "HOST_ACK"}
  307. },
  308. "additionalProperties": false
  309. },
  310. "jogCommand": {
  311. "type": "object",
  312. "required": ["frame_type", "command", "payload_length", "full_frame_length", "input_layout", "axes", "cli_axes", "reserved_z_status", "direction", "speed_codes", "step_range", "step_field_policy", "fast_path_policy", "executed_step_cap", "over_cap_status", "over_cap_behavior", "speed_field_policy", "effective_step_rate_hz", "ack_semantics", "arms_watchdog", "same_axis_active_policy", "same_axis_host_rule", "same_axis_violation_policy", "multiple_pending_policy", "replacement_dir_setup_us", "limit_policy", "rejects_busy", "admission_ignores", "watchdog_timeout_recovery", "peer_axis_busy_does_not_block", "completion_event", "response"],
  313. "properties": {
  314. "frame_type": {"const": 17},
  315. "command": {"const": 53},
  316. "payload_length": {"const": 8},
  317. "full_frame_length": {"const": 24},
  318. "input_layout": {"const": "35 axis raw_dir speed_code steps_u16_le 00 00"},
  319. "axes": {"type": "object"},
  320. "cli_axes": {"const": ["X", "Y"]},
  321. "reserved_z_status": {"const": "BAD_VALUE"},
  322. "direction": {"type": "object"},
  323. "speed_codes": {"const": [0, 1, 2, 3]},
  324. "step_range": {"const": [1, 65535]},
  325. "step_field_policy": {"const": "RAW_U16_TRUSTED_HOST_NO_CPLD_CAP"},
  326. "fast_path_policy": {"const": "RX_FAST_JOG_BYPASSES_NORMAL_REQUEST_SLOT"},
  327. "executed_step_cap": {"const": null},
  328. "over_cap_status": {"const": "NOT_APPLICABLE"},
  329. "over_cap_behavior": {"const": "EXECUTE_REQUESTED_U16_STEPS"},
  330. "speed_field_policy": {"const": "VALIDATE_0_TO_3_THEN_IGNORE"},
  331. "effective_step_rate_hz": {"const": 1000},
  332. "ack_semantics": {"const": "FIRST_STEP_EMITTED"},
  333. "arms_watchdog": {"const": false},
  334. "same_axis_active_policy": {"const": "IMMEDIATE_RELOAD_AND_RESTART_DIR_SETUP"},
  335. "same_axis_host_rule": {"const": "HOST_MUST_NOT_REPEAT_SAME_AXIS_BEFORE_COMPLETION"},
  336. "same_axis_violation_policy": {"const": "LATEST_COMMAND_WINS_OLD_ACK_NOT_GUARANTEED"},
  337. "multiple_pending_policy": {"const": "NONE"},
  338. "replacement_dir_setup_us": {"const": 1000},
  339. "limit_policy": {"const": "IGNORE_ALL_INPUTS"},
  340. "rejects_busy": {"const": false},
  341. "admission_ignores": {"const": ["AXIS_ACTIVE", "SNAPSHOT_VALID", "LIMIT_INPUTS", "WATCHDOG_TIMEOUT"]},
  342. "watchdog_timeout_recovery": {"const": "NOT_APPLICABLE_TIMEOUT_HAS_NO_MOTOR_EFFECT"},
  343. "peer_axis_busy_does_not_block": {"const": true},
  344. "completion_event": {"const": "NONE_HOST_TRACKS_TIME"},
  345. "response": {"const": "HOST_ACK"}
  346. },
  347. "additionalProperties": false
  348. },
  349. "unsupported": {
  350. "type": "object",
  351. "required": ["status", "status_code", "changes_state", "arms_watchdog"],
  352. "properties": {
  353. "status": {"const": "UNSUPPORTED_IN_PROFILE"},
  354. "status_code": {"const": 1},
  355. "changes_state": {"const": false},
  356. "arms_watchdog": {"const": false},
  357. "request_payload_hex": {"type": "string"}
  358. },
  359. "additionalProperties": false
  360. }
  361. }
  362. }