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.

Accessing spidev node on AM1808

Other Parts Discussed in Thread: AM1808

Hi,

I am using LogicPD's Zoom AM1808 eXperimenter Kit with ti-sdk-am180x-evm-4.0.1.0 having linux-2.6.33-rc4-psp03.20.00.14.sdk & tisdk-rootfs-am180x-evm arago file system. The spidev node is not visible under /dev directory. I want to access SPI from user space. How can I get the spidev node under /dev ?

Regards,

Jitendra

  • Hi,

    Follow the guide to rebuilding the kernel  at http://processors.wiki.ti.com/index.php/AMSDK_Linux_User's_Guide

    When you reach the point of "Customizing the Kernel", use the menuconfig path and enable the following option:

     

    [*] Device Drivers--->

    [*] SPI support--->

    <*> User mode SPI device driver support

     

    Follow the rest of the guide, deploy the resulting kernel and you will have spidev support

  • Hi Matt,

    I followed the procedure from link you mentioned with the stock kernel & file system but i dint see any spi related node in /dev.

    Do I need to make any additions in /home/jitendra/ti-sdk-am180x-evm-4.0.1.0/psp/linux-2.6.33-rc4-psp03.20.00.14.sdk/arch/arm/mach-davinci/board-da850-evm.c file as discussed in some other forums ?

    Regards,

    Jitendra

  • Hi Jitendra,

    Yes you do. In order to instantiate a spidev device you must register it in your platform code. This is going to be specific to your hardware, of course. I've attached a patch which demonstrates what is required to change the SPI flash device registration on the AM1808-EVM into a spidev registration. If you do this on the EVM, then the m25p80 will no longer be registered to match with the MTD flash driver, instead it will match with the spidev driver and a /dev/spidev1.0 device node will be instantiated. Remember that the modalias field in struct spi_board_info is what is used to match a device with an appropriate Linux device driver (in this case the userspace API spidev driver).

    Please note that on 2.6.33-rc4 kernel included with the SDK 4.0.1.0 release, the SPI driver support is very minimal compared to that of the 2.6.37 kernel included in the SDK 5.0.2.0. Specifically, only one of the hardware chip selects is supported per SPI interface instance and only one SPI interface instance is supported. I recommend basing any new work on the 2.6.37-based release.

    Regards,

    Matt

  • 6330.uImage_scrshot.txtHi matt,

       Please find the attached file for booting the system with ti-sdk-am180x-evm- 05.03.02.00. But in 5.3.2.0 the system hang up at kernel panic (Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block (2, 0)). So how to solve this problem.

     

    Regard,

    Jitendra

  • Jitendra,

    Please include the .config you used to build the kernel and if you can grab a boot log that's not truncated that would also help. If you look at your screen shot, the kernel boot arguments are truncated, perhaps you don't have line wrap on in minicom when capturing it.

    Regards,

    Matt

  • Hi Matt,

        1050.uImage_scrshot1.txt

      The attached file is for your reference.First we are trying with pre build image (ti-sdk-am180x-evm- 05.03.02.00) & not configuring the kernel still we are facing the same issue.

     

    Regards,

    Jitendra

  • Hi Matt,

        When i used the ti-sdk-am180x-evm- 4.0.1.0 with spidev.diff & run the command root@am180x-evm:~# ./spi_arm -D /dev/spidev1.0 -s30000000 -l

     i got the response as follows,

    spi mode: 32
    bits per word: 8
    max speed: 30000000 Hz (30000 KHz)

    00 00 00 00 00 00
    00 00 00 00 00 00
    00 00 00 00 00 00
    00 00 00 00 00 00
    00 00 00 00 00 00
    00 00 00 00 00 00
    00 00

    But the array which is defined in spidev_test.c is as follows,

      0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
      0x40, 0x00, 0x00, 0x00, 0x00, 0x95,
      0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
      0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
      0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
      0xDE, 0xAD, 0xBE, 0xEF, 0xBA, 0xAD,
      0xF0, 0x0D,

    so why i am getting all 00 ?

  • Hi Jitendra,

    Can you try with a frequency of 10MHz instead of 30MHz?

    Regards, Sudhakar

  • Hi,

       I done some changes in some file & i got the node spidev1.1 & spidev1.0. I checked this node with spidev_test.c & it is working fine.But i want to access spi0.so how to get this spi0? is there any changes i have to do in any of the file?

  • Hi,

    The 2.6.32-based release only supports the second spi instance as I mentioned in an earlier post. You can either move to a 2.6.37-based released which instantiates both spi interfaces or use that code as a model to backport the initialization of the spi0 interface.

    -Matt

  • hello ,

    I was trying to test spitest.c file which was properly worked on am1808 sodimm board , i just loop backed the (MISO) & (SIMO) . it worked properly but my question is how it worked since in mux.h file i commented the MISO and SIMO pin the same i did in da850.c also only the change which i did was only pass the "spidev" structure in board-calixto-evm.c but still data in and out worked . how ????
  • hello ,

    I was trying to test spitest.c file which was properly worked on am1808sodimm board , i just loop backed the (MISO) & (SIMO) . it worked properly but my question is how it worked since in mux.h file i commented the MISO and SIMO pin the same i did in da850.c also only the change which i did was only pass the "spidev" structure in board-calixto-evm.c but still data in and out worked . how ????

    4276.board-calixto-evm.c