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

2. Using PWM

Using PWM

Using PWM1. Test code2. Result

The Hobot-GPIO library only supports PWM on pins with additional hardware PWM controllers. Compared to RPi The GPIO library is different, Hobot-GPIO library does not implement software simulation PWM. Both RDK X3 and RDK Ultra support 2 PWM channels.

Please refer to/app/40pin_stamples/sample_pwm. py for detailed information on how to use PWM channels.

1. Test code

Open the PWM channel specified by output_pin, with an initial duty cycle of 25%.

First, increase the duty cycle by 5% every 0.25 seconds, and then reduce the duty cycle by 5% every 0.25 seconds after reaching 100%.

When the waveform is output normally, you can measure the output signal with an oscilloscope or logic analyzer to observe the waveform.

x
#!/usr/bin/env python3

import Hobot.GPIO as GPIO
import time

# PWM supported pins: 32 and 33
output_pin = 33

def main():
    # Pin Setup:
    # Board pin-numbering scheme
    GPIO.setmode(GPIO.BOARD)
    # Frequency range supported by RDK X3: 48KHz ~ 192MHz
    # Frequency range supported by RDK Ultra: 1Hz ~ 12MHz
    p = GPIO.PWM(output_pin, 48000)
    # Initial duty cycle is 25%. First, increase the duty cycle by 5% every 0.25 seconds. After reaching 100%, decrease the duty cycle by 5% every 0.25 seconds.
    val = 25
    incr = 5
    p.start(val)

    print("PWM running. Press CTRL+C to exit.")
    try:
        while True:
            time.sleep(0.25)
            if val >= 100:
                incr = -incr
            if val <= 0:
                incr = -incr
            val += incr
            p.ChangeDutyCycle(val)
    finally:
        p.stop()
        GPIO.cleanup()

if __name__ == '__main__':
    main()

2. Result

The successful running code is as shown below.

运行

Using a logic analyzer or oscilloscope, you can measure the output signal and observe the waveform.

结果

Using GPIO
Using serial port

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/中文