UP xtreme SPI speed problem

jhp
jhp New Member Posts: 15

i have upboard with RT-patch is being used for SPI communication. (more than 6MHz)
(ubuntu16.04, kernel 4.4.86)
link : https://github.com/QiayuanLiao/Ubuntu-RT-UP-Board

recently, I needed a faster operation, so I bought up extreme.
(ubuntu18.04, kernel Linux upxtreme-UP-WHL01 5.0.0-1-generic)
link : https://wiki.up-community.org/Ubuntu_18.04#Install_Ubuntu_kernel_5.0.0_from_PPA_on_Ubuntu_18.04
i expected batter than UPboard. but I can currently communicate with SPI at a speed of 2MHz.
When the communication speed is increased(more than 2MHz), data corruption or shift occur.
I tried applying lowlatency as well, but it failed(same problem).

The development board(STM32F4) is directly connected on the 40pin header, and there is no communication problem in the upboard.

setting value
data length is more than 100byte.
spi mode : SPI_MODE_0
bits per word : 8bits
SPI_IOC_RD_LSB_FIRST : 0x01

Tagged:

Comments

  • DCleri
    DCleri Administrator, AAEON Posts: 1,213 admin
    edited September 2020
  • jhp
    jhp New Member Posts: 15

    @DCleri said:
    Please check out this topic for more info: https://forum.up-community.org/discussion/comment/11316

    ======================================================================================================

    We can confirm that there is an issue with the SPI kernel driver up to version 5.3.4 where you can reach a maximum speed without errors >of 3.6Mbps (when set max speed of 12Mhz)

    From kernel 5.3.5 onwards (including 5.4) you can go up to 11.3Mbps (when set max speed of 12Mhz)

    We are currently working on upgrading our kernel support to 5.4 LTS (for both Ubuntu and Yocto), which will be available later this year.

    ======================================================================================================

    1. i can find only kernel 5.3.0 (https://launchpad.net/ubuntu/+source/linux-hwe-edge/5.3.0-24.26~18.04.2).
      let me know any other link?
  • DCleri
    DCleri Administrator, AAEON Posts: 1,213 admin

    there is a kernel 5.4: https://packages.ubuntu.com/bionic/linux-generic-hwe-18.04-edge

    but it doesn't include our patches for pincontrol, we are currently working on it and we expect to have it released in early Q4

  • jhp
    jhp New Member Posts: 15

    i use low latency kernel now (Linux upx-UP-WHL01 5.0.8 #3 SMP PREEMPT Tue Aug 25 17:56:31 KST 2020 x86_64 x86_64 x86_64 GNU/Linux )
    When viewed through an oscilloscope, I found that the clock stopped in the middle at a setting of 13MHz or higher.
    Because of this, communication errors(shift, change, loss) are occurring, and there is a limit to speeding up the communication speed.

    Will this problem be solved in the currently produced kernel? (kernel 5.4)
    I have to send and receive more than 150 bytes of data per cycle with a clock of more than 20MHz and a cycle of less than 500us.

  • jhp
    jhp New Member Posts: 15

    When looking at the time between the point where the CS pin goes low and the point where the clock starts, it can be seen that the UP board takes 28us time at 12MHz clock and the UP xtreme takes 0.48us time at the same clock.
    It was confirmed that the time of UP board was similar regardless of clock, but UP xtreme decreased to 0.25us.
    If a program is created using CS interrupt, it can be seen that there is a problem in data catching due to a short time of 0.48us in UP xtreme.
    To fix this, I am wondering if there is a way to adjust the time until the clock starts after the CS pin goes low.

  • DCleri
    DCleri Administrator, AAEON Posts: 1,213 admin

    Hello @jhp

    The SPI performance on UP Series are affected mainly by the Intel SPI driver implementation.
    As mentioned in previous posts, the newer Kernels from 5.4 onward, are improving considerably the performance for UP Xtreme, resolving previously highlighted issues.

    At this moment we have tested Speed on UP and UP Xtreme up to 12 Mhz with Kernel 5.4, so we cannot tell right now if the SPI driver on 5.4 allows to reach the 20Mhz requirement. We will extend our test cases to increase the test speed for the SPI interfaces before releasing the new Kernel based on 5.4.

    As mentioned above, that depends on the Intel SPI driver implementation and internals of the SPI controller, so the best way would be to either file a bug or report the issue on the Intel communities where their kernel developer may help to address this specific issue.

  • jhp
    jhp New Member Posts: 15

    Can you give me a specific release schedule for kernel 5.4?

  • DCleri
    DCleri Administrator, AAEON Posts: 1,213 admin

    Kernel 5.4 upgrade work is ongoing.

    The release is delayed due some issues encountered during the upgrade on the driver specific for the UP Board (first generation UP based on Cherry Trail).
    We expect to release the kernel as soon as the issue is solved and validation completed, hopefully just few weeks from now.

  • jhp
    jhp New Member Posts: 15

    5.4 The kernel update is late, please let me know when it will be released.

  • Bleuten
    Bleuten New Member Posts: 3

    Are there any known reason(s) for this high 28us delay on the up board CS ?

  • DCleri
    DCleri Administrator, AAEON Posts: 1,213 admin

    Kernel 5.4 has been released for both Ubuntu 18.04 and 20.04:
    https://github.com/up-board/up-community/wiki/Ubuntu_18.04
    https://github.com/up-board/up-community/wiki/Ubuntu_20.04

    For the delay mentioned, if he is using the CS1, the pin is emulated via GPIO on the pinctrl driver on UP Board, as it is not available natively on the Cherry Trail SoC

  • rock11
    rock11 New Member Posts: 3
    edited December 2021

    @DCleri said:
    Kernel 5.4 has been released for both Ubuntu 18.04 and 20.04:
    https://github.com/up-board/up-community/wiki/Ubuntu_18.04
    https://github.com/up-board/up-community/wiki/Ubuntu_20.04

    For the delay mentioned, if he is using the CS1, the pin is emulated via GPIO on the pinctrl driver on UP Board, as it is not available natively on the Cherry Trail SoC

    Hi DCleri,
    i got the kernel 5.4 both in 18.04 and 20.04.
    it doesn't work. The rv is 0, but I can't get any bounce on the pins(spi_mosi, spi_miso, spi_clk) with oscilloscope.

    this spi dirver from : https://github.com/up-board/up-community/raw/main/driver/spi-enable_upxtreme.zip

    it did work well but slowly in last spi-driver, but the old url( https://wiki.up-community.org/images/7/78/Spi-enable_upxtreme.zip ) is invalid now.

    Can you confirm this spi-driver problem?

  • rock11
    rock11 New Member Posts: 3

    @rock11 said:

    @DCleri said:
    Kernel 5.4 has been released for both Ubuntu 18.04 and 20.04:
    https://github.com/up-board/up-community/wiki/Ubuntu_18.04
    https://github.com/up-board/up-community/wiki/Ubuntu_20.04

    For the delay mentioned, if he is using the CS1, the pin is emulated via GPIO on the pinctrl driver on UP Board, as it is not available natively on the Cherry Trail SoC

    Hi DCleri,
    i got the kernel 5.4 both in 18.04 and 20.04.
    it doesn't work. The rv is 0, but I can't get any bounce on the pins(spi_mosi, spi_miso, spi_clk) with oscilloscope.

    this spi dirver from : https://github.com/up-board/up-community/raw/main/driver/spi-enable_upxtreme.zip

    it did work well but slowly in last spi-driver, but the old url( https://wiki.up-community.org/images/7/78/Spi-enable_upxtreme.zip ) is invalid now.

    Can you confirm this spi-driver problem?

    after i updated the bios, it's ok.
    But there is a new problem. When the interval between two requests is less than 2 ms, the data is wrong.


    the cs pin:
    twice interval is 100ms:

    twice interval is 2ms:

  • DCleri
    DCleri Administrator, AAEON Posts: 1,213 admin

    Thanks for the extensive testing and detailed report.

    Can you please provide the complete configuration you have both HW and SW?

    BIOS Version
    Ubuntu Version
    Kernel version

    on the hardware side, if you can specify the setup and steps so we can better check internally.

  • rock11
    rock11 New Member Posts: 3

    @DCleri said:
    Thanks for the extensive testing and detailed report.

    Can you please provide the complete configuration you have both HW and SW?

    BIOS Version
    Ubuntu Version
    Kernel version

    on the hardware side, if you can specify the setup and steps so we can better check internally.

    bios: AfuEfix64-5.12.05.2125.efi
    ubuntu: 18.04.05
    install kernel by 'sudo apt-get install linux-generic-hwe-18.04-5.4-upboard'

    Kernel: Linux upxtreme-UP-WHL01 5.4.0-1-generic #2~upboard2-Ubuntu

  • JackeySchofield
    JackeySchofield New Member Posts: 5

    @rock11 said:

    @DCleri said:
    Thanks for the extensive testing and detailed report.

    Can you please provide the complete configuration you have both HW and SW?

    BIOS Version
    Ubuntu Version
    Kernel version

    on the hardware side, if you can specify the setup and steps so we can better check internally.

    bios: AfuEfix64-5.12.05.2125.efi
    ubuntu: 18.04.05
    install kernel by 'sudo apt-get install linux-generic-hwe-18.04-5.4-upboard'

    Kernel: Linux upxtreme-UP-WHL01 5.4.0-1-generic #2~upboard2-Ubuntu

    Did you solve this problem, I have the same problem。

  • JackeySchofield
    JackeySchofield New Member Posts: 5

    @JackeySchofield said:

    @rock11 said:

    @DCleri said:
    Thanks for the extensive testing and detailed report.

    Can you please provide the complete configuration you have both HW and SW?

    BIOS Version
    Ubuntu Version
    Kernel version

    on the hardware side, if you can specify the setup and steps so we can better check internally.

    bios: AfuEfix64-5.12.05.2125.efi
    ubuntu: 18.04.05
    install kernel by 'sudo apt-get install linux-generic-hwe-18.04-5.4-upboard'

    Kernel: Linux upxtreme-UP-WHL01 5.4.0-1-generic #2~upboard2-Ubuntu

    Did you solve this problem, I have the same problem。

    @DCleri We installed ubuntu18.04 and 5.4.0.1 kernels in upxtreme, and encountered the spi speed problem. When using spics0, it can support up to 12mhz, but using cs1 cannot exceed 3mhz. Once it exceeds 3mhz, spi will not receive data. Excuse me Does anyone have the same problem?