Jump to content

spidev latency


Hossein Majidi

Recommended Posts

Hi guys

We're trying to run SPI with Linuxcnc. But sometimes SPI latency with other hardware (FPGA) gets big.

The operating system is armbian and I could install a real-time kernel on it so I know it shouldn't be real-time issue with kernel.

We've noticed that it might be the spidev driver issue that is not real-time. And now we're gonna communicate with low-level SPI. Bit I dont know how?

can any one please help me?

Link to comment
Share on other sites

Oh! I'm sorry, but you got on the wrong forum.

 

8 часов назад, Hossein Majidi сказал:

I could install a real-time kernel on it so I know it shouldn't be real-time issue with kernel.

What is the processor architecture?

 

8 часов назад, Hossein Majidi сказал:

We've noticed that it might be the spidev driver issue that is not real-time.

This is a very slow driver. It is intended mainly for development, to debug code or for non-speed-critical applications.
But you can always write your own driver using the features of the RT kernel.
Which one?

 

9 часов назад, Hossein Majidi сказал:

And now we're gonna communicate with low-level SPI. Bit I dont know how?

can any one please help me?

A little more details and I will direct you to the right place where professionals deal with these issues.

Link to comment
Share on other sites

8 hours ago, going said:

Oh! I'm sorry, but you got on the wrong forum.

I'm sorry, I thought it might be relevant to forum orange pi 5 plus!

8 hours ago, going said:

What is the processor architecture?

The details of the board is:
Orange Pi 5 Plus
Chip & Architecture: Rockchip RK3588- 8-Core 64-bit Processor
Quadcore A76 + Quadcore A55

 

8 hours ago, going said:

This is a very slow driver. It is intended mainly for development, to debug code or for non-speed-critical applications.
But you can always write your own driver using the features of the RT kernel.
Which one?

Well, I'm not an expert in kernels but I need a real-time communication with FPGA so the SPI driver must be real-time.

by the way my o.s. is Armbian 24.2.1- Bookworm Legacy 5.10.160-xfce Desktop and the result of "uname -a" is:


Linux orangepi5-plus 5.10.160-rt89+ #8 SMP PREEMPT_RT Sun Apr 14 23:02:59 CST 2024 aarch64 GNU/Linux

 

And I wanna use spidev0.1 and the  minimum desired rate is 5 MHz for SPI.

 

Link to comment
Share on other sites

10 минут назад, Hossein Majidi сказал:

The details of the board is:
Orange Pi 5 Plus

architecture - arm64 (aarch64)

Chip: Rockchip RK3588

13 минут назад, Hossein Majidi сказал:

Linux orangepi5-plus 5.10.160-rt89+ #8 SMP PREEMPT_RT Sun Apr 14 23:02:59 CST 2024 aarch64 GNU/Linux

It is a core with PREEMPT technology.

Your application and the kernel driver that the application uses should be running with increased priority.

In order for them to be able to displace other tasks (processes) which occupy the processor core at the right time.
The PREEMPT_RT patch for the kernel contains bits that allow rt tasks to do preemption.
These bits must be present in the heavy (expensive) parts of the kernel code. For example, in the gpu driver (mali -lima), dma ....

 

1 час назад, Hossein Majidi сказал:

And I wanna use spidev0.1 and the  minimum desired rate is 5 MHz for SPI.

The hardware can provide good speed, but the drivers providing the process should be a priority and should be able to avoid conflicts over resources with other parts of the kernel.

 

As far as I understand, did you take a ready-made, assembled core by someone?
Have you run latency tests from LinuxCNC or cyclictest on this kernel?

 

I looked at this driver:

spi-rockchip.c

and it uses dma in its work.

The kernel from the manufacturer may contain some changes in this driver and in the dma driver.
You may need to study the code carefully. And make changes yourself and build the kernel.

And also configure the initial boot of the kernel (additional parameters for isolating individual processors on which your RT tasks will run).

 

To understand the problem, I need to look into the source code of this particular kernel. Therefore, just general recommendations.

It is better to get more qualified help in a specialized forum from people who have already taken steps in this direction.

This is the LinuxCNC forum and the like. There are many of them.

If you are just starting development, I would recommend that you pay attention to the Xenomai3   Xenomai4 and the Dovetail core.

How to add the necessary bits to the SOC architecture is well described here.

Very detailed documentation. And this is done by real professionals.

 

Regards

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines