Real-Time Kernel with Orange Pi 4 LTS

More
24 Nov 2024 11:25 - 24 Nov 2024 12:51 #315165 by royka
Replied by royka on topic Real-Time Kernel with Orange Pi 4 LTS
When you activate too many overlays they can interfere with each other, because some pins have multiple functions. Some can also cause extra interrupts, so remove everything that you don't need and isolcpus should be placed after extraargs:
verbosity=1
bootlogo=true
console=both
fdtfile=rockchip/rk3399-orangepi-4-lts.dtb
rootdev=UUID=a703d82e-8d61-4266-8b54-c10361d608ca
rootfstype=ext4
extraargs=isolcpus=2-5
overlay_prefix=rockchip
overlays=rk3399-opp-2ghz rk3399-spi-spidev rk3399-uhs
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u
​​​​​​​
Last edit: 24 Nov 2024 12:51 by royka.

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

More
25 Nov 2024 07:07 #315220 by Hossein74Majidi
Replied by Hossein74Majidi on topic Real-Time Kernel with Orange Pi 4 LTS

When you activate too many overlays they can interfere with each other, because some pins have multiple functions. Some can also cause extra interrupts, so remove everything that you don't need and isolcpus should be placed after extraargs:
verbosity=1
bootlogo=true
console=both
fdtfile=rockchip/rk3399-orangepi-4-lts.dtb
rootdev=UUID=a703d82e-8d61-4266-8b54-c10361d608ca
rootfstype=ext4
extraargs=isolcpus=2-5
overlay_prefix=rockchip
overlays=rk3399-opp-2ghz rk3399-spi-spidev rk3399-uhs
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u

Aha I see, I tested what you said. The latency got better and it's 31.8 us, is it goo enough yet?
The spi it's not found yet. I've enabled it in armbina-config menu but still there's no spidev in /boot/ directory.
just to be clear, here is my /boot/ directory:
root@orangepi4-lts:~# ls /dev/
autofs           gpiochip2    log           mmcblk0boot1  snd     tty20  tty37  tty53   ttyS1    vcs5   vcsu7
block            gpiochip3    loop0         mmcblk0p1     stderr  tty21  tty38  tty54   ttyS2    vcs6   vga_arbiter
btrfs-control    gpiochip4    loop1         mmcblk0rpmb   stdin   tty22  tty39  tty55   ttyS3    vcs7   vhci
bus              hidraw0      loop2         mqueue        stdout  tty23  tty4   tty56   ttyS4    vcsa   vhost-net
cec0             hidraw1      loop3         net           tty     tty24  tty40  tty57   ttyS5    vcsa1  video0
char             hidraw2      loop4         null          tty0    tty25  tty41  tty58   ttyS6    vcsa2  video1
console          hidraw3      loop5         port          tty1    tty26  tty42  tty59   ttyS7    vcsa3  video2
cpu_dma_latency  hugepages    loop6         ppp           tty10   tty27  tty43  tty6    uhid     vcsa4  video3
cuse             i2c-0        loop7         psaux         tty11   tty28  tty44  tty60   uinput   vcsa5  video-dec0
disk             i2c-1        loop-control  ptmx          tty12   tty29  tty45  tty61   uleds    vcsa6  video-dec2
dri              i2c-3        mapper        pts           tty13   tty3   tty46  tty62   urandom  vcsa7  watchdog
ecryptfs         i2c-4        media0        random        tty14   tty30  tty47  tty63   usb      vcsu   watchdog0
fb0              i2c-7        media1        rfkill        tty15   tty31  tty48  tty7    v4l      vcsu1  wcn_op
fd               iio:device0  media-dec0    rtc           tty16   tty32  tty49  tty8    vcs      vcsu2  zero
full             initctl      media-dec1    rtc0          tty17   tty33  tty5   tty9    vcs1     vcsu3
fuse             input        mem           shm           tty18   tty34  tty50  ttyBT0  vcs2     vcsu4
gpiochip0        kmsg         mmcblk0       slog_wcn0     tty19   tty35  tty51  ttyBT1  vcs3     vcsu5
gpiochip1        kvm          mmcblk0boot0  slog_wcn1     tty2    tty36  tty52  ttyS0   vcs4     vcsu6

