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

More
15 Jan 2024 08:52 - 15 Jan 2024 09:11 #290742 by TOLP2
I can confirm that on my RPi4 this behavior does also occur with the latest image. The steps were modified from an installation using Raspbian + LinuxCNC with RTAI. So there is a difference between Rapsbian and the base-image used by LinuxCNC.

Tonight I have more time to look into this issue and will modify the manual when I find a solution. Things that are an issue now:
  • the PATH-variable is not set when installing;
  • therefore litexcnc cannot be found after a restart;
  • therefore also the toolchain cannot be found after a restart.

I'm not sure whether the missing shared library can also be attributed to this problem. It might got broken during your trying to fix the problem. IT is not Yosys missing GLIBC, by Python. So by changing LD_LIBRARY_PATH something got broken, because Python does not know where to look anymore....

Edit:
I created an issue on GitHub: github.com/Peter-van-Tol/LiteX-CNC/issues/74

Progress on solving this issue will be logged on GitHub. When the issue is resolved, I will give a heads up in this topic. Thank you for reporting this issue.
Last edit: 15 Jan 2024 09:11 by TOLP2.
The following user(s) said Thank You: tommylight

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

More
15 Jan 2024 19:53 - 15 Jan 2024 19:58 #290789 by TOLP2
The problem has been identified. When running bash from the desktop, the file .profile is not loaded. This file contains the settings for PATH. Because it is not loaded, the litexcnc and the toolchain cannot be found. I tested with SSH, so therefore I didn't detect this error before.

As a temporary fix, one can add the following lines to ~/.bashrc:
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi
# set PATH so it includes oss-cad-suite
if [ -d "/home/cnc/toolchain/oss-cad-suite/bin" ] ; then
PATH="/home/cnc/toolchain/oss-cad-suite/bin:$PATH"
fi

After restarting the terminal it works. 

NOTE: the variable LD_LIBRARY_PATH should not be changed.. When changed, it should be changed back to the original.
Last edit: 15 Jan 2024 19:58 by TOLP2.

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

More
15 Jan 2024 21:34 #290803 by TOLP2
The problem has been resolved in version 1.2.1, which has been released on pypi.org. Also, the documentation has been updated.

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

More
15 Jan 2024 23:08 #290809 by uba100
Thank you very much for your help.
Now it seems to work.
To be on the safe side, I reinstalled the image on the SD card and followed all the steps as described in the documentation here
litex-cnc.readthedocs.io/en/latest/raspberrypi.html
described here.
After reading these lines here:
# set PATH so it includes oss-cad-suite
if [ -d "/home/cnc/toolchain/oss-cad-suite/bin" ] ; then
PATH="/home/cnc/toolchain/oss-cad-suite/bin:$PATH"
fi
in my /.bashrc, the compilation of the JSON file seems to work.
I do get the error message at the end:

