ColorCNC Colorlight 5A-75E/5A-75B as FPGA controller board

More
24 Oct 2022 17:33 #254924 by svb
I'm use 75e v8 with definition from v6, all work nicely

Please Log in or Create an account to join the conversation.

More
25 Oct 2022 04:36 #254990 by xu
你现在已经在机床上稳定的运行了吗?

Please Log in or Create an account to join the conversation.

More
31 Oct 2022 19:59 #255602 by TOLP2
BIG NEWS: the stepgen of Litex-CNC is finally stable!

I took nearly a full re-write of the stepgen code to find the errors:
  • the stepgen supports S-curve acceleration, although the current implementation does not use it. By creating this modification it turned out that in some corner cases the apply-time in the FPGA can be overwritten by the next packet. This mainly affected systems with high amount of jitter. This has been solved in the FPGA firmware, which copies the apply-time to a local register, i.e. a kind of queue with space to buffer one full cycle.
  • the apply time is designed to be 0.9 x period after the start of the current cycle. The motmod should be fed with the predicted position at the next apply time. Problem here was jitter: the position could not be determined with high enough precision. This resulted in the stepper not running as smooth as I wanted (my benchmark is the LPT port, should be equal or better). Also I discovered there is a clock drift between LinuxCNC and the FPGA. To solve this, the amount of clock-cycles is averaged over 10 cycles. This average is used to calculate the amount of clock-cycles per cycle and prevents overshooting the commanded position. It is safe-guarded that the apply time is always within safe limits.
  • the algorithm is now basically the same as the stepgen of LinuxCNC, with some modifications to improve accuracy (I could recommend those changes also to the regular stepgen). 
My sincere apologies that this took too long. This was more difficult then I anticipated, due to the errors being in multiple layers. 

That said: this never more (but in a positive way). Before I merge the branch stepgen_improvement I'm going to split the current stepgen into two parts:
  • the actual stepgen, part of LitexCNC which is responsible to translate a commanded speed to a command to the FPGA to produce steps.
  • the translation from motmod's position command to a velocity that can be used by the stepgen. This will be a separate component (pos2vel).
This approach has as a benefit that I can still work on developing S-curve acceleration on a separate component in the future, whilst for regular applications Litex-CNC can be still used. The other benefit is that the component pos2vel can also be used for the other implementations of the  colorlight cards.

@Xu: If Google translate works well, the answer is 是的 (yes). 
The following user(s) said Thank You: tommylight, besriworld

Please Log in or Create an account to join the conversation.

More
01 Nov 2022 17:58 #255678 by besriworld
Great news! I can test soon :) .
It can easily be used with my I/O board forum.linuxcnc.org/24-hal-components/329...i76e?start=20#248772
If anyone is interested, I can upload the latest version.
The following user(s) said Thank You: TOLP2

Please Log in or Create an account to join the conversation.

More
03 Nov 2022 10:33 #255830 by TOLP2
I am interested. I saw in th downloads that the PDF with the schematics something went wrong with the export. Each page is shifted a little bit downwards in the margins, so the last pages are mostly blank.

