LitexCNC: firmware and driver for 5A-75B and 5A-75E

More
16 Oct 2023 19:19 #283137 by TOLP2
In a previous  topic  firmware and driver has been developed for the 5A-75B and the 5A-75E, originally by the user Romanetz. Based this work I created a generic CNC firmware and driver for FPGA cards which are supported by LiteX, hence the name Litex-CNC . Configuration of the board and driver is done using json-files. The supported boards are the Colorlight boards 5A-75B and 5A-75E, as these are fully supported with the open source toolchain.

Installation
At this moment, version 1.0.2 has been released on pypi.org . You can install using pip:pip install litexcnc[cli]

NOTE: Suffix 

[cli]
 required!
The suffix 
[cli]
 is required to install the command-line interface. Without this suffix the scripts referenced below will not work.

After installation of LitexCNC the following scripts are available to the user:litexcnc install_driver
litexcnc install_litex
litexcnc install_toolchain
litexcnc build_driverFor a full overview on how to use the commands, please refer to the  documentation .

Supported modules
Currently the following modules are supported:
  • GPIO
  • Stepgen
  • PWM / PDM
  • Encoders
The platform can be extended by creating more modules. These modules can be maintained outside the LitexCNC main branch, meaning external parties can also contribute, or make specific modules aimed at their machines.

Future developments
At this moment the connection between the PC running LinuxCNC and the 5A-75X is done by Ethernet. Specifically for the Raspberry Pi currently a connection over SPI has been developed. This feature is still experimental and requires installation from source.If you want to try it, please let me know and I'll guide you through the installation. This feature will be released as soon as it has been tested further with my other development: the HUB75HAT (more details will follow).

Modules are relatively easy to create. Please post ideas for new modules in the GitHub discussions for future expansion of the possibilities.

Need help?
Feel free to drop a message on this forum, or start a new  in the GitHub discussions .

 
The following user(s) said Thank You: tommylight, meister, besriworld, deanforbes, Pro_El, COFHAL, DHeineck, mh300, svb, hoangnhatng and 1 other people also said thanks.

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

More
06 Nov 2023 13:45 - 06 Nov 2023 13:49 #284701 by TOLP2
Last Saturday I've launched this open-source project in The Netherlands during a CNC Tech Meetup, so I opened the repository. You can find it here .



The board features:

Designed for Raspberry Pi 4 and 5 (the older version RPi 3 might also work) with SPI communication
  • 3 I/O connectors:
    • each 17 pins of freely addressable inputs / outputs;
    • selectable 10 kOhm pull-down or pull-up resistor;
    • optional 5V power supply on the connector;
  • 2 RS489 connectors for communication with VFD's or other peripherals (powered by Rasberry Pi);
  • number of GPIO can be extended by using serial connection through the three I/O connectors (up to 64 GPIO per serial channel);
  • eco-system of break-out boards designed for the HUB75HAT is under development. Currently the following boards are available:
    • BOB4STEPGEN: 4 differential stepgen drivers with ENA, DIR, PULSE outputs and ALARM input. The board also has 4 inputs for homing switches, which can be individually selected to be either NPN or PNP.
    • BOB4ENCODER: 4 differential encoders with A, B and Z (index) channels. Per channel it can be selected whether it is differential or single ended, allowing re-use of possible unused channels. This board also features connectors for serial daughter boards for expanding GPIO or attaching other sensors.
Total cost of building the HAT (excluding the Raspberry Pi, but including the 5A-75B) is around 35 Euro.

There is still some work to do in that repo, for example the board has the following issues:
  • the space around the 40 pin connector of the HAT is a bit tight with the mounting points of the RPi. The solution to work with the current board is to use plastic stand-offs and cut part of these away.
  • the enable signal should be inverted on the board, because the buffer Output Enable (OE) is active LOW. I rather send a HIGH signal to the board to enable it (safety).
  • enable LED is not working (can also be a problem with the buffer IC, had some trouble with soldering this buffer). However, even if this LED was working, it would indicate that the board would be disabled (see previous point);
  • The 3 I/O headers do not have space for shrouded headers. Instead, I chose to use colored pin headers to show the different functions of the pins;
Last edit: 06 Nov 2023 13:49 by TOLP2.
The following user(s) said Thank You: tommylight, besriworld, deanforbes, MennilTossFlykune, cornholio

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

More
07 Nov 2023 00:19 #284739 by cornholio
Top work mate, it's been a long journey good to see the results.
The following user(s) said Thank You: TOLP2

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

More
09 Nov 2023 08:24 #284922 by TOLP2
Just released version 1.1.0 to PyPi!

Added new drivers for SPI communication. For current users this requires a minor modification in their configuration files. The connection entry in the config-file must be altered to include the field connection_type. See for further guidelines on the parameters for the connection, including the new SPI connection, the updates help-files.

Further minor changes to the CLI:
  • install_litex: DEPRECATED, the functionality has been transferred to install_toolchain.
  • install_toolchain: Also installs Litex, and on a RaspberryPi also OpenOCD.
  • flash_firmware: Flashes the firmware to the LED-card using OpenOCD. Designed for flashing with a RaspberryPi, however other adapters can also be selected by their name.

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

