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

More
09 Jan 2023 08:47 #261339 by juergenmoser
@deroj I have downloaded the normal Buster image from the linuxcnc website 2.8.4 Buster (ISO) i can share you all the commands to install it - but with no warranties!  i have to check everything again and maybe make a installl script for this.. The only thing is i cannot make the bitfile in 2.8.4 - i make the bitfile in min21 ( In 2.8.4 I always get an error that yosys is missing but I already installed it!(to $PATH)

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

More
09 Jan 2023 10:08 #261342 by TOLP2

 

File Attachment:

File Name: install_driver.txt
File Size:36 KB
so i found the original halcompile and renamed it to halcompile1.
then i run the litexcnc install_driver again with no changes.

i attached the terminal output. maybe you can find my mistakes?
thank you

In the output there are two problems:
  1. it is compiled with warnings enabled. This gives insight that on 64-bit systems the formatting of the data-types in the print-statements is not correct. This warnings still lead to a driver which should work. I created an issue for this and found a solution for this problem. Apparently, warnings were not on my system or my development OS is 32-bit as well  (never checked that).
  2. The second problem is a linking problem which has been experienced by multiple users. This occurs when LinuxCNC 2.9 is used, cause is yet to be determined. I also created an issue for this.
At this moment only LinuxCNC 2.8.x is supported. 

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

More
09 Jan 2023 13:37 - 09 Jan 2023 13:40 #261351 by juergenmoser
@ TOLP2 I've now tried the Example with the STEPGEN.
 I copied the example from Read The Docs in my HAL File.
 I got an error by starting: pos2vel-cmd :
[code]
[code]net  pos2vel.0.velocity-cmd => Juergen.stepgen.00.velocity-cmd
[code]/my-mill.hal:62: Signal name 'pos2vel.0.velocity-cmd' must not be the same as a pin.  Did you omit the signal name?
[/code][/code]
[code]so i changed in the Hal:
[/code]
[code][code][code]net xpos-fp pos2vel.0.velocity-cmd => Juergen.stepgen.00.velocity-cmd
[/code][/code]
[/code]
[code][code]Is that right to put in after net the xpos-fp? I have to try it with a stepper... So for Now Lcnc starts and i get signals to the  pos -cmd
[/code][/code]
Last edit: 09 Jan 2023 13:40 by juergenmoser.
The following user(s) said Thank You: TOLP2

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

More
09 Jan 2023 15:27 #261356 by TOLP2
Thanks for your finding. I modified the documentation, the line should read:
net xvel_cmd pos2vel.0.velocity-cmd => [LITEXCNC](NAME).stepgen.00.velocity-cmd

NOTE: I used xvel_cmd as signal name, as this is the velocity command. It is an unique signal, if you had appointed an existing signal to this line, please rename it.
The following user(s) said Thank You: juergenmoser

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

More
09 Jan 2023 15:32 #261357 by juergenmoser
Okay Thank you. And for the other axes I take yvel and zvel?

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

More
09 Jan 2023 21:54 - 10 Jan 2023 12:39 #261386 by TOLP2

Okay Thank you. And for the other axes I take yvel and zvel?

Would recommend yvel_cmd and zvel_cmd, but any name will do as long as they are unique.

@deroj: I changed a small bit in my modified halcompile to show the errors (added print("EXTRA_CFLAGS += -Wall", file=f) to line 1117). Now I can reproduce the warnings you got. Going to solve these warnings, as I believe in clean code is better code. But, how did you get those warnings on your system, did you change halcompile as well or have a certain setting somewhere? Otherwise this is also a difference between the 2.8-family and 2.9.

Edit:
I solved now all compiler warnings in the code in the branch 7-resolve-compiler-warnings. I will leave the option -Wall as default to see any new warnings. In my opinion the driver should compile without any warning.

I also started on testing why the code fails to link on LinuxCNC 2.9. Created a new development container with Debian Bullseye and LinuxCNC 2.9.0-pre1, et voila, I can reproduce the error:
halcmd: loadrt litexcnc
Note: Using POSIX non-realtime
litexcnc: dlopen: /opt/linuxcnc/rtlib/litexcnc.so: undefined symbol: json_object_array_length
<stdin>:1: waitpid failed /opt/linuxcnc/bin/rtapi_app litexcnc
<stdin>:1: /opt/linuxcnc/bin/rtapi_app exited without becoming ready
<stdin>:1: insmod for litexcnc failed, returned -1
halcmd: Note: Using POSIX non-realtime

Now have to solve this one...
Last edit: 10 Jan 2023 12:39 by TOLP2.

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

More
11 Jan 2023 16:53 #261590 by deroj
@TOLP2
 But, how did you get those warnings on your system, did you change halcompile as well or have a certain setting somewhere?
Not, as I know...I just installed Linux Mint 21, then the debs with preempt kernel and linuxcnc, and then followed your python install instructions

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

More
12 Jan 2023 11:19 - 13 Jan 2023 23:06 #261679 by TOLP2
The warnings are solved now. The mostly stem from difference between 32-bit systems and 64bit and the formatting of numbers. Now I use inttypes to format the numbers, which solves the warnings. There were some other warnings as well, those have been solved at the same time.

For compiling it in LinuxCNC 2.9: something has changed in the linking; there is a notion of it in the CHANGELOG. However, I cannot find a way to successfully link the external library after this change. I decided to solve this by changing libjson-c to cJSON. The benefit of using cJSON is that this is a small library which can ben inlined in the driver. This requires a re-write of the driver on the configuration part. I rewrote the driver litexcnc_eth as a prove of concept and it works really well. 

The major work is now in rewriting the modules and the main driver.

Edit:
For the brave: I've committed the re-written code to GitLab. Didn't have the chance to test the code fully, but preliminary tests show that all pins are correctly created from the JSON. Took also the chance to refactor the initialization for the modules to get them all in the same format. The one thing I'm not confident about yet is the calculation of the CRC fingerprint.

So, if you are feeling adventurous, you can try it. Think I can do some testing myself during the weekend. 
Last edit: 13 Jan 2023 23:06 by TOLP2.
The following user(s) said Thank You: tommylight, besriworld, Pro_El, juergenmoser, wzor, deroj

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

More
15 Jan 2023 16:18 #262047 by DePrutser
I've tested some more, but I cannot get it to work on my linuxCNC installation yet. I have replaced the first part of the links by the string "https--" to keep the forum software happy

I've created a new user to my LinuxCNC machine, to test with a fresh start:
root@mill:~# useradd -m testuser
root@mill:~# passwd testuser
New password:
Retype new password:
passwd: password updated successfully
root@mill:~# su testuser
$ bash --login
testuser@mill:/root$ cd
testuser@mill:~$

Now let's try the commands:
testuser@mill:~$ pip install --extra-index-url https--test.pypi.org/simple/ litexcnc[cli]
bash: pip: command not found

Pip was installed, but it is known as pip3, not just pip
root@mill:~# apt-get install python3-pip
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-pip is already the newest version (18.1-5).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

testuser@mill:~$ pip3 install --extra-index-url https--test.pypi.org/simple/ litexcnc[cli]
Looking in indexes: https--pypi.org/simple, https--test.pypi.org/simple/
Collecting litexcnc[cli]
Could not install packages due to an EnvironmentError: 404 Client Error: Not Found for url: https--pypi.org/simple/litexcnc/

Try again with python2
# apt-get install python-pip
$ pip install --extra-index-url https--test.pypi.org/simple/ litexcnc[cli]
Looking in indexes: https--pypi.org/simple, https--test.pypi.org/simple/
Collecting litexcnc[cli]
Could not install packages due to an EnvironmentError: 404 Client Error: Not Found for url: https--pypi.org/simple/litexcnc/

The url https--test.pypi.org/simple/litexcnc/ is valid, but pip doesn't seem to use it.

testuser@mill:~$ pip install -i https--test.pypi.org/simple/ litexcnc[cli]
Looking in indexes: https--test.pypi.org/simple/
Collecting litexcnc[cli]
Could not find a version that satisfies the requirement litexcnc[cli] (from versions: )
No matching distribution found for litexcnc[cli]

Pip3 goes a bit further:
testuser@mill:~$ pip3 install -i https--test.pypi.org/simple/ litexcnc[cli]
Looking in indexes: https--test.pypi.org/simple/
Collecting litexcnc[cli]
Downloading https--test-files.pythonhosted.org/packages/30/26/efc54ae0864aa303387ac22bfc985fb9f7235fea4e63ac462d0439528a54/litexcnc-0.9.0a4-py3-none-any.whl (146kB)
100% |████████████████████████████████| 153kB 3.5MB/s
Collecting packaging<22.0,>=21.3 (from litexcnc[cli])
Could not find a version that satisfies the requirement packaging<22.0,>=21.3 (from litexcnc[cli]) (from versions: 16.7)
No matching distribution found for packaging<22.0,>=21.3 (from litexcnc[cli])

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

More
15 Jan 2023 21:19 #262068 by TOLP2
@DePrutser: Thanks for trying! Could you please provide me with:
  • your Linux distro type and version;
  • your LinuxCNC version
  • your python version (i.e. python --version)
What my experience is with installing is that you might need to install the whole package with sudo. The reason for this the usage of halcompile in one of the scripts, which required in my case root access to the system. When installing it with root acces, it means that all commands are required to be prepended with sudo. However, I experienced problems with compiling the firmware in this case, as it cannot find the toolchain in Debian. This was solved with:
sudo env PATH="$PATH" litexcnc build_firmware ...

Above won't solve your error, I've to look into that error based on the version you use.

Update on Linux 2.9:
The complete driver has been re-written and I'm able to connect to the card using halrun. I'm going to merge the branches tomorrow and do another pre-release.

In the update is also a small bug-fix for Python 3.7 in building the firmware. Python 3.7 does support Literal, so it would lead to strange errors. The error was in LitexCNC, however the error was pointing to Litex. Anyway, this has been fixed by an added depency 'typing_extensions' and some error catching at start up.

5A-75E Version 8.2
I spotted a new FPGA in the wild. I received a version 8.2 of the 5A-75E. It took me some time to get it talking to LinuxCNC, but that was my fault. If you receive such an FPGA, you can use the firmware for the version 6.0 as the pin-out seems to be the same. The only difference seems to be a higher speed grade for the FPGA.
The following user(s) said Thank You: Pro_El

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

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