Would be wonderful to have a sort of HAT for the 5A-75E with for example:
- 6 stepgens (with DIR, STEP, ENA and ALARM (input)) = >24 pins
- 6 PWM with 0 - 10 Volt ouput
- some GPIO - in (for limit switches, button encoders, etc). How many?
- some GPIO - out - how many do we need?
- 1 or two expansion slots for future developments (like MPG, LCD or sensors?

I finished the split between stepgen and pos2vel-converter. I will push that tonight, as I need to add the example how to connect is in the HAL. Runs smoother then ever before.
The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

More
03 Nov 2022 22:10 - 04 Nov 2022 21:48 #255870 by TOLP2
I pushed the separated stepgen and converter to my GitHub in the branch stepgen_improvement. To use this version, one must modify their HAL-file, below is an example for a single axis.
loadrt [KINS]KINEMATICS
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS
loadrt litexcnc
loadrt litexcnc_eth config_file="[LITEXCNC]CONFIG_FILE"
loadrt pos2vel number=1

# Add the functions to the thread
addf [LITEXCNC](NAME).read servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf pos2vel.convert servo-thread
addf [LITEXCNC](NAME).write servo-thread

[...]

########################################################################
STEPGEN
########################################################################
# - timings (prevent re-calculation)
net pos2vel.period-s       <= [LITEXCNC](NAME).stepgen.period-s
net pos2vel.period-s-recip <= [LITEXCNC](NAME).stepgen.period-s-recip

STEPGEN - X-AXIS
########################################################################
# POS2VEL
# - position control
net xpos-fb  <= [LITEXCNC](NAME).stepgen.00.position_prediction
net xpos-fb  => joint.0.motor-pos-fb
net xpos-fb  => pos2vel.0.position-feedback
net xvel-fb  pos2vel.0.velocity-feedback <= [LITEXCNC](NAME).stepgen.00.velocity-prediction
net xpos-cmd pos2vel.0.position-cmd      <= joint.0.motor-pos-cmd
# - settings
setp pos2vel.0.max-acceleration [JOINT_2]STEPGEN_MAXACCEL
# setp pos2vel.0.debug 1

# STEPGEN
# - Setup of timings
setp [LITEXCNC](NAME).stepgen.00.position-scale   [JOINT_2]SCALE
setp [LITEXCNC](NAME).stepgen.00.steplen          5000
setp [LITEXCNC](NAME).stepgen.00.stepspace        5000
setp [LITEXCNC](NAME).stepgen.00.dir-hold-time    10000
setp [LITEXCNC](NAME).stepgen.00.dir-setup-time   10000
setp [LITEXCNC](NAME).stepgen.00.max-velocity     [JOINT_2]MAX_VELOCITY
setp [LITEXCNC](NAME).stepgen.00.max-acceleration [JOINT_2]STEPGEN_MAXACCEL
# setp [LITEXCNC](NAME).stepgen.00.debug 1
# - Connect velocity command
net xvel-cmd <= pos2vel.0.velocity-cmd
net xvel-cmd => [LITEXCNC](NAME).stepgen.00.velocity-cmd1
net xvel-cmd => [LITEXCNC](NAME).stepgen.00.velocity-cmd2
# - Set the acceleration to be used (NOTE: pos2vel has fixed acceleration)
setp [LITEXCNC](NAME).stepgen.00.acceleration-cmd1 [JOINT_2]STEPGEN_MAXACCEL
setp [LITEXCNC](NAME).stepgen.00.acceleration-cmd2 [JOINT_2]STEPGEN_MAXACCEL
# - enable the drive
net xenable joint.0.amp-enable-out => [LITEXCNC](NAME).stepgen.00.enable
########################################################################

[...]


[b]Installation[/b]
To install components, one has to compile three components with the command below (assuming your current working directory is ./driver):
[code]
sudo halcompile --install ./stepgen/pos2vel.c litexcnc.c litexcnc_eth.c

Edit:
I removed the known issues, as they are now solved in the driver. Also updated the example with the revised pins.
Last edit: 04 Nov 2022 21:48 by TOLP2. Reason: Update of the source code

Please Log in or Create an account to join the conversation.

More
03 Nov 2022 22:17 #255871 by TOLP2
To create an I/O hat for the 5A-75E, I'm wondering whether somebody has:
  • A CAD or GERBER-file with the precise locations of the headers of the FPGA controller board
  • Some detailed pictures (or just IC numbers) of a MESA card. I'm really wondering how they buffer / isolate their in- and outputs.
The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

More
06 Nov 2022 06:20 - 06 Nov 2022 06:22 #256042 by wuyatom
 /
\
 |                                                                            |
 |  yosys -- Yosys Open SYnthesis Suite                                       |
 |                                                                            |
 |  Copyright (C) 2012 - 2018  Clifford Wolf <This email address is being protected from spambots. You need JavaScript enabled to view it.>           |
 |                                                                            |
 |  Permission to use, copy, modify, and/or distribute this software for any  |
 |  purpose with or without fee is hereby granted, provided that the above    |
 |  copyright notice and this permission notice appear in all copies.         |
 |                                                                            |
 |  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES  |
 |  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF          |
 |  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR   |
 |  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES    |
 |  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN     |
 |  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF   |
 |  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.            |
 |                                                                            |
 \
/

 Yosys 0.8 (git sha1 5706e90)


-- Executing script file `colorlight_5a_75e.ys' --

1. Executing Verilog-2005 frontend.
Parsing Verilog input from `/home/wuya/LiteX-CNC/5a-75e/gateware/colorlight_5a_75e.v' to AST representation.
Storing AST representation for module `$abstract\colorlight_5a_75e'.
Successfully finished Verilog frontend.

2. Executing ATTRMAP pass (move or copy attributes).

3. Executing SYNTH_ECP5 pass.

3.1. Executing Verilog-2005 frontend.
Parsing Verilog input from `/usr/bin/../share/yosys/ecp5/cells_sim.v' to AST representation.
Lexer warning: The SystemVerilog keyword `assert' (at /usr/bin/../share/yosys/ecp5/cells_sim.v:409) is not recognized unless read_verilog is called with -sv!
Lexer warning: The SystemVerilog keyword `assert' (at /usr/bin/../share/yosys/ecp5/cells_sim.v:410) is not recognized unless read_verilog is called with -sv!
Lexer warning: The SystemVerilog keyword `assert' (at /usr/bin/../share/yosys/ecp5/cells_sim.v:411) is not recognized unless read_verilog is called with -sv!
Lexer warning: The SystemVerilog keyword `assert' (at /usr/bin/../share/yosys/ecp5/cells_sim.v:412) is not recognized unless read_verilog is called with -sv!
Generating RTLIL representation for module `\LUT4'.
Generating RTLIL representation for module `\L6MUX21'.
Generating RTLIL representation for module `\CCU2C'.
Generating RTLIL representation for module `\TRELLIS_RAM16X2'.
Generating RTLIL representation for module `\PFUMX'.
Generating RTLIL representation for module `\TRELLIS_DPR16X4'.
Generating RTLIL representation for module `\DPR16X4C'.
Generating RTLIL representation for module `\LUT2'.
Generating RTLIL representation for module `\TRELLIS_FF'.
Generating RTLIL representation for module `\OBZ'.
Generating RTLIL representation for module `\IB'.
Generating RTLIL representation for module `\TRELLIS_IO'.
Generating RTLIL representation for module `\OB'.
Generating RTLIL representation for module `\BB'.
Generating RTLIL representation for module `\INV'.
Generating RTLIL representation for module `\TRELLIS_SLICE'.
Successfully finished Verilog frontend.

3.2. Executing HIERARCHY pass (managing design hierarchy).

3.3. Executing AST frontend in derive mode using pre-parsed AST for module `\colorlight_5a_75e'.
Generating RTLIL representation for module `\colorlight_5a_75e'.

3.3.1. Analyzing design hierarchy..
Top module:  \colorlight_5a_75e
ERROR: Module `\IDDRX1F' referenced in module `\colorlight_5a_75e' in cell `\IDDRX1F_4' is not part of the design.
I got an error compiling the firmware, I don't know why
 
Last edit: 06 Nov 2022 06:22 by wuyatom.

Please Log in or Create an account to join the conversation.

More
06 Nov 2022 09:08 #256052 by TOLP2
Please share:
- the version of Litex.
- the branch of Litex-CNC you have used. The current branch with the latest updates is 'stepgen_improvement'.
- your configuration file used to create the bit-file.
- the type and make of your Led card, maybe it is the wrong type or you've found an incompatible version. The tool Yosys is only for Lattice ECP FPGA's and not for the RV901 which has a Spartan chipset.

For readability of the forum, please use the code tags to include the log on the forum.

Please Log in or Create an account to join the conversation.

More
06 Nov 2022 09:44 #256053 by wuyatom
mkdir LiteX
cd LiteX
wget raw.githubusercontent.com/enjoy-digital/...aster/litex_setup.py
python3 litex_setup.py --init --install --config=standard --gcc=riscv
git clone github.com/Peter-van-Tol/LiteX-CNC.git
install yosys
wget github.com/YosysHQ/oss-cad-suite-build/r...nux-x64-20220227.tgz && \
tar -xvf oss-cad-suite-linux-x64-20220227.tgz -C /opt/ && \
rm oss-cad-suite-linux-x64-20220227.tgz && \
echo '# set PATH so it includes oss-cad-suite' >> /etc/profile && \
echo 'if [ -d "/opt/oss-cad-suite/bin" ] ; then' >> /etc/profile && \
echo 'PATH="/opt/oss-cad-suite/bin:$PATH"' >> /etc/profile && \
echo 'fi' >> /etc/profile
5A-75E colorlight used,Command python3 -m firmware examples/5a-75e.json

Please Log in or Create an account to join the conversation.

Moderators: PCWjmelson
Time to create page: 0.153 seconds
Powered by Kunena Forum