HOME
Shop
  • English
  • 简体中文
HOME
Shop
  • English
  • 简体中文
  • Product Series

    • FPGA+ARM

      • GM-3568JHF

        • 1. Introduction

          • GM-3568JHF Introduction
        • 2. Quick Start

          • 01 Environment Construction
          • 02 Compilation Instructions
          • 03 Burning Guide
          • 04 Debugging Tools
          • 05 Software Update
          • 06 View information
          • 07 Test Command
          • 08 Application Compilation
          • 09 Source code acquisition
        • 3. Peripherals and Interfaces

          • USB
          • Display and touch
          • Ethernet
          • WIFI
          • Bluetooth
          • TF-Card
          • Audio
          • Serial Port
          • CAN
          • RTC
        • 4. Application Development

          • 01 UART read and write case
          • 02 Key detection case
          • 03 LED light flashing case
          • 04 MIPI screen detection case
          • 05 Read USB device information example
          • 06 FAN Detection Case
          • 07 FPGA FSPI Communication Case
          • 08 FPGA DMA read and write case
          • 09 GPS debugging case
          • 10 Ethernet Test Cases
          • 11 RS485 reading and writing examples
          • 12 FPGA IIC read and write examples
          • 13 PN532 NFC card reader case
          • 14 TF card reading and writing case
        • 5. QT Development

          • 01 ARM64 cross compiler environment construction
          • 02 QT program added automatic startup service
        • 6. Others

          • 01 Modification of the root directory file system
          • 02 System auto-start service
    • ShimetaPi

      • M4-R1

        • Introduction

          • M4-R1 Introduction
        • Get started quickly

          • OpenHarmony概述
          • 镜像烧录
          • 开发环境准备
          • Hello World应用以及部署
        • Application Development

          • getting Started

            • 第一章 ArkTS语言简介
            • 第二章 UI组件介绍和实际应用(上)
            • 第三章 UI组件介绍和实际应用(中)
            • 第四章 UI组件介绍和实际应用(下)
          • Advanced

            • 第一章 入门指引
            • 第二章 三方库的引用和使用
            • 第三章 应用编译以及部署
            • 第四章 命令行恢复出厂设置
            • 第五章 系统调试--HDC调试
            • 第六章 APP 稳定性测试
            • 第七章 应用测试
        • Equipment Development

          • 第一章 环境搭建
          • 第二章 下载源码
          • 第三章 编译源码
        • Peripherals and interfaces

          • 树莓派接口
          • GPIO 接口
          • I2C 接口
          • SPI通信
          • PWM控制
          • 串口通讯
          • TF Card
          • 屏幕
          • 触摸
          • 音频
          • RTC
          • Ethernet
          • M.2
          • MINI-PCIE
          • Camera
          • WIFI&BT
          • 树莓派拓展板
        • Frequently asked questions

          • 资源下载
      • M5-R1

        • Introduction

          • Introduction to ShimetaPi M5-R1
    • OpenHarmony

      • SC-3568HA

        • Introduction

          • SC-3568HA Overview
        • Quick Start Guide

          • OpenHarmony Overview
          • Image Flashing
          • Setting Up the Development Environment
          • Hello World Application and Deployment
        • Application Development

          • ArkUI

            • Chapter 1 Introduction to ArkTS Language
            • Chapter 2 Introduction to UI Components and Practical Applications (Part 1)
            • Chapter 3 Introduction to UI Components and Practical Applications (Part 2)
            • Chapter 4 Introduction to UI Components and Practical Applications (Part 3)
          • Expand

            • Chapter 1 Getting Started Guide
            • Chapter 2 Referencing and Using Third-Party Libraries
            • Chapter 3: Application Compilation and Deployment
            • Chapter 4: Command-Line Factory Reset
            • Chapter 5: System Debugging -- HDC (Huawei Device Connector) Debugging
            • Chapter 6 APP Stability Testing
            • Chapter 7 Application Testing
        • Device Development

          • Chapter 1 Environment Setup
          • Chapter 2 Download Source Code
          • Chapter 3 Compiling Source Code
        • Peripheral And Iinterface

          • Raspberry Pi interface
          • GPIO Interface
          • I2C Interface
          • SPI communication
          • PWM (Pulse Width Modulation) control
          • Serial port communication
          • TF Card
          • Display Screen
          • Touch
          • Audio
          • RTC
          • Ethernet
          • M.2
          • MINI-PCIE
          • Camera
          • WIFI&BT
          • Raspberry Pi expansion board
        • Frequently Asked Questions

          • Resource Downloads
      • M-K1HSE

        • Introduction

          • M-K1HSE Introduction
        • Quick Start

          • Development environment construction
          • Source code acquisition
          • Compilation Notes
          • Burning Guide
        • Peripherals and interfaces

          • 01 Audio
          • 02 RS485
          • 03 Display
        • System customization development

          • System transplant
          • System customization
          • Driver Development
          • System Debugging
          • OTA Update
    • EVS-Camera

      • CF-NRS1

        • 1. Introduction

          • Event Camera Technical Documentation
        • 2. Quick Start

          • Host driver and software installation
        • 3. SDK application development

          • API Usage Instructions
      • CF-CRA2

        • Introduction

          • About CF-NRS1
    • AI-model

      • 1684XB-32T

        • Introduction

          • AIBOX-1684XB-32 Introduction
        • Get started quickly

          • First time use
          • Network Configuration
          • Disk usage
          • Memory allocation
          • Fan Strategy
          • Firmware Upgrade
        • Deployment Tutorial

          • Algorithm deployment
          • Deploy Llama3 Example
        • Application Development

          • Sophgo SDK Development
          • Sophon LLM_api_server development
          • Deploy MiniCPM-V-2_6
          • Qwen-2-5-VL Image and Video Recognition DEMO
          • Qwen3-chat-DEMO
          • Qwen3-Qwen Agent-MCP-Demo
          • Qwen3-langchain-AI Agent
      • 1684X-416T

        • Introduction

          • AIBOX-1684X-416 Introduction
        • Demo simple operation guide

          • Simple instructions for using shimeta smart monitoring demo
    • Core-Board

      • C-3568BQ

        • Introduction

          • C-3568BQ Overview
      • C-3588LQ

        • Introduction

          • C-3588LQ Introduction
      • GC-3568JBAF

        • Introduction

          • GC-3568JBAF Introduction
      • C-K1BA

        • Introduction

          • C-K1BA Introduction

