Add FPGA steppers peripheral - #2
Merged
Merged
Conversation
…rify stepper position memory. * this time using a single steppers peripheral instance
…ecreasing' for clarity.
* enable if you need to debug a failing test.
* note, overriding doesn't work properly! #defmt #bug - knurling-rs/defmt#1086
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The peripheral manages 2 banks of 4 stepper outputs (step/dir) signals.
They are split into two banks because of the hardware on the MakerPnPControl board has 2 sockets, one bank per socket.
Step signals are generated as follows:
Since the FPGA used on the MakerPnPControl board is cheap and has no DSP/math functions, there is no floating point math at all on the FPGA, the MCU does it. MCUs are better for this anyway. It also means that regardless of the stepper system, the MCU controls the motion calculation and the FPGA executes the motion, uninterrupted by MCU concerns, such as interrupts or task management, the result is a step-accurate jitter free solution.
The units the FPGA works in is a 'step', so there is no drift-over-time concerns in the hardware. The MCU just needs to calculate the amount of steps. The MCU can use encoder feedback to make correction, but that is out-of-scope of the hardware implementation in this PR.
Many human attempts were created prior to this version, all ultimately failed, various reasons:
In the end, the lessons learned and human written test-benches and skeleton code from previous attempts were use to prompt AI (Claude) into making an implementation that works, and has a lower LC usage than this lowly human was able to achieve.
Example s-curve that was calculated in the testbench by capturing the step/dir pulses over time:

captured_scurve.csv
Here's the communication log for the s-curve test, see
steppers_motion_tb.v.