Set max speed SPI kernel 4.14

Post Reply
tam1111574
Posts: 109
Joined: Tue Jan 12, 2016 3:51 pm
languages_spoken: english
ODROIDs: oddroid xu4
Has thanked: 4 times
Been thanked: 0
Contact:

Set max speed SPI kernel 4.14

Unread post by tam1111574 » Wed Mar 28, 2018 12:28 pm

Hi Odroid, In the old kernel 3.10, i can config the maximum speed of SPI module by command :

Code: Select all

sudo -s
	fdtput -c /media/boot/exynos5422-odroidxu3.dtb /spi@12d30000/spidev
	fdtput -t s /media/boot/exynos5422-odroidxu3.dtb /spi@12d30000/spidev compatible "spidev"
	fdtput -t x /media/boot/exynos5422-odroidxu3.dtb /spi@12d30000/spidev reg 0
	fdtput -t i /media/boot/exynos5422-odroidxu3.dtb /spi@12d30000/spidev spi-max-frequency 20000000
	fdtput -c /media/boot/exynos5422-odroidxu3.dtb /spi@12d30000/spidev/controller-data
	fdtput -t x /media/boot/exynos5422-odroidxu3.dtb /spi@12d30000/spidev/controller-data cs-gpio 0x44, 0x5, 0x0
	fdtput -t x /media/boot/exynos5422-odroidxu3.dtb /spi@12d30000/spidev/controller-data samsung,spi-feedback-delay 0
But the kernel 4.14 is not

Code: Select all

  fdtput -t x /media/boot/exynos5422-odroidxu3.dtb /spi@12d30000/spidev/controller-data samsung,spi-feedback-delay 0root@odroid:~# fdtput -c /media/boot/exynos5422-odroidxu3.dtb /spi@12d30000/spidev
Error at '/spi@12d30000': FDT_ERR_NOTFOUND
root@odroid:~# fdtput -t s /media/boot/exynos5422-odroidxu3.dtb /spi@12d30000/spidev compatible "spidev"
Error at '/spi@12d30000/spidev': FDT_ERR_NOTFOUND
root@odroid:~# fdtput -t x /media/boot/exynos5422-odroidxu3.dtb /spi@12d30000/spidev reg 0
Error at '/spi@12d30000/spidev': FDT_ERR_NOTFOUND
root@odroid:~# fdtput -t i /media/boot/exynos5422-odroidxu3.dtb /spi@12d30000/spidev spi-max-frequency 20000000
Error at '/spi@12d30000/spidev': FDT_ERR_NOTFOUND
root@odroid:~# fdtput -c /media/boot/exynos5422-odroidxu3.dtb /spi@12d30000/spidev/controller-data
Error at '/spi@12d30000/spidev': FDT_ERR_NOTFOUND
root@odroid:~# fdtput -t x /media/boot/exynos5422-odroidxu3.dtb /spi@12d30000/spidev/controller-data cs-gpio 0x44, 0x5, 0x0
Error at '/spi@12d30000/spidev/controller-data': FDT_ERR_NOTFOUND
root@odroid:~# fdtput -t x /media/boot/exynos5422-odroidxu3.dtb /spi@12d30000/spidev/controller-data samsung,spi-feedback-delay 0

How to config the max speed of SPI module in kernel 4.14 ?.
Thank Odroid/...

User avatar
odroid
Site Admin
Posts: 31363
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 50 times
Been thanked: 184 times
Contact:

Re: Set max speed SPI kernel 4.14

Unread post by odroid » Wed Mar 28, 2018 1:13 pm

Which SPI device do you connect to XU4?

Refer this thread about the SPI driver in Kernel 4.14 too.
viewtopic.php?f=97&t=29638

tam1111574
Posts: 109
Joined: Tue Jan 12, 2016 3:51 pm
languages_spoken: english
ODROIDs: oddroid xu4
Has thanked: 4 times
Been thanked: 0
Contact:

Re: Set max speed SPI kernel 4.14

Unread post by tam1111574 » Wed Mar 28, 2018 1:45 pm

Thank for your information Odroid... I need to compile the kernel to change max speed of SPI. I have a ideal, i think you should set maximum speed 20MHz in kernel, we can easy change in code but not need re-compile again, because it need many time to finish. :D.

tam1111574
Posts: 109
Joined: Tue Jan 12, 2016 3:51 pm
languages_spoken: english
ODROIDs: oddroid xu4
Has thanked: 4 times
Been thanked: 0
Contact:

Re: Set max speed SPI kernel 4.14

Unread post by tam1111574 » Wed Mar 28, 2018 4:27 pm

Hi odroid, when i change max speed spi in exynos5422-odroidxu4.dts

Code: Select all



