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

More
17 Sep 2022 04:03 #252137 by svb
Great work, Peter. Will try to test as soon as possible. Big thanks for your work.
The following user(s) said Thank You: TOLP2

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

More
17 Sep 2022 06:25 #252140 by TOLP2
The PC currently used for testing is underpowered for large GCode files. However, I think this weekend I will copy the settings from the machine in the shed and run a lithophane as a test. If it runs the 8 hour job effortlessly, I think it passes the test.
The following user(s) said Thank You: besriworld

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

More
18 Sep 2022 11:01 #252250 by DePrutser
Thanks for all your hard work. I would like to build this:
LinuxCNC->Colorlight 5A-75E board->milling machine.

I have found a few github repositories (listed below), but they don't seem to contain enough verilog code to contain the complete gateware for the ECP5 FPGA. Where can I find that?

1) This pul request. Stepgen.v contains the module stepgen in the form of verilog source for the FPGA
github.com/LinuxCNC/linuxcnc/pull/1422/c...14270f3b3597a894e6b6

2) This github repository. Stepgen.ice contains verilog source that implements a pwm, a step-direction and general IO pins
github.com/Peter-van-Tol/LiteX-CNC

3) This github repository. This repository does not contain any verlog code
github.com/enjoy-digital/colorlite

Kind regards,
Cedric

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

More
18 Sep 2022 19:20 #252288 by TOLP2
@Cedric:
There is no Verilog in any of the repositories. The code of for the FPGA is being built using LiteX/Migen (hence the name of my version of the firmware-driver-combo). You have chosen a nice card to work with, as the whole toolchain for building the bit-file for the 5A-75E is available on Linux.

If you pull my repository (2) you can follow these steps to build the file:
  • install LiteX to generate the code
mkdir LiteX && \
    cd LiteX && \
    wget https://raw.githubusercontent.com/enjoy-digital/litex/master/litex_setup.py && \
    pip3 install --user  meson ninja && \
    python3 litex_setup.py --init --install --config=standard --gcc=riscv
  • install yosys for building to the target ECP5.
    wget https://github.com/YosysHQ/oss-cad-suite-build/releases/download/2022-02-27/oss-cad-suite-linux-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
  • create a configuration file which suits your machine (see for some examples the ./examples directory in the repository)
  • generate the code (assuming you are in the terminal in the root of the repository) and build it when successful
python -m firmware path/to/your/config/file
cd [i]card_name[/i]/gateware
chmod +x ./build_colorlight_5a_75e.sh
./build_colorlight_5a_75e.sh
​​​​​​

Flash the resulting .svf file to your 5A-75E and the FPGA is ready. Note that if you power-cycle the card, you have to re-flash it in this stage.

For installing the driver, I would like to revert to the README in the repository.

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

More
18 Sep 2022 19:35 #252292 by DePrutser
Thank you for the steps, I've started to document my journey here, I'll add them.
forum.linuxcnc.org/27-driver-boards/4692...c-on-linuxcnc#252287

When I got it working, I'm planning on extending your README.md and sending a pull request.

Cheers,
Cedric
The following user(s) said Thank You: TOLP2

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

More
18 Sep 2022 19:49 #252293 by DePrutser
I'm planning to use a couple of closed loop stepper motors [4,5]. This consists of a microcontroller, a power driver, and a angle sensor IC. It can be driven with step/direction inputs, and it then is able to catch up if steps are missed. But this is not reported back to the control system.

It would be cool if the FPGA is able to snoop on the SPI interface of the angle sensor IC [6], and convert that into a virtual encoder. That way LinuxCNC actually knows the angle of the stepper motor. I don't know how often the position is updated though, nor how LinuxCNC deals with an encoder that has a relative low update rate.

[4] github.com/makerbase-mks/MKS-SERVO57A
[5] nl.aliexpress.com/item/1005003891654533....gatewayAdapt=glo2nld
[6] www.allegromicro.com/-/media/files/datas.../a1333-datasheet.pdf

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

More
18 Sep 2022 20:07 #252295 by DePrutser
The angle sensor IC can be programmed to output a Quadrature (A,B,Index) signal.
In the schematic [7] of the MKS-SERVO57A, I see those three pins of the chip (12,13,14) to be floating.

Therefore there's no need to snoop the SPI bus, I can just route the 3 Quadrature pins back into the FPGA board, and patch the firmware of the microcontroller to enable those outputs.

[7] raw.githubusercontent.com/makerbase-mks/...A_V1.0_001%20SCH.pdf

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

More
19 Sep 2022 07:25 #252317 by TOLP2

[...]

When I got it working, I'm planning on extending your README.md and sending a pull request.

Cheers,
Cedric
 

Your pull request will be mroe then welcome to help with writing things down!

About the stepgens: just pushed a new commit in which:
  • the pick-off (the position of the fixed point) can be set (in code for now, if people want I can make it also user-configurable) with different settings for position, velocity and acceleration. This gives some smoother behavior on the stepper motor. For example, if I use the same pick-off for speed and position, the maximum speed attained will be a step with every clock of the FPGA (50 MHz in my case). This is ridiculously fast and as far as I know there is know stepper driver capable of doing this. The lowest step frequency will be 1 / 2^32 step per clock cycle, which boils down to 0.01 step per second. Especially with very low speeds or with ramping down this might lead to some vibrations. Therefor, the pickoff for velocity is now shifted with an additional 8 bits. The maximum step frequency now becomes 195 kHz, which is reasonable high and close to the max frequency of for example standard Leadshine or Lichuan driver (checked with the DM542). The minimum speed is now 0.00003 steps per second. Audibly this results in a much smoother running of the stepper motor.
  • the pick-off for acceleration was already shifted by 16 bits, otherwise it would be always zero. It is now also easy to re-configure this to another value.
  • In the firmware the shift of the acceleration relative to the position determines the extra bytes required. For a relative shift of 16 bits, this will consume 3 bytes of extra 'space' for the registers.
  • because above lead to changes in both firmware and driver, the version number is bumped. This version number will prevent users from combining incompatible firmware and driver.
With my tests I also discovered vibrations of the stepper motor at stand-still. This was not the default hissing of the driver, but it comes from a noise signal from the FPGA. I suspect that the motion planner and the error correction in the stepgen are fighting to get the error down to zero. I will check whether temporarily stopping the error-correction will solve this error this evening. 
The following user(s) said Thank You: besriworld, svb

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

More
20 Sep 2022 05:54 #252376 by DePrutser
LiteX-CNC is now working. Next I'll try to compile the gateware:
forum.linuxcnc.org/27-driver-boards/4692...itex-cnc-on-linuxcnc

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

More
20 Sep 2022 07:14 #252382 by TOLP2
Today a small improvement on the stepgen. When on standstill the stepper produced a buzzing sound, it was switching between two (micro-)steps. For standstill situations I improved the driver to prevent this instability to happen. The stepper is nog silent and still runs smooth.
The following user(s) said Thank You: besriworld

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

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