Shopping Cart | 中文网站
 
 
Overview
Online Support
FAQ
  Atmel Boards  (37) TOP10
  MYD-SAM9X5 (9)
  MYS-SAM9X5 (2)
  MYS-SAM9G45 (1)
  MYD-SAMA5D3X (14)
  MYD-SAM9X5-V2 (2)
  MYC-SAM9X5 (4)
  MYC-SAM9X5-V2 (1)
  MYC-SAMA5D3X (1)
  MYD-JA5D4X (3)
  NXP Boards  (3) TOP10
  MYD-LPC435X (2)
  MYD-LPC185X (1)
  MYD-LPC1788 (0)
  Samsung Boards  (0) TOP10
  TI Boards  (16) TOP10
  MYD-AM335X (9)
  MYC-AM335X (1)
  Rico Board (6)
  Other  (3) TOP10
  MY-WF003U (1)
  Freescale Boards  (2) TOP10
  MYD-IMX28X (2)
  Xilinx Boards  (18) TOP10
  Z-turn Board (10)
  MYD-C7Z010/20 (7)
 
  Home >  Support > Atmel Boards > MYD-SAMA5D3X
 
How to enable SPI1 configuration of the MYD-SAMA5D3X?
 
Question
How to enable SPI1 configuration of the MYD-SAMA5D3X?
Answer

The SPI1_SPCK of the MYD-SAMA5D3X is reused with the LED D6. The SPI1 is not enabled by default. We need to disable D6 if enable the SPI1, configure the device tree and modify the kernel configuration.

1
2
3
4
PC22 SPI1_MISO
PC23 SPI1_MOSI
PC24 SPI1_SPCK -->LED d6 reused

PC25 SPI1_NPCS0


Below are the steps of how to enable SPI1:

Step 1: Disable LED d6

Open  the arch/arm/boot/dts/sama5d3mb.dtsi file and comment the d6 configuration out as shown in below picture:


Step2: Configure and export the SPI1 device node 

Open the arch/arm/boot/dts/sama5d3mb.dtsi file and add below contents under spi0:


1
2
3
4
5
6
7
spi1: spi@f8008000 {
                                        spidev@0 {
                                        compatible = "spidev";
                                        spi-max-frequency = <50000000>;
                                        reg = <0>;
                                };
                        };



Step3: Enable SPI1

Open the arch/arm/boot/dts/sama5d3xek.dts file and add below contents under spi0:


1
2
3


spi1: spi@f8008000 {
                                status = "okay";

                        };



Step4: Recompile  the device tree


1
2
$ export PATH=$PATH: /opt/gcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux/bin/
$ make ARCH=arm dtbs CROSS_COMPILE=arm-linux-gnueabihf

Step5: Configure the kernel and export spidv node

Enter into linux-at91 catalog, consecutively carry out below commands:


1
2
3
4
5
6
7
8
9
(1) Configure.config
$ make ARCH=arm sama5_defconfig
(2) Add spidev, select User mode SPI device driver support
$ make ARCH=arm menuconfig
Device Drivers  --->
         SPI support  --->
                <*>   User mode SPI device driver support
(3) Compile kernel
$ make ARCH=arm uImage CROSS_COMPILE=arm-linux-gnueabihf-

Step6: Test

Short-circuit SPI1_MOSI with SPI1_MISO:


01
02
03
04
05
06
07
08
09
10
11
12
# ./spidev_test -D /dev/spidev32765.0 -s 50000000
spi mode: 0
bits per word: 8
max speed: 5000000 Hz (5000 KHz)
 
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
DE AD BE EF BA AD
F0 0D

Testing program  spidev_test.rar



 

Room 04, 6th Floor, Building No.2, Fada Road, Yunli Intelligent Park, Bantian, Longgang District, Shenzhen, Guangdong, China 518129
E-mail: sales@myirtech.com or myirtech@yahoo.com  Phone: +86-755-22984836  Fax: +86-755-25532724
Copyright © MYIR Tech Limited 2011-2017 all rights reserved.