SPI

The Serial Peripheral Interface (SPI) is a transmit/receive, master/slave synchronous serial bus. The phyCORE-AM57x SOM provides access to four SPI ports at the phyCORE-Connector. A few of these SPI interfaces are made available at the connectors but the majority have been muxed for other functionality, see the BSP-Yocto-AM57x-Ampliphy-PD24.1.0 for more information. This guide will show you how to test the SPI interface on the phyCORE-AM57x development kit carrier board via a loopback test with the PHYTEC expansion board. To learn more information about the phyCORE-AM57x SPI, please see section 42 in the Hardware Manual.

Requirements

Development Kit Setup

  • Powered off the kit and remove the power supply.

  • Connect the PHYTEC expansion board (PCM-957) to the carrier board at header X28.

    Expansion Connector Location Expansion Board
  • Connect pins 4D and 5D on the expansion board using a F-F jumper cable.

    These pins correspond to SPI1’s MISO and MOSI signals and by shorting them we can excercise a hardware loop back test.

    SPI Loopback Location

Enabling Overlay & Script

  • Power on the board and press any key to stop autoboot and enter U-Boot.

  • Type the following commands to enable the device tree overlay:

    Target (U-Boot)
     setenv overlays am57xx-phytec-pcm-948-x28-spidev.dtbo
     boot
    

Loop-back Test

  • Initiate the loop-back test on the SPI1 interface (/dev/spidev1.0)

    Target (Linux)
    spidev_test -v -D /dev/spidev1.0
    
    Expected 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 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  |......@.........................|
    

If SPI communication is not functioning properly, only “00”s or “FF”s will be printed in the “rx data”.

This can be demonstrated by running the previous command again with the wire removed.