LinuxCNC-RIO - RealtimeIO for LinuxCNC based on FPGA (ICE40 / ECP5)

More
23 Sep 2023 11:04 #281458 by meister
Hi Zayoo,
you can use this file as template:configs/TangNano9K/config.json

strip it down like this:
{
    "name": "TangNano9K",
    "description": "TangNano9K over serial",
    "board": "TangNano9K",
    "type": "GW1NR-LV9QN88PC6/I5",
    "family": "GW1N-9C",
    "toolchain": "icestorm",
    "package": "",
    "clock": {
        "speed": "27000000",
        "pin": "52"
    },
    "transport": "SERIAL",
    "axis": 2,
    "interface": [
        {
            "type": "uart",
            "pins": {
                "RX": "48",
                "TX": "49"
            }
        }
    ],
    "blink": {
        "pin": "10"
    },
    "error": {
        "invert": true,
        "pin": "11"
    },
    "enable": {
        "pin": "69"
    },
    "plugins": [
        {
            "pullup": true,
            "pin": "33",
            "name": "DIN0",
            "type": "din_bit"
        },
        {
            "pullup": true,
            "pin": "30",
            "name": "DIN1",
            "type": "din_bit"
        },
        {
            "invert": true,
            "pin": "13",
            "name": "DOUT0",
            "type": "dout_bit"
        },
        {
            "invert": true,
            "pin": "14",
            "name": "DOUT1",
            "type": "dout_bit"
        },
        {
            "invert": true,
            "pin": "15",
            "name": "DOUT2",
            "type": "dout_bit"
        },
        {
            "type": "vin_counter",
            "pullup": true,
            "pins": {
                "up": "3",
                "down": "4"
            },
            "name": "VIN0"
        },
        {
            "type": "vout_pwm",
            "pins": {
                "pwm": "55"
            },
            "name": "VOUT0"
        },
        {
            "type": "joint_stepper",
            "cl": false,
            "scale": 800,
            "pins": {
                "step": "54",
                "dir": "53"
            },
            "name": "JOINT0"
        },
        {
            "type": "joint_stepper",
            "cl": false,
            "scale": 800,
            "pins": {
                "step": "51",
                "dir": "42"
            },
            "name": "JOINT1"
        }
    ]
}

and run:
python3 buildtool.py configs/TangNano9K/config.json

BUT: the interface_uart plugin is not usable with linuxcnc at the moment,
only with the python test-tools:
python3 Output/TangNano9K/Firmware/qt_spitest.py /dev/ttyUSB1

AND the onboard USB-Chip of the TangNano9K is totally bad,
on linux the serial communication is really buggy,
it's better to use a real FTDI-Adapter and normal pins for the communication.
 
The following user(s) said Thank You: Zayoo, Bongo

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

More
23 Sep 2023 16:31 #281488 by meister
BTW, you can only send velocity commands to the fpga, not position commands, i don't know if this is the right platform for your project

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

More
04 Dec 2023 21:59 #287221 by Zayoo
Hi,
thanks for advice and instruction. I'm running my board with qt_spitest. I'm too into it now to give up. :)

What I need to do with rio.c and rio.h files in output folder.
I copy ConfigSamples to LinuxCNC configs folder and when i start linuxcnc i get configuration selector with possibility to chose rio but error appears:        Plese brief instruction how to  proceed in to LinuxCNC! Thank you. 

Error report created by /usr/lib/tcltk/linuxcnc/show_errors.tcl:

Print file information:
RUN_IN_PLACE=no
LINUXCNC_DIR=
LINUXCNC_BIN_DIR=/usr/bin
LINUXCNC_TCL_DIR=/usr/lib/tcltk/linuxcnc
LINUXCNC_SCRIPT_DIR=
LINUXCNC_RTLIB_DIR=/usr/lib/linuxcnc/modules
LINUXCNC_CONFIG_DIR=
LINUXCNC_LANG_DIR=/usr/lib/tcltk/linuxcnc/msgs
INIVAR=inivar
HALCMD=halcmd
LINUXCNC_EMCSH=/usr/bin/wish8.6
LINUXCNC - 2.8.4-1-gb7824717b
Machine configuration directory is '/home/userxxx/linuxcnc/configs/rio'
Machine configuration file is 'rio.ini'
INIFILE=/home/userxxx/linuxcnc/configs/rio/rio.ini
VERSION=1.1
PARAMETER_FILE=linuxcnc.var
TASK=milltask
HALUI=halui
DISPLAY=axis
COORDINATES=X Y
KINEMATICS=trivkins coordinates=XY
Starting LinuxCNC...
Starting LinuxCNC server program: linuxcncsvr
Loading Real Time OS, RTAPI, and HAL_LIB modules
Starting LinuxCNC IO program: io
Starting HAL User Interface program: halui
Found file(REL): ./rio.hal
Shutting down and cleaning up LinuxCNC...
Removing HAL_LIB, RTAPI, and Real Time OS modules
Removing NML shared memory segments

Debug file information:
Note: Using POSIX realtime
rio: dlopen: /usr/lib/linuxcnc/modules/rio.so: cannot open shared object file: No such file or directory
./rio.hal:7: waitpid failed /usr/bin/rtapi_app rio
./rio.hal:7: /usr/bin/rtapi_app exited without becoming ready
./rio.hal:7: insmod for rio failed, returned -1
5942
Stopping realtime threads
Unloading hal components
Note: Using POSIX realtime



Info report created by linuxcnc_info:
The file:    /tmp/linuxcnc_info.txt
can be posted to a forum or a web site like:
     pastebin.com
