EOI in getting SPI going on the RPi5

More
15 Jun 2024 03:25 #303031 by cornholio
The spidev driver is not an option. The man page in the docs states that it is not suitable for real-time threads. Hence the reason you are having issues.

To put it clearly SPI, atm is not an option for the RPi5, no matter what the download page states. Mesa states that the RPi5 is unable to be used with the 7c80 & 7c81 on the respective product pages.
The Raspberry Foundation has only released limited information regarding the RP1 chip. So until this issue resolved we are stuck.
Whether a driver will be developed I can not say.
Long story short there is no help currently available.
To use the RPi5 with Linuxcnc the Ethernet port with a Mesa card would be the easiest route. The gpios may be an option but I haven’t tried it. I’m unsure if on of the Mesa PCIe cards would work, it would be an expensive experiment. A PCIe Parallel Port adapter is not an option, Jeff Gerling has tested many PCIe cards with the RPi and the arm architecture doesn’t support BAR has needed by Parallel Port cards.
It’s not just Linuxcnc that the RPi5 has been a bit of a letdown, many other people have found that many of the old libraries that use the various peripherals on the gpios don’t work until the libs have been re written and the apps & code that use them.
We just have to wait for the Code Gods to arrive.

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

More
15 Jun 2024 08:52 #303037 by andypugh
Has anyone tried the hal_gpio driver on Pi5? (I don't think that I have)

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

More
15 Jun 2024 10:29 #303044 by cornholio
Sorry I haven't, I changed the interface on my Mesa board copy to EPP and put the RPi5 in a drawer.

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

More
25 Jun 2024 15:48 - 25 Jun 2024 16:05 #303757 by elovalvo

Has anyone tried the hal_gpio driver on Pi5? (I don't think that I have)


The latest version of LinuxCNC 2.9.2 you can find here
forum.linuxcnc.org/9-installing-linuxcnc...pi-5?start=40#303752
keeps giving these errors:
pi@raspberrypi:~ $ halrun -I
halcmd: loadrt hal_pi_gpio
Note: Using POSIX realtime
Raspberry Pi 5 Model B Rev 1.0 found
The Pi model 23 is not known to work with this driver but will be assumed to be be using the RPi2+ layout 40 pin connector
HAL_PI_GPIO: can't open /dev/gpiomem:  2 - No such file or directory
If the error is 'permission denied' then try adding the user who runs
LinuxCNC to the gpio group: sudo gpasswd -a username gpio
HAL_PI_GPIO: can't open /dev/mem:  13 - Permission denied
hal_pi_gpio: rtapi_app_main: Operation not permitted (-1)
<stdin>:1: waitpid failed /usr/bin/rtapi_app hal_pi_gpio
<stdin>:1: /usr/bin/rtapi_app exited without becoming ready
<stdin>:1: insmod for hal_pi_gpio failed, returned -1
halcmd:

Instead the hal_gpio module show this
pi@raspberrypi:~ $ halrun -I
halcmd: loadrt hal_gpio inputs=GPIO6,GPIO12,GPIO13,GPIO16,GPIO17,GPIO18,GPIO19 \
halcmd+: outputs=GPIO20,GPIO21,GPIO22,GPIO23,GPIO24,GPIO25,GPIO26,GPIO27 \
halcmd+:  invert=GPIO20,GPIO27 \
halcmd+:   reset=GPIO21,GPIO22
Note: Using POSIX realtime
halcmd: show pin
Component Pins:
Owner   Type  Dir         Value  Name
     4  bit   OUT         FALSE  hal_gpio.GPIO12-in
     4  bit   OUT         FALSE  hal_gpio.GPIO12-in-not
     4  bit   OUT         FALSE  hal_gpio.GPIO13-in
     4  bit   OUT         FALSE  hal_gpio.GPIO13-in-not
     4  bit   OUT         FALSE  hal_gpio.GPIO16-in
     4  bit   OUT         FALSE  hal_gpio.GPIO16-in-not
     4  bit   OUT         FALSE  hal_gpio.GPIO17-in
     4  bit   OUT         FALSE  hal_gpio.GPIO17-in-not
     4  bit   OUT         FALSE  hal_gpio.GPIO18-in
     4  bit   OUT         FALSE  hal_gpio.GPIO18-in-not
     4  bit   OUT         FALSE  hal_gpio.GPIO19-in
     4  bit   OUT         FALSE  hal_gpio.GPIO19-in-not
     4  bit   IN          FALSE  hal_gpio.GPIO20-out
     4  bit   IN          FALSE  hal_gpio.GPIO21-out
     4  bit   IN          FALSE  hal_gpio.GPIO22-out
     4  bit   IN          FALSE  hal_gpio.GPIO23-out
     4  bit   IN          FALSE  hal_gpio.GPIO24-out
     4  bit   IN          FALSE  hal_gpio.GPIO25-out
     4  bit   IN          FALSE  hal_gpio.GPIO26-out
     4  bit   IN          FALSE  hal_gpio.GPIO27-out
     4  bit   OUT         FALSE  hal_gpio.GPIO6-in
     4  bit   OUT         FALSE  hal_gpio.GPIO6-in-not
     4  s32   OUT             0  hal_gpio.read.time
     4  s32   OUT             0  hal_gpio.reset.time
     4  s32   OUT             0  hal_gpio.write.time

halcmd:
Last edit: 25 Jun 2024 16:05 by elovalvo.

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

More
25 Jun 2024 16:29 #303759 by cornholio
Anything written for the RPi that is specific for the RPi4 and earlier is not expected to work due to the RPi5 having the RP1 chip that handles the GPIO and most of the other external interfaces.
Basically if the driver depends on the bcm2835 header it won’t work on the RPi5.

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

More
25 Jun 2024 20:19 #303784 by rodw
I am sure the hal_gpio driver was tested and working very early in the piece from earlier forum comments.
linuxcnc.org/docs/stable/html/drivers/hal_gpio.html
The gpiod library used here is meant to be a generic GPIO driver (I think at the kernel level) that is designed to be multi platform so its unsurprising it works on the Pi5

But this does not appear to help with SPI unless its supported by gpoid

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

More
25 Jun 2024 23:19 #303797 by cornholio
I had a look at the repo that a previous post referred to, it appears that it would work. I just have to get off the lazy backside and have a go. Although I guess I’ll have to do the testing myself based on previous experience.
But I need to finish a side project or 2 lol.

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

More
26 Jun 2024 09:09 - 26 Jun 2024 09:09 #303816 by rodw
Just looked at that earlier repo
forum.linuxcnc.org/18-computer/51748-eoi...-rpi5?start=0#294929
That appears to be the same raspberry pi kernel and branch I compile for the images on the downloads page.
So does that mean the Pi5 has had SPI support all along?
Last edit: 26 Jun 2024 09:09 by rodw.

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

More
26 Jun 2024 10:48 #303824 by cornholio
The RPi5 has always had spi support via the /dev/spidevX interface. The hm2_spi will load and communicate with a 7c81, but is only in using halrun, once you add it to a servo thread it falls over, this is really to be expected, as the man page suggests it is really not suitable. This is the behavior I have witnessed.
The issue was never whether spi is available or works on the RPi5. The issue is register level access via the linuxcnc driver. The Hm2_rpspi driver is aimed at the RPi3/4, getting access to the SPI interface is well documented. The inclusion of the RP1 sitting on the PCIe bus is the game changer.

To sum it up.
1. The RPi5 has an SPI interface that is usable via the /dev/spidev* interface. Of course this needs to be enabled via the usual method.
2. Hardware & register level access, as used in the current hm2_rpsi driver, requires a new driver.
3. If the code includes the bcm2835 header the rule of thumb is that it is not compatible with the RPi5.

Maybe the heading of this thread is not exactly spot on.

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

Time to create page: 0.096 seconds
Powered by Kunena Forum