AN 999: Drive-on-Chip with Functional Safety Design Example: Agilex™ 7 Devices
Visible to Intel only — GUID: jou1716294613293
Ixiasoft
Visible to Intel only — GUID: jou1716294613293
Ixiasoft
4.3.1.2. Cross-Comparison Block
When triggered in the initial init state by the timer, the state machine waits a clock cycle for the payload to be generated before writing it to the shared memory. The FPGA status location is then updated in the shared memory to indicate that the FPGA payload is valid. The state machine then waits, checking the shared memory location for the HPS status to determine when the HPS writes its payload data to the shared memory. The design performs cross comparison that verifies that the payload sequence number in the two payloads matches and also that the two speeds match to within the allowed tolerance. Various factors determine the acceptable tolerance between the two speed estimations:
- The maximum acceleration of the motor
- The interrupt response time in the HPS software
- The alignment of the 4 kHz speed estimation sampling between the HPS and FPGA
- Clock cycle tolerance in the sampling of the encoder quadrature. One decoder can sample a change in the quadrature signals one clock cycle after the other.
Although the overspeed flag is in the payload data, the design does not cross compare flags because tolerances in the speed estimation means that one speed estimation can be just over the threshold and one just under. Hence the overspeed flags not matching is a valid condition.
The state machine then updates the FPGA status in the shared memory to indicate when the FGPA completes its cross comparison. The state machine then waits, monitoring the HPS status for its cross comparison to be complete.
The FPGA state machine then clears the HPS status in the shared memory and the HPS reciprocally clears the FPGA status in the shared memory. This handshaking ensures that state machines in the FPGA and HPS remain synchronized with each other. The FPGA state machine then returns to the initial state and the process repeats.
Between the generate state and returning to the init state, the design enables a watchdog timer. This watchdog prevents the FPGA state machine from waiting indefinitely for the HPS. If the watchdog expires, the state machine transitions to the error state and the compare_good_p/n output pair is asserted. The design only exits the error state when the reset_safety_n input is asserted (active-low).