This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TDA4VM: [TDA4] SPI/SPI_DEV usage issue on on TDA4/J721E

Part Number: TDA4VM

Hi

I tried scidev test in FAQ. (https://e2e.ti.com/support/processors-group/processors/f/processors-forum/947437/faq-ccs-tda4vm-how-to-use-spi-spi_dev-on-tda4-j721e)

But I can't find any scidev class in /sys/class

root@j7-evm:~# ls -l /sys/class/spi*
total 0
lrwxrwxrwx 1 root root 0 Apr 10 00:05 spi6 -> ../../devices/platform/bus@100000/2160000.spi/spi_master/spi6
lrwxrwxrwx 1 root root 0 Apr 10 00:05 spi7 -> ../../devices/platform/bus@100000/bus@100000:bus@28380000/47000000.fss/47040000.spi/spi_master/spi7
lrwxrwxrwx 1 root root 0 Apr 10 00:05 spi8 -> ../../devices/platform/bus@100000/bus@100000:bus@28380000/47000000.fss/47050000.spi/spi_master/spi8
root@j7-evm:~#

I applied the patch in the above link and enable CONFIG_SPI_SPIDEV=y explicitly in arch/arm64/configs/tisdk_j7-evm_defconfig.

I did 'make linux' then 'make linux_install'.

As you know, all the dtbo and Image files are archived into one directory('targetNFS') using setup.sh.

Archivied files are below.

yongsig-vb@yongsigvb-VirtualBox:~/build_server/workspace/TDA4x/psdkla_7.3/targetNFS/boot$ ll
total 79368
drwxr-xr-x 1 1012 1012     4096  2월 11 18:17 ./
drwxr-xr-x 1 1012 1012     4096  4월 10  2021 ../
-rwxr-xr-x 1 1012 1012 16799752  2월 11 18:17 Image*
-rw-r--r-- 1 1012 1012 16799752  4월 10  2021 Image-5.4.106-g023faefa70
-rw-r--r-- 1 1012 1012    98414  2월 11 18:17 k3-j721e-common-proc-board.dtb
-rw-r--r-- 1 1012 1012     8948  2월 11 18:17 k3-j721e-common-proc-board-infotainment.dtbo
-rw-r--r-- 1 1012 1012     1160  2월 11 18:17 k3-j721e-common-proc-board-jailhouse.dtbo
-rw-r--r-- 1 1012 1012     9862  4월 10  2021 k3-j721e-edgeai-apps.dtbo
-rw-r--r-- 1 1012 1012     1025  2월 11 18:17 k3-j721e-pcie-backplane.dtbo
-rw-r--r-- 1 1012 1012    99287  2월 11 18:17 k3-j721e-proc-board-tps65917.dtb
-rw-r--r-- 1 1012 1012    10978  2월 11 18:17 k3-j721e-vision-apps.dtbo
-rwxr-xr-x 1 1012 1012  3256273  2월 11 18:17 System.map*
-rw-r--r-- 1 1012 1012  6874624  4월 10  2021 tisdk-tiny-image-j7-evm.cpio
-rwxr-xr-x 1 1012 1012 21023344  2월 11 18:17 vmlinux*
-rw-r--r-- 1 1012 1012  8123393  4월 10  2021 vmlinux.gz
-rw-r--r-- 1 1012 1012  8123393  4월 10  2021 vmlinux.gz-5.4.106-g023faefa70

After that I copied those files to sdcard/rootfs/boot/

$ sudo cp -rf targetNFS/boot/* /media/yongsig/rootfs/boot/

Please Let me know there is something I missed.

Best regards

Yongsig

  • I applied the patch in the above link and enable CONFIG_SPI_SPIDEV=y explicitly in arch/arm64/configs/tisdk_j7-evm_defconfig.

    In the file arch/arm64/configs/tisdk_j7-evm_defconfig

    There will be a commented line like below:

    #CONFIG_SPI_SPIDEV is not set

    Change that to

    CONFIG_SPI_SPIDEV=y

    Also since you are using the file system in SD card. Do the change below:

    Open the file $PSDK/Rules.make

    Assign DESTDIr=/media/yongsig/rootfs

    Then execute the command:

    sudo make linux_install

    The above steps will ensure that Image/dtb is directly copied to your rootfs. Let me know if this helps. If it does then click on verify answer.

    Best Regards,
    Keerthy

  • Hi Keerthy

    I have already changed to CONFIG_SPI_SPIDEV=y in arch/arm64/configs/tisdk_j7-evm_defconfig but It doesn't work.

    CONFIG_SPI_SPIDEV is set to y in the deconfig file in the same directory.

    After make linux_install, I checked up-to-date files in targetNFS/boot/ directory.

    After changing DESDir to /media/yongsig/rootfs, some error occurs as below.

    yongsig-vb@yongsigvb-VirtualBox:~/build_server/workspace/TDA4x/psdkla_7.3$ sudo make linux_install
    =======================================
    Installing the Linux Kernel DTBs
    =======================================
    install -d /media/yongsig-vb/rootfs/boot
    install: cannot stat '/board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dtb': No such file or directory
    install: cannot stat '/board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/arch/arm64/boot/dts/ti/k3-j721e-proc-board-tps65917.dtb': No such file or directory
    install: cannot stat '/board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board-infotainment.dtbo': No such file or directory
    install: cannot stat '/board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/arch/arm64/boot/dts/ti/k3-j721e-pcie-backplane.dtbo': No such file or directory
    install: cannot stat '/board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board-jailhouse.dtbo': No such file or directory
    install: cannot stat '/board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/arch/arm64/boot/dts/ti/k3-j721e-vision-apps.dtbo': No such file or directory
    install: cannot stat '/board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/arch/arm64/boot/dts/ti/k3-j721e-pcie-backplane.dtbo': No such file or directory
    Makefile:114: recipe for target 'linux-dtbs_install' failed
    make: *** [linux-dtbs_install] Error 1
    

    So I went back to the previous definition.

    As I mentioned I just copied boot directory to the SD card after make linux_intall.

    Please Let me know which files I should copy more.

    Best regards

    Yongsig

  • Hi Yongsig,

    Can you just make sure that CONFIG_SPI_SPIDEV is present only once in the file arch/arm64/configs/tisdk_j7-evm_defconfig.

    cd $PSDK/board-support/linux*

    cp arch/arm64/boot/Image arch/arm64/boot/dts/ti/k3-j721-common-proc-board.dtb /media/yongsig/rootfs/boot

    Regrads.
    Keerthy

  • Hi Keerthy

    Thanks for your reply.

    CONFIG_SPI_SPIDEV is set only once /psdkla_7.3/board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/arch/arm64/configs/tisdk_j7-evm_defconfig.

    After copying arch/arm64/boot/Image again (not archived directory form make linux_install),

    It works well. I thought 'make linux_install' updated the new Image to the archived directory.

    To the next step.

    spi_dev build was failed. Is the CROSS_COMPILE=aarch64-none-linux-gnu- right?

    I tried three options to CROSS_COMPILE.

    1. make ARCH=arm64 CROSS_COMPILE=aarch64-none-linux-gnu- --> FAIL
    2. make ARCH=arm64 CROSS_COMPILE=/home/yongsig/workspace/TDA4x/psdkla_7.3/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/aarch64-none-linux-gnu- --> FAIL
    3. make ARCH=arm64 --> SUCCESS

    Build logs are below.

    yongsig@builder:~/workspace/TDA4x/psdkla_7.3/board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/tools/spi$ make ARCH=arm64 CROSS_COMPILE=aarch64-none-linux-gnu-
    make -f /home/yongsig/workspace/TDA4x/psdkla_7.3/board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/tools/build/Makefile.build dir=. obj=spidev_test
    make[1]: Entering directory '/home/yongsig/workspace/TDA4x/psdkla_7.3/board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/tools/spi'
      CC       spidev_test.o
    /bin/sh: aarch64-none-linux-gnu-gcc: command not found
    /home/yongsig/workspace/TDA4x/psdkla_7.3/board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/tools/build/Makefile.build:96: recipe for target 'spidev_test.o' failed
    make[1]: *** [spidev_test.o] Error 127
    make[1]: Leaving directory '/home/yongsig/workspace/TDA4x/psdkla_7.3/board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/tools/spi'
    Makefile:39: recipe for target 'spidev_test-in.o' failed
    make: *** [spidev_test-in.o] Error 2
    
    efa70-g023faefa70/tools/spi$ make ARCH=arm64 CROSS_COMPILE=/home/yongsig/workspace/TDA4x/psdkla_7.3/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/aarch64-none-linux-gnu-
    make -f /home/yongsig/workspace/TDA4x/psdkla_7.3/board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/tools/build/Makefile.build dir=. obj=spidev_test
    make[1]: Entering directory '/home/yongsig/workspace/TDA4x/psdkla_7.3/board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/tools/spi'
      CC       spidev_test.o
    In file included from spidev_test.c:11:
    /home/yongsig/workspace/TDA4x/psdkla_7.3/linux-devkit/sysroots/x86_64-arago-linux/usr/lib/gcc/aarch64-none-linux-gnu/9.2.1/include/stdint.h:9:16: fatal error: stdint.h: No such file or directory
        9 | # include_next <stdint.h>
          |                ^~~~~~~~~~
    compilation terminated.
    /home/yongsig/workspace/TDA4x/psdkla_7.3/board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/tools/build/Makefile.build:96: recipe for target 'spidev_test.o' failed
    make[1]: *** [spidev_test.o] Error 1
    make[1]: Leaving directory '/home/yongsig/workspace/TDA4x/psdkla_7.3/board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/tools/spi'
    Makefile:39: recipe for target 'spidev_test-in.o' failed
    make: *** [spidev_test-in.o] Error 2
    
    yongsig@builder:~/workspace/TDA4x/psdkla_7.3/board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/tools/spi$ make ARCH=arm64
    make -f /home/yongsig/workspace/TDA4x/psdkla_7.3/board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/tools/build/Makefile.build dir=. obj=spidev_test
    make[1]: Entering directory '/home/yongsig/workspace/TDA4x/psdkla_7.3/board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/tools/spi'
      CC       spidev_test.o
      LD       spidev_test-in.o
    make[1]: Leaving directory '/home/yongsig/workspace/TDA4x/psdkla_7.3/board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/tools/spi'
      LINK     spidev_test
    make -f /home/yongsig/workspace/TDA4x/psdkla_7.3/board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/tools/build/Makefile.build dir=. obj=spidev_fdx
    make[1]: Entering directory '/home/yongsig/workspace/TDA4x/psdkla_7.3/board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/tools/spi'
      CC       spidev_fdx.o
      LD       spidev_fdx-in.o
    make[1]: Leaving directory '/home/yongsig/workspace/TDA4x/psdkla_7.3/board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/tools/spi'
      LINK     spidev_fdx

    And, running was failed when I executed spidev(generated from 3rd build method) on Linux.


    root@j7-evm:~# ls -l /sys/class/spi*
    /sys/class/spi_master:
    total 0
    lrwxrwxrwx 1 root root 0 Apr 10 00:05 spi6 -> ../../devices/platform/bus@100000/2160000.spi/spi_master/spi6
    lrwxrwxrwx 1 root root 0 Apr 10 00:05 spi7 -> ../../devices/platform/bus@100000/bus@100000:bus@28380000/47000000.fss/47040000.spi/spi_master/spi7
    lrwxrwxrwx 1 root root 0 Apr 10 00:05 spi8 -> ../../devices/platform/bus@100000/bus@100000:bus@28380000/47000000.fss/47050000.spi/spi_master/spi8

    /sys/class/spidev:
    total 0
    lrwxrwxrwx 1 root root 0 Apr 10 00:05 spidev6.0 -> ../../devices/platform/bus@100000/2160000.spi/spi_master/spi6/spi6.0/spidev/spidev6.0
    root@j7-evm:~# /spidev_test
    -sh: /spidev_test: cannot execute binary file: Exec format error
    root@j7-evm:~# /spidev_test -v -D /dev/spidev6.0
    -sh: /spidev_test: cannot execute binary file: Exec format error
    root@j7-evm:~#


    Best regards

    Yongsig

  • Hi Yongsig,

    cd $PSDK/board-support/linux-*/tools/spi
    make ARCH=arm64 CROSS_COMPILE=aarch64-none-linux-gnu-
    cp spidev_test /media/$user/rootfs

    The above steps work for me quite well.



    Please compile with the CROSS_COMPILE option.

    - Keerthy

  • Thank you for the quick response.

    I tried again, but it was failed.

    Which one did you use, /bin/ or $(TI_SDK_PATH)/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/aarch64-none-linux-gnu- ?

    There isn't aarch64-none-linux-gnu- in /bin/ of my machine.

    If I didn't include any CROSS_COMPILE in the command,

    I think CROSS_COMPILE is $(TI_SDK_PATH)/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/aarch64-none-linux-gnu- because It was exported in Rules.mak

    Right?

    Best regards

    Yongsig

  • Hi keerthy

    I tried to run a sample application referenced spidev_test on Linux.

    So I got the wanted result like this.

     ===============================
    TEST Usecase
     ===============================
    
     x: Exit
    
     t: SPI Tx Test
     d: Display cpu load on/off
    
    
     Enter Choice: t
    SPI Transfer Start.
    Enter Data: hello world
    TX | 68 65 6C 6C 6F 20 77 6F 72 6C 64 20 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __  |hello world |
    RX | FF FF FF FF FF FF FF FF FF FF FF FF __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __  |............|
    SPI Transfer Done.

    But I was wondering that It could be used for inter-communication with another core such as MCU in mcu-domain.

    Also, Do you have an idea to verify, such as tx-rx loopback test?

    Best regards

    Yongsig.

  • Hi Yongsig,

    Since there are no slave devices we can verify the TX part alone from Linux. Currently the above test is good enough to
    validate the SPI master working with TX.

    - Keerthy

  • Hi Keerthy

    Thank you for your reply.

    I will change the status to resolved after asking one more simple question.

    I was wondering If I could use this SPI transfer to communicate with another core in TDA4VM.

    Please let me know If this  spidev test is for external(means another board) or internal transfer.

    Best regards

    Yongsig.

  • Hi Yongsig,

    There is a very good talk on SPI slave testing: https://archive.fosdem.org/2018/schedule/event/hwenablement_linux_as_spi_slave/

    The above link has slides & video recording. That will be really useful to understand the SPI slave testing. Spidev can be used for slave
    testing. There are other tests recommended there as well. Please check out.

    Closing the issue.

    - Keerthy

  • Hi Yongsig,

    I am still facing the issue for CROSS_COMPILE.

    However, i tried to run " /spidev_test -v -D /dev/spidev6.0" command but its not successful.

    I hope you can help me in this point.

    Thanks,

    Tanvi

  • Tanvi,

    We are compiling spidev_test for the A72 core which is ARM64 architecture based. Please use the ARM64 tool chain to compile.
    Closing this.

    Best Regards,
    Keerthy

  • Hi Keerthy,

    Thanks for the reply.

    Used this command to build spidev_test --> "make ARCH=arm64 CROSS_COMPILE=/home/linux/Chetan/ti-processor-sdk-rtos-j721e-evm-07_03_00_07/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-"

    Thanks & Regards,

    Tanvi

  • That looks alright. What is the error you are facing? Also share the output of:

    ls -l /sys/class/spi*

    Regards,
    Keerthy

  • Hi Keerthy,

    Got the following output -->

    /*************************************************

    /sys/class/spi_master:
    total 0
    lrwxrwxrwx 1 root root 0 Nov 19 18:09 spi6 -> ../../devices/platform/bus@100000/2160000.spi/spi_master/spi6
    lrwxrwxrwx 1 root root 0 Nov 19 18:09 spi7 -> ../../devices/platform/bus@100000/bus@100000:bus@28380000/47000000.fss/4707
    lrwxrwxrwx 1 root root 0 Nov 19 18:09 spi8 -> ../../devices/platform/bus@100000/bus@100000:bus@28380000/47000000.fss/4708

    /sys/class/spi_slave:
    total 0

    /sys/class/spidev:
    total 0
    lrwxrwxrwx 1 root root 0 Nov 19 18:09 spidev6.0 -> ../../devices/platform/bus@100000/2160000.spi/spi_master/spi6/spi6.0/0

    *************************************************/

    And than ran the command -->  "/spidev_test -v -D /dev/spidev6.0"

    Which gave output -->

    /*************************************************

    spi mode: 0x0
    bits per word: 8
    max speed: 500000 Hz (500 KHz)
    TX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |......@..........|
    RX | FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF |.................|

    *************************************************/

    Thanks & Regards,

    Piyush

  • Can you try: /spidev_test -v -D /dev/spidev6.0 -p "HELLOWORLD"

    Best Regards,
    Keerthy

  • Hi Keerthy,

    Sorry for the late reply. I followed what you asked and output i got is -->

    /*******************************************************************************************************************************************************

    root@j7-evm:~# /spidev_test -v -D /dev/spidev6.0 -p "HELLOWORLD"
    spi mode: 0x0
    bits per word: 8
    max speed: 500000 Hz (500 KHz)
    TX | 48 45 4C 4C 4F 57 4F 52 4C 44 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ |HELLOWORLD|
    RX | FF FF FF FF FF FF FF FF FF FF __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ |..........|

    *******************************************************************************************************************************************************/

    Let me know if this is the desired outcome.

    Also, can we use this application to try SPI between the cores ?

    Please also view this thread and if possible suggest me some answer to the query.

    https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1079319/tda4vm-building-ipc-spi-profiling-application-to-work-along-with-linux

    Thanks  & Regards,

    Tanvi

  • Tanvi,

    Yes TX is working for you. That is the desired outcome.


    e2e.ti.com/.../quote]

    The thread assignee will be answering this shortly.

    Also, can we use this application to try SPI between the cores ?

    Please create a separate thread. I am closing this thread.

    - Keerthy

    [/quote]