&spi_1 {
	status = "okay";

	assigned-clocks = <&clock CLK_MOUT_SPI1>, <&clock CLK_DOUT_SPI1>;
	assigned-clock-parents = <&clock CLK_MOUT_DPLL>;
	assigned-clock-rates = <0>, <80000000>;

	samsung,spi-src-clk = <0>;
	num-cs = <2>;
	cs-gpios = <&gpa2 5 GPIO_ACTIVE_HIGH>, <&gpx2 1 GPIO_ACTIVE_HIGH>;

	spidev: spidev@0 {
		reg = <0>;
		compatible = "spidev";
		spi-max-frequency = <20000000>;

		controller-data {
			cs-gpio = <&gpa2 5 GPIO_ACTIVE_HIGH>;
			samsung,spi-feedback-delay = <0>;
		};
	};

	ads7846: ads7846@1 {
		reg = <1>;
		compatible = "ti,ads7846";
		interrupt-parent = <&gpa0>;
		interrupts = <3 0>;
		spi-max-frequency = <1000000>;

		/* GPA0.3 Pull-up enable */
		pinctrl-0 = <&ts_pendown_gpio>;
		pinctrl-names = "default";

		pendown-gpio = <&gpa0 3 GPIO_ACTIVE_HIGH>;
		vcc-supply = <&ldo30_reg>;

		ti,swap-xy = <1>;
		ti,x-min = /bits/ 16 <0>;
		ti,x-max = /bits/ 16 <8000>;
		ti,y-min = /bits/ 16 <0>;
		ti,y-max = /bits/ 16 <4800>;
		ti,x-plate-ohms = /bits/ 16 <40>;
		ti,pressure-max = /bits/ 16 <255>;

		linux,wakeup;

		controller-data {
			cs-gpio = <&gpx2 1 GPIO_ACTIVE_HIGH>;
			samsung,spi-feedback-delay = <0>;
		};
	};
};

After compile complete, I test with my source but its not work.
When I check with dmesg command, I get

Code: Select all

[  359.688496] spidev spi1.0: I/O Error: rx-1 tx-1 res:rx-f tx-f len-32040
[  359.693720] spidev spi1.0: SPI transfer failed: -5
[  359.698502] spi_master spi1: failed to transfer one message from queue
[  977.583186] sysctl (7511): drop_caches: 3
[  978.543058] spidev spi1.0: I/O Error: rx-1 tx-1 res:rx-f tx-f len-32040
[  978.548317] spidev spi1.0: SPI transfer failed: -5
[  978.553281] spi_master spi1: failed to transfer one message from queue

User avatar
odroid
Site Admin
Posts: 31363
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 50 times
Been thanked: 184 times
Contact:

Re: Set max speed SPI kernel 4.14

Unread post by odroid » Wed Mar 28, 2018 9:40 pm

I think you don't need to touch the driver source code to change the SPI clock speed.

Make a test code by referring this example code. You can change the SPI speed via standard SPI driver ioctls.
https://wiki.odroid.com/old_product/acc ... sion_board

tam1111574
Posts: 109
Joined: Tue Jan 12, 2016 3:51 pm
languages_spoken: english
ODROIDs: oddroid xu4
Has thanked: 4 times
Been thanked: 0
Contact:

Re: Set max speed SPI kernel 4.14

Unread post by tam1111574 » Wed Mar 28, 2018 10:28 pm

Oki thank odroid.. i will check it...

tam1111574
Posts: 109
Joined: Tue Jan 12, 2016 3:51 pm
languages_spoken: english
ODROIDs: oddroid xu4
Has thanked: 4 times
Been thanked: 0
Contact:

Re: Set max speed SPI kernel 4.14

Unread post by tam1111574 » Thu Mar 29, 2018 12:36 pm

Thank odroid, I can set maximum speed of SPI module. This is result

Image


In the picture, I see the gap between 2 buffer, can I reduce this gap ?
When I increase the buffer data over 28550 byte, The SPI will not transfer and i get some error with dmesg command ...

Code: Select all


[  173.373581] spidev spi1.0: I/O Error: rx-1 tx-1 res:rx-f tx-f len-28850
[  173.378778] spidev spi1.0: SPI transfer failed: -5
[  173.383560] spi_master spi1: failed to transfer one message from queue

I tested with the old kernel 3.10.92, it can send a data with 64 KB byte via SPI. I configured the buffer data of SPI by some command:

Code: Select all

	rmmod spidev
	modinfo spidev
	modprobe spidev bufsiz=65536

	nano /etc/modprobe.d/local.conf
		options spidev bufsiz=65536
		
	nano  /etc/modprobe.d/spidev.conf
		options spidev bufsiz=65536
I don't know the reason, the new kernel can't send.

Thank Odroid.

User avatar
odroid
Site Admin
Posts: 31363
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 50 times
Been thanked: 184 times
Contact:

Re: Set max speed SPI kernel 4.14

