yahboom
HomeLearn
Solution
Blog
Online Store
About Us
EN/中文
RDK X3 Board📖
1. RDK X3 Board Introduction
  • 1.1 About RDK X3 board
  • 1.2 Write system
  • 1.3 SD expansion
  • 1.4 Hardware interface
  • 1.5 Install case antenna
2. Basic setting
  • 2.1 Network Configuration
  • 2.2 Remote Login
  • 2.3 System Update
  • 2.4 Configure srpi-config
  • 2.5 confit.txt file
  • 2.6 Thermal control-CPU frequency
  • 2.7 Auto-start at boot
  • 2.8 RDK-specific commands usage
  • 2.9 Linux command usage
  • 2.10 GPIO read write
  • 2.11 Image classification algorithm
  • 2.12 USB camera usage
  • 2.13 MIPI camera uasge
3. Basic course
C language
  • 1. Camera image display
  • 2. Save camera image
  • 3. Camera image encoding
  • 4. Video decoding display
  • 5. VPS scaling example
  • 6. Object detection algorithm-fcos
  • 7. Object detection algorithm—YOLOv5
Python
  • 1. Using GPIO
  • 2. Using PWM
  • 3. Using serial port
  • 4. Using I2C
  • 5. Using SPI
Download
  • Image_system
  • Code
  • Software_Tools
Download ZIP

Welcome to RDK X3 Board repository

5. Using SPI

5. Using SPI

Using SPI

Using SPI1. Loopback test2. Hardware connection3. Test process4. Test code

1. Loopback test

RDK X3 leads to the SPI2 bus of the X3M chip on the physical pins 19, 21, 23, 24 on 40Pin, supports one chip select, and the IO voltage is 3.3V.

RDK Ultra leads to the SPI0 bus on the physical pins 19, 21, 23, 24, 26 on 40Pin, supports two chip selects, and the IO voltage is 3.3V.

Please refer to /app/40pin_samples/test_spi.py for details on how to use SPI.

Connect MISO and MOSI on the hardware, then run the spi test program to perform write and read operations. The expected result is that the read data is exactly equal to the written data.

2. Hardware connection

Connect MISO and MOSI together directly through the jumper cap

image-20220512101915524-49489bdedef7ededcef22bdb2c8c459a

3. Test process

  • Run python3 /app/40pin_samples/test_spi.py
  • Select the bus number and chip select number from the printed spi controller as input options. For example, if you choose to test spidev2.0, the bus num is 2, and the cs num is 0. Press Enter to confirm.
xxxxxxxxxx
List of enabled spi controllers:
/dev/spidev2.0  
Please input SPI bus num:2
Please input SPI cs num:0
  • When the program runs correctly, it will continuously print 0x55 0xAA. If it prints 0x00 0x00, it means that the SPI loopback test has failed.
xxxxxxxxxx
Starting demo now! Press CTRL+C to exit
0x55 0xAA
0x55 0xAA

测试

4. Test code

x
#!/usr/bin/env python3

from __future__ import print_function
import sys
import os
import time

# Import spidev module
import spidev

def BytesToHex(Bytes):
    return ''.join(["0x%02X " % x for x in Bytes]).strip()

def spidevTest():
    # Set the SPI bus number (0, 1, 2) and chip select (0, 1)
    spi_bus = input("Please input SPI bus num:")
    spi_device = input("Please input SPI cs num:")
    # Create an object of spidev class to access spidev based Python functions.
    spi=spidev.SpiDev()
    # Open the spi bus handle
    spi.open(int(spi_bus), int(spi_device))

    # Set spi frequency to 12MHz
    spi.max_speed_hz = 12000000

    print("Starting demo now! Press CTRL+C to exit")

    # Send [0x55, 0xAA], receive should also be [0x55, 0xAA]
    try:
        while True:
            resp = spi.xfer2([0x55, 0xAA])
            print(BytesToHex(resp))
            time.sleep(1)
Using I2C

COMPANY

  • About us
  • Team Style
  • Blog

LEARNING & EXPLORATION

  • Tutorials
  • Edge AI hardware
  • Educational robots
  • Embedded intelligent hardware

WHERE TO BUY

  • Yahboom Online Store
  • Amazon
  • Alibaba
  • AliExpress
  • Mercado

TECHNOLOGY SUPPORT

  • Email: support@yahboom.com

BE A DISTRIBUTOR

  • Email: sales@yahboom.com
QR Code

Copyright © 2017-2026 Yahboom. All Rights Reserved.

EN/中文