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  (6) TOP10
  MYD-LPC435X (2)
  MYD-LPC185X (1)
  MYD-LPC1788 (0)
  MYS-6ULX (3)
  Samsung Boards  (0) TOP10
  TI Boards  (21) TOP10
  MYD-AM335X (9)
  MYC-AM335X (1)
  Rico Board (6)
  MYD-C437X-PRU (5)
  Other  (3) TOP10
  MY-WF003U (1)
  Freescale Boards  (2) TOP10
  MYD-IMX28X (2)
  Xilinx Boards  (25) TOP10
  Z-turn Board (10)
  MYD-C7Z010/20 (7)
  MYD-C7Z015 (7)
 
  Home >  Support > Atmel Boards > MYC-SAMA5D3X
 
How to enable SPI1 on MYD-SAMA5D3X board?
 
Question
How to enable SPI1 on MYD-SAMA5D3X board?
Answer

The SPI1_SPCK of the SPI1 on the MYD-SAMA5D3X board is reused with the LED d6. The SPI1 is not enabled by default. To enable SPI1, we need to disable d6. So we need to configure the device tree and modify the kernel configuration.


1

2

3

4

PC22 SPI1_MISO

PC23 SPI1_MOSI

PC24 SPI1_SPCK -->reused with LED d6

PC25 SPI1_NPCS0

 

Below are the guide for how to enable SPI1:

1. Disable LED d6

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



2. Configure and export SPI1 device node
Open the file arch/arm/boot/dts/sama5d3mb.dtsi 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>;

                                };

                        };


3. Enable SPI1
Open the file arch/arm/boot/dts/sama5d3xek.dts
sama5d3xek.dts is matching according to CPU model and add below contents under spi0:

1

2

3

spi1: spi@f8008000 {

                                status = "okay";

                        };


4. 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-


5. Configure the kernel and export spidev node
Get into linux-at91 directory and execute below commands in sequence.

1

2

3

4

5

6

7

8

9

(1)     Configure .config

$ make ARCH=arm sama5_defconfig

(2)Add spidev device support, select User mode SPI device driver support

$ make ARCH=arm menuconfig

Device Drivers  --->

         SPI support  --->

                <*>   User mode SPI device driver support

(3)Compile the kernel

$ make ARCH=arm uImage CROSS_COMPILE=arm-linux-gnueabihf-


6. Test, please short the SPI1_MOSI and 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

 

Download testing program:

   spidev_test.rar


 

Room 04, 6th Floor, Building No.2, Fada Road, Yunli Smart 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.