Unread post by odroid » Thu Mar 29, 2018 7:01 pm

We will try to fix the buffer size limitation issue within a couple of days.

But it seems not to be possible to reduce the gap.

tam1111574
Posts: 109
Joined: Tue Jan 12, 2016 3:51 pm
languages_spoken: english
ODROIDs: oddroid xu4
Has thanked: 4 times
Been thanked: 0
Contact:

Re: Set max speed SPI kernel 4.14

Unread post by tam1111574 » Fri Mar 30, 2018 2:24 am

I will re-check with kernel 3.10.92 and give you the result. Hmzz why with the new kernel is slower than old kernel ?.. This is the reason i still like kernel 3.10.92 . :D ...

neal
Posts: 182
Joined: Fri Apr 14, 2017 10:02 am
languages_spoken: english
Has thanked: 1 time
Been thanked: 3 times
Contact:

Re: Set max speed SPI kernel 4.14

Unread post by neal » Tue Apr 03, 2018 11:06 am

I've checked with sending data via SPI. I don't have any problems. Here is my what I did.

kernel version 4.14.29+

Case 1.

Code: Select all

# cat /etc/modprobe.d/spidev.conf
options spidev bufsiz=65536
Case 2.
If it doesn't have /etc/modprobe.d/spidev.conf file, I can see the error.

Code: Select all

can't send spi message: Message too long
Aborted
so, I did.

Code: Select all

# modprobe -r spidev
# modprobe spidev bufsiz=65536
After two cases, I changed TX buffer size to 32768 in ${KERNEL_PATH}/tools/spi/spidev_test.c.

Code: Select all

uint8_t default_tx[32768] = {
...
}
and build. It works well.

tam1111574
Posts: 109
Joined: Tue Jan 12, 2016 3:51 pm
languages_spoken: english
ODROIDs: oddroid xu4
Has thanked: 4 times
Been thanked: 0
Contact:

Re: Set max speed SPI kernel 4.14

Unread post by tam1111574 » Wed Apr 04, 2018 2:34 am

Hi Neal, Yes. You are correct but the largest problem is the gap between 2 bytes if i configure 32 bit per word is 32 and the speed is 20Mhz..

User avatar
odroid
Site Admin
Posts: 31363
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 50 times
Been thanked: 184 times
Contact:

Re: Set max speed SPI kernel 4.14

Unread post by odroid » Wed Apr 04, 2018 6:59 am

Which SPI devices do you use?
There is a faster 32bit transfer mode in Kernel 4.14 SPI driver for TFT LCD.

tam1111574
Posts: 109
Joined: Tue Jan 12, 2016 3:51 pm
languages_spoken: english
ODROIDs: oddroid xu4
Has thanked: 4 times
Been thanked: 0
Contact:

Re: Set max speed SPI kernel 4.14

Unread post by tam1111574 » Wed Apr 04, 2018 10:37 am

My device is FPGA and my source run in nodejs. I use the mraa library to transfer data to FPGA in Nodejs environment. Because the gap between 2 words is very effect to my product so i must to resolve this problem. I re-checked the old kernel again and it don't have the gap between 2 words, I don't know reason, i 'm checking the source kernel. Thank and best regards Odroid.

User avatar
odroid
Site Admin
Posts: 31363
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 50 times
Been thanked: 184 times
Contact:

Re: Set max speed SPI kernel 4.14

Unread post by odroid » Wed Apr 04, 2018 11:14 am

I see.
We will try to port the SPI driver in Kernel 3.10 to 4.14.

tam1111574
Posts: 109
Joined: Tue Jan 12, 2016 3:51 pm
languages_spoken: english
ODROIDs: oddroid xu4
Has thanked: 4 times
Been thanked: 0
Contact:

Re: Set max speed SPI kernel 4.14

Unread post by tam1111574 » Wed Apr 04, 2018 11:30 am

Thank odroid very much, I hope it can work. we only by more eMMC for our product if this problem is resolved, :? :?

User avatar
odroid
Site Admin
Posts: 31363
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 50 times
Been thanked: 184 times
Contact:

Re: Set max speed SPI kernel 4.14

Unread post by odroid » Wed Apr 04, 2018 11:42 am

I see. We may need around one week.

tam1111574
Posts: 109
Joined: Tue Jan 12, 2016 3:51 pm
languages_spoken: english
ODROIDs: oddroid xu4
Has thanked: 4 times
Been thanked: 0
Contact:

Re: Set max speed SPI kernel 4.14

Unread post by tam1111574 » Wed Apr 04, 2018 11:56 am

Thank odroid very much. I'm look forward your funny news..

tam1111574
Posts: 109
Joined: Tue Jan 12, 2016 3:51 pm
languages_spoken: english
ODROIDs: oddroid xu4
Has thanked: 4 times
Been thanked: 0
Contact:

