5226BB Rev G.
5.0.31
11/2/2026
SCN: 5431 — 5226; Won't Go Into Fast if FoldguardActive is Defined

Changes made for Pathfinder 5226 controllers.

Change: allow fast clamp close under FoldGuard handshake (BlackBox, RunSingleBend.c)

Status: edited 2026-10-21, pending TFS checkin against changeset 4453. One file, five lines added, no lines removed.

Problem. On JornsFlex, and any other configuration that enables the FoldGuardWithHandshake feature group, the automatic clamp close always ran in slow speed from the top of the stroke. The FastSpeedSelect output never turned on, regardless of the FoldGuardActive or ClampingBeamSlowSpeedLimit input states.

Root cause. The handshake group maps FoldGuardActive, both EnableClampMoveDown inputs, ClampingBeamSlowSpeedLimit and the RequestClampMoveDown output, but it never assigns a pin to FoldGuardClampingBeamLaser. The clamp-close speed decision in RunSingleBend.c only consulted two inputs, ClampingBeamInhibited and FoldGuardClampingBeamLaser. With neither defined it always chose slow. That set the safe-speed flag, the discrete open-loop state machine started the move in its slow state, and that state has no transition back to fast. FoldGuardActive was consulted only to skip the safety-stop-height stop, never for speed. Jogging already treated FoldGuardActive as permission for fast, so jog and automatic behaved differently.

Fix. Added a third permitting term to the SlowSpeed expression at RunSingleBend.c:883-889. Fast is now allowed when FoldGuardActive is defined and on, and no FoldGuard laser input is defined. The two existing terms are unchanged.

Safety behaviour.

If a configuration maps the FoldGuard laser, the laser term still decides. A blocked laser is never overridden by FoldGuardActive. Slowing down remains the FoldGuard's responsibility through the ClampingBeamSlowSpeedLimit input. If it is on at move start the clamp starts in slow. If it turns on mid-move the existing handler issues a slow command, the loop drops to slow and the fast select clears on the next 1 ms cycle. Once slow, the clamp stays slow for the rest of that close. Automatic now matches the existing jog behaviour. Expected result on the machine. With FoldGuardActive on and the slow limit off, the clamp starts in slow for the configured slow-start time, then the fast select comes on until the slow distance or until the FoldGuard asserts the slow limit.

Not changed. The double-bend close in RunDoubleBend.c always passes safe speed and has no laser term, so HyperDrive and TwinPro handshake machines still close in slow. Left as is pending a decision.

SCN: 5432 — 5226; Exception Error Recovery Fix

Changes made for Pathfinder 5226 controllers.

What was ported from the XL200 file (the three real diagnostic fixes):

Naked Exception_ISR stub that pushes R4-R11 before any compiler-emitted code, then branches to a new C body. The old version read R4-R11 from inside a C function and only worked by luck of register allocation. Correct frame selection for nested faults. The body now reads the hardware frame from the interrupt stack when the fault interrupted an ISR, and from PSP only for a task-context fault. The old code always read PSP, which blamed an unrelated task on every ISR-context crash. PSP/MSP transposition fix in both Exception_ISR and Exception_Error. The struct has PSP_Reg at 0x48 and MSP_Reg at 0x4C, but the asm stored them the other way round, so the printout in BlackBox.c and the CmdErrors.c UDP reply showed each under the other's label. Flash records written before this change are still swapped. What I verified against this workspace's MQX 4.2 before porting: the dispatcher in dispatch.S pushes lr then exactly four words, so the 20-byte nested-frame offset holds; cortex.h is identical between the K60 and K66 psp libs; MQX_USE_IO_OLD is 1 so the context struct is 16 bytes and the compile-time size check will pass; the psp directory is already on this project's include path; and READY is defined in Flash_Routine.h, so the #undef READY is needed here too.

Deliberately left out as XL-specific: Exception_Error_No_Reset, the bReset parameter on Exception_Log, the Disable_5387() call and AMS_5387.h include, Get_Task_Error(), the is_Task_Error() guard inside the flash-write loop, and the XL rewrite of that loop. The 5226 Exception_Log, CPLD reset, and high-speed-mode handling are untouched.

Not touched: Hardware_Common_5226_Board and HW_Common_5226_Board carry their own older copies of this file and were left alone. The file's 0xA9 copyright byte and CRLF endings were preserved and verified.