Repository navigation
Conversation
CNC side of the Fanuc alpha serial spindle link (JA7A/JA7B) to an alpha series spindle amplifier (SPM), for a hostmot2 firmware carrying the FanucSpindle module (general function tag 0x5C, unofficial). The FPGA does the line format: 1.5 Mbit/s, 40-bit units with CRC-5, two 9-unit blocks per 2 ms frame, new word content every 4th frame. This driver runs the link in the servo thread: - start-up as recorded from a Fanuc 21-MB: pre-frames, loopback pattern, 0x6996 key, link start with the one-off 0xC000 word, data-select (ROM ID read, range select echoed before the download), sequential parameter download, wait for download complete - run: speed command (Q14 of parameter 4020), direction through SFRA/SRVA, *ESPA/MRDYA, alarm reset, orientation request, torque limits - feedback: speed meter, load meter, status words, alarm number, position from the per-update increments, linearly interpolated position - index-enable through the SPM's one-rev synchronisation (w13 bit 8 arms, w12 bit 6 reports, w4 counts from the marker) - faults: no loopback echo, no initialised bit, download not acknowledged, link lost, data-select not echoed, SPM link restart; a rising edge of alarm-reset restarts a faulted link Config: num_fspds=N. Pins: hm2_<board>.fspd.NN.* The start-up sequence, parameter channel and data-select were confirmed on a real SPM (firmware 9D20) with a separate emulator; this driver has only run against a software model of the FPGA and the SPM so far. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Thanks for the write-up; the notes on the test setup help. Before anyone reviews the code, I have a few questions about where some of the protocol knowledge comes from, so the maintainers have the full picture.
|
What the implementation is made of
What does come from the firmware analysis
Two caveats
|
|
kira_hal.zip |
|
Thanks, that answers my questions. One more, on testing: so far the link has only run against an SPM without a DC link, up to AL-11, and the index sync and rigid tap paths are not exercised at all. Would you be OK with the man page section for fspd saying it is experimental and untested on a running spindle, until someone with an alpha SPM on a machine reports back? The PR has no man page section yet, so it could go in when that is written. |
|
Sure, I will start task on man page. |
Adds a Fanuc serial spindle section and the num_fspds config option. States that the driver has only run against a software model, and that index-enable and rigid tapping in the amplifier are untested. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Also please look at the review posted by @BsAtHome |
|
Just to note the servo amplifier side - it's not feasible on anything that is not having the processing and protocol capabilities of something like STMBL. Fanuc uses a CNC side DSP which sends 3 PWM, reads two current feedbacks and passes processed encoder data. DSP computes current loop with a loop times of 250 us for HRV1, and up to 31.25 us for HRV4 for single drive. FSSB is serial link over fiber sending same data. |
- inline the small word helpers, clear the words with memset - declare loop variables in their for statements - check pin and parameter creation with a macro instead of summing results - create integer pins and parameters with the 64-bit sint/uint calls - set rom-id and rom-edition when they are read, not every cycle - comment the word assignments of the running state Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- limit the speed command in floating point before converting it; a very large speed-cmd-rpm was an out-of-range conversion - drop the unused read of the received header register - comments: no references to one machine, point at hostmot2(9), note that a watchdog bite stops the transmitter in the FPGA Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
VHDL code was replaced in main comment. |
- bool flags and typed enums for the link state, the fault code and the index state - variables declared const at first use; no bare scoping blocks - isnan/fmin/fmax/fabs from rtapi_math.h for the speed and position maths - 64-bit rtapi types for the nanosecond counters Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Review comments: link word numbers, bit masks, header values, the loopback pattern and its word range, start-up step counts and buffer sizes are named constants now. The running state says what the words it leaves at 0 are for. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
57f1195 to
9f9c564
Compare
I took a liberty to dump EPROM DSP firmware of the Alpha series SPM module A06B-6078-H206#H500, sniff data between 21-MB CNC control and this SPM, had a range of firmware dumps from CNC controls which I fed to Claude Code to search for protocol description.
This was tested only as a bench with feeding spindle parameters to SPM and waiting to get Alarm 11, mimicking control behavior when HV is not present. Sniffing/emulation was done with scope and later with Nucleo board and TTL RS422 transceiver.
Machine I took control off is already running set of STMBL V5.0 drives, so it's almost impossible for me to do live testing now.
VHDL part was done against 7i94T firmware.
fspd-hm2.zip
SPINDLE_LINK_PROTOCOL.md
SPINDLE_LINK_IMPLEMENTATION.md