ERROR: Cell 'watchdog0$tr_io' cannot be bound to bel 'X0/Y44/PIOD' since it is already bound to cell 'gpio_out0$tr_io'
0 warnings, 1 error
Traceback (most recent call last):
File "/home/cnc/.local/bin/litexcnc", line 8, in <module>
sys.exit(cli())
^^^^^
File "/home/cnc/.local/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/cnc/.local/lib/python3.11/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/home/cnc/.local/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/cnc/.local/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/cnc/.local/lib/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/cnc/.local/lib/python3.11/site-packages/litexcnc/cli/build_firmware.py", line 58, in cli
builder.build(run=build)
File "/home/cnc/toolchain/litex/litex/litex/soc/integration/builder.py", line 350, in build
vns = self.soc.build(build_dir=self.gateware_dir, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/cnc/toolchain/litex/litex/litex/soc/integration/soc.py", line 1205, in build
return self.platform.build(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/cnc/toolchain/litex/litex/litex/build/lattice/platform.py", line 43, in build
return self.toolchain.build(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/cnc/toolchain/litex/litex/litex/build/lattice/trellis.py", line 236, in build
_run_script(script)
File "/home/cnc/toolchain/litex/litex/litex/build/lattice/trellis.py", line 174, in _run_script
raise OSError("Error occured during Yosys/Nextpnr's script execution.")
OSError: Error occured during Yosys/Nextpnr's script execution.

But this seems to me to be an error in the example file 5a-75b_v8.0_i12o14p6s6e6.json.
The following user(s) said Thank You: TOLP2

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

More
15 Jan 2024 23:22 #290810 by uba100
The configuration actually seems to be OK. I can't find any errors in the 5a-75b_v8.0_i12o14p6s6e6.json.

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

More
16 Jan 2024 22:12 #290912 by TOLP2
The configuration was not OK, my apologies.

The cause is that I changed the config because of a changed watchdog. I forgot however to remove the pin used in the watchdog in the GPIO out. this means a pin was used twice in the config, leading to errors.

I have changed the configuration files in the documentation, or you can remove the line:
                {"direction": "out", "pin":"j1:8" , "name":"j1:9" },
from the configuration file.

I messed up with a commit, my apologies. 

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

More
17 Jan 2024 00:37 #290916 by uba100
Thank you very much,
it works now. The firmware has been successfully created. Flashing the firmware to the board was also reported as successful. I will test whether it works in the next few days. I did not get a V8.0 but a V8.2 when I bought it. However, when comparing my board with the V8.0 described on the Internet, I could not find any differences in the hardware. The apparently successful flashing process also seems to confirm this.
Best regards
The following user(s) said Thank You: TOLP2

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

More
17 Jan 2024 06:33 - 17 Jan 2024 09:28 #290927 by TOLP2
The v6.x, v8.0 and v8.2 are identical, so no changes are required to your board or config.

Thank you for helping resolving this issue.
Last edit: 17 Jan 2024 09:28 by TOLP2.

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

More
17 Jan 2024 15:43 #290963 by uba100
I have tried to connect to the board.
As you can see, I can successfully ping the board after flashing. So I think that the flashing was successful,

cnc@raspberrypi:~$ ping -c 5 10.0.0.10
PING 10.0.0.10 (10.0.0.10) 56(84) bytes of data.
64 bytes from 10.0.0.10: icmp_seq=1 ttl=128 time=0.257 ms
64 bytes from 10.0.0.10: icmp_seq=2 ttl=128 time=0.149 ms
64 bytes from 10.0.0.10: icmp_seq=3 ttl=128 time=0.164 ms
64 bytes from 10.0.0.10: icmp_seq=4 ttl=128 time=0.175 ms
64 bytes from 10.0.0.10: icmp_seq=5 ttl=128 time=0.162 ms

--- 10.0.0.10 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4080ms
rtt min/avg/max/mdev = 0.149/0.181/0.257/0.038 ms
cnc@raspberrypi:~$


The Litexcnc driver can also be loaded in halrun.

cnc@raspberrypi:~$ halrun
halcmd: loadrt litexcnc
Note: Using POSIX realtime
litexcnc: Loading Litex CNC driver version 1.1.0
litexcnc: Loading and registering default modules:
litexcnc: Registered module gpio
litexcnc: Registered module pwm
litexcnc: Registered module encoder
litexcnc: Registered module step
halcmd:

But the connection to the board via eth does not work.

halcmd: loadrt litexcnc_eth connections="eth:10.0.0.10"
Unknown parameter `connections=eth:10.0.0.10'
<stdin>:4: waitpid failed /usr/bin/rtapi_app litexcnc_eth
<stdin>:4: /usr/bin/rtapi_app exited without becoming ready
<stdin>:4: insmod for litexcnc_eth failed, returned -1
halcmd:

Have I forgotten a step?

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

More
17 Jan 2024 16:58 #290968 by uba100
I must apologize.
I read the command: "litexcnc_eth" incorrectly from a forum.
The first command is correct:
"loadrt litexcnc" to append the "connections=eth:10.0.0.10".
Then the output looks better.

cnc@raspberrypi:~$ halrun
halcmd: loadrt litexcnc connections="eth:10.0.0.10"
Note: Using POSIX realtime
litexcnc: Loading Litex CNC driver version 1.1.0
litexcnc: Loading and registering default modules:
litexcnc: Registered module gpio
litexcnc: Registered module pwm
litexcnc: Registered module encoder
litexcnc: Registered module step
litexcnc: Setting up board drivers:
litexcnc: Registered driver eth
LitexCNC-eth: connected to board on '10.0.0.10:1234'
litexcnc: Setting up modules...
litexcnc: Reading 36 bytes
litexcnc: - Watchdog
litexcnc: - Wallclock
litexcnc: - gpio ... done!
litexcnc: - pwm ... done!
litexcnc: - encoder ... done!
litexcnc: - step ... done!
litexcnc: Creating read and write buffers...
litexcnc: Base addresses: init: 00000000, reset: 00000044, config: 00000048, write: 0000004C, read: 000000C8
litexcnc: - Write buffer: 124 bytes
litexcnc: - Read buffer: 96 bytes
litexcnc: Exporting functions...

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

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