Re: Set max speed SPI kernel 4.14

Unread post by tam1111574 » Tue Apr 10, 2018 3:00 am

Hi Odroid, Do you have some news about port SPI kernel 3.10 to 4.14 :)) ?...

User avatar
odroid
Site Admin
Posts: 31363
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 50 times
Been thanked: 184 times
Contact:

Re: Set max speed SPI kernel 4.14

Unread post by odroid » Tue Apr 10, 2018 9:27 am

We've tried to port it almost one week.
Still it doesn't work well due to complex dependencies.
We need one more week to finish it.

tam1111574
Posts: 109
Joined: Tue Jan 12, 2016 3:51 pm
languages_spoken: english
ODROIDs: oddroid xu4
Has thanked: 4 times
Been thanked: 0
Contact:

Re: Set max speed SPI kernel 4.14

Unread post by tam1111574 » Tue Apr 10, 2018 10:05 am

Thank Odroid very much, This is a good news, i think its will work well .. Thank you again....

User avatar
odroid
Site Admin
Posts: 31363
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 50 times
Been thanked: 184 times
Contact:

Re: Set max speed SPI kernel 4.14

Unread post by odroid » Fri Apr 13, 2018 3:08 pm

We've ported the SPI driver in Kernel 3.10 to 4.14.
But the result is very similar.
Sometimes the full packet data were sent well without the gap.
But we can still observe the gap from time to time.

And we found the Kernel 4.x DMA driver works in a different way from Kernel 3.10.
It seems the priority of the DMA process is much lower and other processes suspend/resume the SPI DMA transfer.
We think it is the main root cause of the gap.
We will look into the DMA driver and IRQ handlers to make it pin at the highest priority.
We may need more time to test various conditions. Sorry for the delay.

BTW, if you want to test Kernel 3.10 with newer eMMC chipsets(Orange eMMC modules), please try this Ubuntu image.
https://wiki.odroid.com/odroid-xu4/os_i ... u/20170731

tam1111574
Posts: 109
Joined: Tue Jan 12, 2016 3:51 pm
languages_spoken: english
ODROIDs: oddroid xu4
Has thanked: 4 times
Been thanked: 0
Contact:

Re: Set max speed SPI kernel 4.14

Unread post by tam1111574 » Fri Apr 13, 2018 4:38 pm

Thank you very much Odroid.. Don't worry about that. Its is good if kernel 3.10 still work with new eMMC... I will try with this image .. I'm very happy about that. Thank for your support. Thank for your team. :D ..

tam1111574
Posts: 109
Joined: Tue Jan 12, 2016 3:51 pm
languages_spoken: english
ODROIDs: oddroid xu4
Has thanked: 4 times
Been thanked: 0
Contact:

Re: Set max speed SPI kernel 4.14

Unread post by tam1111574 » Fri Apr 13, 2018 4:42 pm

Hi Odroid, the ubuntu image ubuntu-16.04.2-minimal-odroid-xu4-20170516.img.xz can work with new eMMC.. :D..

User avatar
odroid
Site Admin
Posts: 31363
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 50 times
Been thanked: 184 times
Contact:

Re: Set max speed SPI kernel 4.14

Unread post by odroid » Fri Apr 13, 2018 5:13 pm

Thank you for the confirmation.

Meanwhile, we will keep trying to improve the SPI performance in Kernel 4.14.

tam1111574
Posts: 109
Joined: Tue Jan 12, 2016 3:51 pm
languages_spoken: english
ODROIDs: oddroid xu4
Has thanked: 4 times
Been thanked: 0
Contact:

Re: Set max speed SPI kernel 4.14

Unread post by tam1111574 » Fri Apr 13, 2018 5:43 pm

Thank Odroid, I check ubuntu-16.04.2-minimal-odroid-xu4-20170516.img.xz the kernel is 4.9... With Ubuntu 16.04 LTS (v1.2) 31/7/2017, Do you have the minimal image :D ?.

User avatar
odroid
Site Admin
Posts: 31363
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 50 times
Been thanked: 184 times
Contact:

Re: Set max speed SPI kernel 4.14

Unread post by odroid » Fri Apr 13, 2018 5:51 pm

Try "ubuntu-16.04-minimal-odroid-xu3-20170727.img.xz". It must have Kernel 3.10.

tam1111574
Posts: 109
Joined: Tue Jan 12, 2016 3:51 pm
languages_spoken: english
ODROIDs: oddroid xu4
Has thanked: 4 times
Been thanked: 0
Contact:

Re: Set max speed SPI kernel 4.14

Unread post by tam1111574 » Fri Apr 13, 2018 6:33 pm

Thank odroid very much .. :D...

Post Reply

Return to “Hardware and peripherals”

Who is online

Users browsing this forum: No registered users and 1 guest