More
29 Dec 2023 22:03 #289335 by TOLP2
Just released version 1.2.0 to PyPi with support for Raspberry Pi 5!

This release brings furthermore:
  • An updated watchdog module with an enable pin. This enable pin is HIGH as long the watchdog is happy. It will go LOW when the watchdog bites, for example when the communication gets disrupted. This enable pin can be used to control / disable buffers to bring the machine to a safe state. When recompiling a card, modification of the configuration file is required.
  • Several bug-fixes:
    • in the CLI (correct detection of 64-bit RPi);
    • PWM does not generate errors / warning at compilation;
    • pin numbering of HUB75HAT has been corrected (connectors were mirrored);
    • resolved error with GPIO when there are only inputs or outputs defined..
The following user(s) said Thank You: tommylight

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

More
30 Dec 2023 06:03 #289360 by cakeslob

the space around the 40 pin connector of the HAT is a bit tight with the mounting points of the RPi. The solution to work with the current board is to use plastic stand-offs and cut part of these away.


imo,just dont do it that way. it makes everything tall and awkward, and honestly it sucks this way. PCW said for the new 7c81, he offset the bottom header so its not longer like that.

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

More
30 Dec 2023 14:44 #289382 by TOLP2

the space around the 40 pin connector of the HAT is a bit tight with the mounting points of the RPi. The solution to work with the current board is to use plastic stand-offs and cut part of these away.


imo,just dont do it that way. it makes everything tall and awkward, and honestly it sucks this way. PCW said for the new 7c81, he offset the bottom header so its not longer like that
 

I produced version 1.1 of the board, in which the header has been moved so it does not clash with stand offs. 

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

More
05 Jan 2024 21:41 #289906 by Ehsan_R
Please share with us an example for a six-axis machine that includes all the provided modules along with the INI file.

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

More
05 Jan 2024 22:14 #289907 by TOLP2
This will be guessing in the dark for me:
  • my machine is only a 3 axis machine with 4 joints (there is a slave axis);
  • to dial in a machine, more information is required.
I can supply you with a basic example of a machine with 3 axis / 4 joints. From that point you have to extend it to your own requirements.

To start, I think you require a configuration for your 5A-75E LED card. On any Linux machine you can install Litex-CNC to create the firmware:
pip install litexcnc[cli]
litexcnc install_toolchain
litexcnc install_driver

Note: install driver only works when you also have LinuxCNC installed on the machine.

Then create a file with the configuration of your machine (sample_config.json, for example (assuming you've received a version 8.X of the LED card) with 4 axis:
{
    "board_name": "example",
    "board_type": "5A-75E v6.0",
    "clock_frequency": 40000000,
    "connection": {
        "connection_type": "etherbone",
        "tx_delay": 0,
        "ip_address": "10.0.0.10",
        "mac_address": "0x10e2d5000000"
    },
    "watchdog": {
        "pin":"j1:8"
    },
    "modules": [
    {
        "module_type": "stepgen",
        "instance": [
            {
                "pins" : {
                    "stepgen_type": "step_dir",
                    "step_pin": "j1:0",
                    "dir_pin": "j1:1"
                },
                "soft_stop": true
            }, {
                "pins" : {
                    "stepgen_type": "step_dir",
                    "step_pin": "j2:0",
                    "dir_pin": "j2:1"
                },
                "soft_stop": true
            }, {
                "pins" : {
                    "stepgen_type": "step_dir",
                    "step_pin": "j3:0",
                    "dir_pin": "j3:1"
                },
                "soft_stop": true
            }, {
                "pins" : {
                    "stepgen_type": "step_dir",
                    "step_pin": "j4:0",
                    "dir_pin": "j4:1"
                },
                "soft_stop": true
            }
        ]
    ]
}

Now you can build the firmware and flash your card
litexcnc build_firmware sample_config.json -a --build
cd example/gateware
litexcnc flash_firmware <filename-with-extension-svf>

Note: the example above assumes an IP-address of 10.0.0.10. The machine where the card is connected to must have its network configured to the same subnet (i.e. 10.0.0.1 as fixed address with subnet 255.255.255.0)

If you have LinuxCNC installed on the machine, you can test the connection with the card and show the created pins. Start a the hal with halrun and type the following commands:
loadrt litexcnc connections="eth:10.0.0.10"
show pin
show param
show function

This is a basis from where you should be able to get started. Please also see the documentation . When things are not clear in the documentation, please help to improve.

Just to be clear: I will not create full setups for machines based on minimal information. I am a hobbyist: developing the software is done in my spare time and I help as many people I can. I will however always improve the software and documentation when people submit bugs, enhancements or improvements.
 
The following user(s) said Thank You: Ehsan_R

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

More
06 Jan 2024 10:17 #289943 by Ehsan_R
Thank you very much for your guidance.
Hoping that I will pay my share in advancing the goals of this project

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

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