in order to provide information about the linuxcnc
system and configuration.

                Date: Mon 4 Dec 22:49:33 CET 2023
            UTC Date: Mon 4 Dec 21:49:33 UTC 2023
        this program: /usr/bin/linuxcnc_info
              uptime: 22:49:33 up 11:07, 1 user, load average: 0.02, 0.09, 0.15
     lsb_release -sa: Debian Debian GNU/Linux 10 (buster) 10 buster
      which linuxcnc: /usr/bin/linuxcnc
                 pwd: /home/userxxx/linuxcnc/configs/rio
                USER: userxxx
             LOGNAME: userxxx
                HOME: /home/userxxx
              EDITOR: 
              VISUAL: 
            LANGUAGE: en_GB:en
                TERM: dumb
           COLORTERM: 
             DISPLAY: :0.0
             DESKTOP: lightdm-xsession
        display size: 1280x1024 pixels (339x271 millimeters)
                PATH: /usr/bin:/home/userxxx/linuxcnc/configs/rio/bin:/usr/bin:/home/userxxx/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

uname items:
         nodename -n: linuxcnc
      kernel-name -s: Linux
      kernel-vers -v: #1 SMP PREEMPT RT Debian 4.19.249-2 (2022-06-30)
          machine -m: x86_64
        processor -p: unknown
         platform -i: unknown
      oper system -o: GNU/Linux

/proc items:
             cmdline: BOOT_IMAGE=/boot/vmlinuz-4.19.0-21-rt-amd64 root=UUID=371818aa-d1a4-445f-b321-44fe69ec2ea0 ro initrd=/install/gtk/initrd.gz quiet
          model name: AMD A8-9600 RADEON R7, 10 COMPUTE CORES 4C+6G
               cores: 1
             cpu MHz: 3094.198
             parport: 
              serial: 

Versions:
                 gcc: gcc (Debian 8.3.0-6) 8.3.0
              python: Python 2.7.16
                 git: git version 2.20.1
          git commit: NA
                 tcl: 8.6
                  tk: 8.6
               glade: not_in_PATH
          glade-gtk2: not_in_PATH

linuxcnc_var all:

     LINUXCNCVERSION: 2.8.4-1-gb7824717b
LINUXCNC_AUX_GLADEVCP: /usr/share/linuxcnc/aux_gladevcp
LINUXCNC_AUX_EXAMPLES: /usr/share/linuxcnc/aux_examples
            REALTIME: /etc/init.d/realtime
                 RTS: uspace
          HALLIB_DIR: /usr/share/linuxcnc/hallib

dpkg -l '*linuxcnc*':
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                Version              Architecture Description
+++-===================-====================-============-=====================================================================
un  linuxcnc            <none>               <none>       (no description available)
un  linuxcnc-dev        <none>               <none>       (no description available)
un  linuxcnc-doc        <none>               <none>       (no description available)
ii  linuxcnc-doc-en     1:2.8.4.1.gb7824717b all          motion controller for CNC machines and robots (English documentation)
ii  linuxcnc-doc-es     1:2.8.4.1.gb7824717b all          controlador de movimiento para máquinas CNC y robots (Español).
ii  linuxcnc-doc-fr     1:2.8.4.1.gb7824717b all          motion controller for CNC machines and robots (French documentation)
un  linuxcnc-sim        <none>               <none>       (no description available)
un  linuxcnc-sim-dev    <none>               <none>       (no description available)
ii  linuxcnc-uspace     1:2.8.4.1.gb7824717b amd64        motion controller for CNC machines and robots
ii  linuxcnc-uspace-dev 1:2.8.4.1.gb7824717b amd64        PC based motion controller for real-time Linux
 

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

More
05 Dec 2023 00:02 #287228 by cornholio
rio: dlopen: /usr/lib/linuxcnc/modules/rio.so: cannot open shared object file: No such file or directory

You've missed a step:
sudo halcompile --install  Output/TangNano9K/LinuxCNC/Components/rio.c

github.com/multigcs/LinuxCNC-RIO/blob/ma...angNano9K/INSTALL.md
The following user(s) said Thank You: meister, Zayoo

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

More
05 Dec 2023 17:27 #287291 by Zayoo
Thank you for help.
Currently my setup work on bench with serial communication of the box, just small adjustment of baud rate in rio.v and adjusting port in rio.h!
Still lot to do.
The following user(s) said Thank You: meister

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

More
11 Dec 2023 19:28 #287875 by meister
The following user(s) said Thank You: tommylight, Bongo

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

More
11 Dec 2023 19:31 #287876 by meister

Thank you for help.
Currently my setup work on bench with serial communication of the box, just small adjustment of baud rate in rio.v and adjusting port in rio.h!
Still lot to do.
 

Hi Zayoo,
nice !
Are you using a Raspberry with Serial on GPIO or an USB-Serial-Adapter ?

 

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

More
16 Dec 2023 00:01 - 16 Dec 2023 00:20 #288277 by meister
got it :)
Wiznet W5500 without softcore, direct on the FPGA:

youtube.com/shorts/xcC7Dun8vxE

testet on IceBreaker and MAX10, but i think it should run on all FPGA's,
nothing special.
Last edit: 16 Dec 2023 00:20 by meister.

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

More
18 Dec 2023 17:21 #288495 by meister
The following user(s) said Thank You: tommylight

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

More
18 Dec 2023 17:28 #288496 by tommylight
The following user(s) said Thank You: meister

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

Time to create page: 0.169 seconds
Powered by Kunena Forum