and as you said, this is the content of my armbianEnv.txt:
verbosity=1
bootlogo=true
console=both
fdtfile=rockchip/rk3399-orangepi-4-lts.dtb
rootdev=UUID=a703d82e-8d61-4266-8b54-c10361d608ca
rootfstype=ext4
extraargs=isolcpus=2-5
overlay_prefix=rockchip
overlays=rk3399-opp-2ghz rk3399-spi-spidev rk3399-uhs
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u


btw, during latency test and glxgears, the board has many lags and works so slow. is it normal? 
 

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

More
25 Nov 2024 13:50 - 25 Nov 2024 14:03 #315235 by royka
Replied by royka on topic Real-Time Kernel with Orange Pi 4 LTS
Weird that spidev doesn't show up, I think that the overlay is not complete, since it worked (or at least visible) before you could try to add the overlay files of the other boards to see if it helps.

The (gpu?) lag is probably because all the small cores are isolated now, you can try to see if the latency is still low enough with less cores isolated, isolcpus=3-5, isolcpus=4,5 or isolcpus=5. The first 2 cores are faster, so ideally you would isolate the second core, but then I think it should be changed in the source of LinuxCNC to run on that core instead of the last core, but 31.8us is certainly not bad
So you can try the following config:
verbosity=1
bootlogo=true
console=both
fdtfile=rockchip/rk3399-orangepi-4-lts.dtb
rootdev=UUID=a703d82e-8d61-4266-8b54-c10361d608ca
rootfstype=ext4
extraargs=isolcpus=4,5
overlay_prefix=rockchip
overlays=rk3399-opp-2ghz rk3328-spi-spidev rk3399-spi-spidev rk3399-uhs  rk3568-hk-spi-spidev
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u
Last edit: 25 Nov 2024 14:03 by royka.

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

More
26 Nov 2024 07:50 - 26 Nov 2024 07:54 #315279 by Hossein74Majidi
Replied by Hossein74Majidi on topic Real-Time Kernel with Orange Pi 4 LTS

Weird that spidev doesn't show up, I think that the overlay is not complete, since it worked (or at least visible) before you could try to add the overlay files of the other boards to see if it helps.

The (gpu?) lag is probably because all the small cores are isolated now, you can try to see if the latency is still low enough with less cores isolated, isolcpus=3-5, isolcpus=4,5 or isolcpus=5. The first 2 cores are faster, so ideally you would isolate the second core, but then I think it should be changed in the source of LinuxCNC to run on that core instead of the last core, but 31.8us is certainly not bad
So you can try the following config:
verbosity=1
bootlogo=true
console=both
fdtfile=rockchip/rk3399-orangepi-4-lts.dtb
rootdev=UUID=a703d82e-8d61-4266-8b54-c10361d608ca
rootfstype=ext4
extraargs=isolcpus=4,5
overlay_prefix=rockchip
overlays=rk3399-opp-2ghz rk3328-spi-spidev rk3399-spi-spidev rk3399-uhs  rk3568-hk-spi-spidev
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u
 

Thanks. I did search for some overlays of spi of other devices but i couldnt find anything.
I changed the status of the spidev@0 in rk3399-orangepi-4-lts.dts and compile it again (it was status="disabled" and I changed it to "okay") but it didnt work. I have no idea what should I do
about the latency-test, it made it worse (50 us) and the lag in gpu just got better slightly.
Last edit: 26 Nov 2024 07:54 by Hossein74Majidi.

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