07 FPGA FSPI Communication Case

1 Case Introduction

This case aims to run the Linux system on the ARM side and perform read and write tests on the FPGA DRAM through the FSPI bus.

2 Communication process between ARM and FPGA

Implementing SPI Master Function on ARM

Open the SPI device node: Open the /dev/spidev4.0 device node.

Configure the FSPI bus: Use the ioctl command to configure the polarity, phase, communication rate, data length and other parameters of the FSPI bus.

Select the transmission mode: You can choose single-line mode, two-line mode or four-line mode. When set to four-line mode, both data transmission and reception will adopt four-line mode. This case only supports four-line mode.

Data transfer: Send data to the FSPI bus and read data from the FSPI bus.

Verify data: Verify the transmitted data and then print out the read/write rate and bit error rate.

Implementing SPI Slave Function on FPGA

Data storage: FPGA saves the data sent by SPI Master to DRAM.

Data read: When the SPI Master initiates a data read request, the FPGA reads data from the DRAM and transmits it to the SPI Master through the FSPI bus.

3 Operation process

Open the terminal and copy the executable program smdt_spi_rw in the bin directory of this case (05-Development Materials\Software Development Materials\linux_demo\smdt_fpga_fspi_demo\bin) to the development board file system (the source code can be viewed in the src path).

#修改 Linux 内核日志的显示级别,内核的日志级别被设置为只显示紧急或更高级别的消息
echo 1 4 1 7 > /proc/sys/kernel/printk

Execute the following command in the terminal to switch to the directory where the smdt_fpga_fspi_demo executable program is located

#切换到 smdt_fpga_fspi_demo 可执行程序所在目录
cd ‘the file's directory’

#查看 smdt_spi_rw 是否在该目录下
ls

If the executable file smdt_spi_rw is in the current directory, modify the permissions of the executable file

#修改文件权限
chmod 777 smdt_spi_rw 

#查询是否修改成功
ls -ld smdt_spi_rw

After confirming that the file modification permission is successful, execute ./smdt_spi_rw -h to view the help information of the program.

#查看帮助信息
./smdt_spi_rw  -h

The execution result is as follows:

FPGA_FSPI_1

Functional testing

Enter the following instructions. On the ARM side, 2048 bytes of random data are written into the FPGA's DRAM via the FSPI bus configured in four-wire mode. The data is then read for verification and the read and write speed of the FSPI bus and the calculated bit error rate are printed out. The execution results are shown in the figure below.

./smdt_spi_rw -d /dev/spidev4.0 -s 150000000 -OH -m 3 -S 2048 -c 1

# The parameters are explained as follows:

# `-d`:Used to specify the device node.

# `-s`:Used to set the frequency of the communication clock, with the unit being hertz (Hz).

# `-O`:Represents clock polarity inversion, i.e., CPOL (Clock Polarity) is set to 1.

# `-H`:Indicates that data is sampled on the second edge at the start of the clock cycle, i.e., CPHA (Clock Phase) is set to 1.

# `-m`:Selects the transmission mode, where 1 represents single-wire mode, 2 represents dual-wire mode, and 3 represents four-wire mode.

# `-S`:Sets the size of the transmitted data, with the unit being bytes (Byte).

# `-c`:Sets the number of times to cyclically transmit data packets.
FPGA_FSPI_2

As can be seen from the above figure, the measured write rate is 5.81 MB/s, the read rate is 10.5 MB/s, and the bit error rate is 0.00%.

Performance Testing

When performing performance testing, the communication clock frequency of the FSPI bus needs to be set to 150MHz. Under this setting, ARM will write 1MB of random data to the FPGA's DRAM through the FSPI bus, then read the data, and repeat this process 100 times. No data verification is performed during the test, and the read and write speed and error rate of the FSPI bus will be output in the end. The execution results are shown in the figure below. This case design reads and writes 2048Byte of random data to the FPGA DRAM at a time, so the bit error rate is high.

./smdt_spi_rw -d /dev/spidev4.0 -s 150000000 -OH -m 3 -S 1048576 -c 100
FPGA_FSPI_3
Edit this page on GitHub
Last Updated:
Contributors: zsl, zwhuang
Prev
06 FAN Detection Case
Next
08 FPGA DMA read and write case