More
27 Nov 2024 01:58 #315336 by royka
Replied by royka on topic Real-Time Kernel with Orange Pi 4 LTS
It seems indeed that you have to enable the one that you need, so it's better to put back the original dit and download the dtbo source from:
raw.githubusercontent.com/armbian/build/...3399-spi-spidev.dtso

First remove the spi overlays from armbianEnv.txt
Check which spi goes to the gpio pins and isn't in use by anything else and recompile/install with: sudo armbian-add-overlay rockchip-rk3399-spi-spidev.dtso

For the slow graphics you could try to see if the GPU irq is on a cpu with many other interrupts and move to a less busy CPU: cat /proc/interrupts

50us should still be okay I think, although I'm not sure how this influences the spi connection, likely that it will need a more optimized driver

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

More
28 Nov 2024 05:38 #315436 by Hossein74Majidi
Replied by Hossein74Majidi on topic Real-Time Kernel with Orange Pi 4 LTS

It seems indeed that you have to enable the one that you need, so it's better to put back the original dit and download the dtbo source from:
raw.githubusercontent.com/armbian/build/...3399-spi-spidev.dtso

First remove the spi overlays from armbianEnv.txt
Check which spi goes to the gpio pins and isn't in use by anything else and recompile/install with: sudo armbian-add-overlay rockchip-rk3399-spi-spidev.dtso

For the slow graphics you could try to see if the GPU irq is on a cpu with many other interrupts and move to a less busy CPU: cat /proc/interrupts

50us should still be okay I think, although I'm not sure how this influences the spi connection, likely that it will need a more optimized driver

Thanks but it still doesnt work.:(
This is the main spidev file in my board:
drive.google.com/file/d/1XAjIt_TSBaVCBum...S3D/view?usp=sharing

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

More
28 Nov 2024 06:18 #315438 by royka
Replied by royka on topic Real-Time Kernel with Orange Pi 4 LTS
You didn't activate one of the spi numbers yet. So first open the dtso and replace ONE of the disabled to okay.

 
Attachments:

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

More
28 Nov 2024 08:33 #315442 by Hossein74Majidi
Replied by Hossein74Majidi on topic Real-Time Kernel with Orange Pi 4 LTS

You didn't activate one of the spi numbers yet. So first open the dtso and replace ONE of the disabled to okay.
 

Yes that was the problem and also I needed to set its status to okay in rk3399-orangepi-4-lts.dtb in /boot/dtb/rockchip.
Thanks a lot.
now when I run linuxcnc I get this:
Debug file information:
Note: Using POSIX realtime
Unexpected realtime delay on task 0 with period 1000000
This Message will only display once per session.
Run the Latency Test and resolve before continuing.
note: MAXV     max: 25.000 units/sec 1500.000 units/min
note: LJOG     max: 25.000 units/sec 1500.000 units/min
note: LJOG default: 6.000 units/sec 360.000 units/min
note: jog_order='XYZ'
note: jog_invert=set()
DRM_IOCTL_PANFROST_CREATE_BO failed: Invalid argument
DRM_IOCTL_PANFROST_CREATE_BO failed: Invalid argument
/usr/bin/linuxcnc: line 977:  6721 Segmentation fault      $EMCDISPLAY -ini "$INIFILE" $EMCDISPLAYARGS $EXTRA_ARGS
6683
6717
Stopping realtime threads
Unloading hal components
Note: Using POSIX realtime

and then it wont open anything. even the simulation cant be opened.

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

More
28 Nov 2024 09:22 #315444 by royka
Replied by royka on topic Real-Time Kernel with Orange Pi 4 LTS
Maybe an old mesa version? Are you using a recent image?

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

More
28 Nov 2024 10:04 #315450 by Hossein74Majidi
Replied by Hossein74Majidi on topic Real-Time Kernel with Orange Pi 4 LTS

Maybe an old mesa version? Are you using a recent image?
 

I've installed linuxcnc 2.9.3 and the mesa flash is installed using clone and make install

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

Time to create page: 0.169 seconds
Powered by Kunena Forum