Unable to get multiple PWM pins to work simultaneously

Issue Overview

Users are experiencing difficulties when attempting to generate PWM signals on multiple GPIO pins of the Nvidia Jetson Orin Nano Dev board. Specifically, while individual PWM signals can be generated on pins 15, 32, and 33, only one signal persists when trying to activate two pins simultaneously. The issue occurs during the execution of a Python script utilizing the Jetson.GPIO library for PWM control.

Symptoms

  • Only one PWM signal is active at a time when attempting to control multiple pins.
  • The last initialized PWM pin is the only one that successfully outputs a signal.

Context

  • The problem arises in a Python script designed to control two PWM pins (15 and 33) with a frequency of 50 Hz and a duty cycle that varies from 0% to 100%.
  • Users have confirmed the issue using an oscilloscope and debugging tools like pdb.

Relevant Specifications

  • Hardware: Nvidia Jetson Orin Nano Dev board
  • Software: Python script using Jetson.GPIO library

Frequency

The issue appears consistently whenever users attempt to control multiple PWM signals simultaneously.

Impact

This limitation affects users’ ability to implement applications requiring simultaneous control of multiple devices, thereby hindering functionality in robotics and automation projects.

Possible Causes

  • Hardware Incompatibilities or Defects: There may be limitations in the hardware design that prevent simultaneous PWM operation on certain GPIO pins.

  • Software Bugs or Conflicts: There could be issues within the Jetson.GPIO library that affect how multiple PWM instances are managed.

  • Configuration Errors: Incorrect setup of GPIO pins may lead to conflicts in signal generation.

  • Driver Issues: Outdated or incompatible drivers for the GPIO library may cause unexpected behavior.

  • User Errors or Misconfigurations: Improper initialization order of PWM objects can result in only one pin functioning as intended.

Troubleshooting Steps, Solutions & Fixes

To address the issue of generating PWM signals on multiple pins simultaneously, follow these troubleshooting steps:

  1. Verify GPIO Setup:

    • Ensure each PWM pin is set up individually rather than passing a list to GPIO.setup. Modify the code as follows:
    GPIO.setup(pwm_pins[0], GPIO.OUT, initial=GPIO.HIGH)
    p1 = GPIO.PWM(pwm_pins[0], _frequency_hz)
    p1.start(_duty_cycle_percent)
    
    GPIO.setup(pwm_pins[1], GPIO.OUT, initial=GPIO.HIGH)
    p2 = GPIO.PWM(pwm_pins[1], _frequency_hz)
    p2.start(_duty_cycle_percent)
    
  2. Test Initialization Order:

    • Confirm that initializing the PWM objects after setting up each pin resolves the issue. The last initialized object should not be the only one functioning.
  3. Introduce Sleep Between Commands:

    • If issues persist, try adding a delay between calls to ChangeDutyCycle:
    time.sleep(0.5)  # Add delay between changes
    
  4. Check for Driver Updates:

    • Ensure that you are using the latest version of the Jetson.GPIO library and any relevant drivers for your board.
  5. Use Terminal Commands for Testing:

    • Validate that writing directly to the duty cycle files via terminal works correctly:
    echo 8000000 > /sys/devices/platform/3280000.pwm/pwm/pwmchip0/pwm0/duty_cycle
    echo 13000000 > /sys/devices/platform/32c0000.pwm/pwm/pwmchip2/pwm0/duty_cycle
    
  6. Review Documentation:

    • Check any README or official documentation related to the Jetson.GPIO library for notes on limitations regarding multiple channel setups.
  7. Monitor System Files:

    • Use cat commands to monitor changes in duty cycle files during script execution to confirm which files are being modified.
  8. Seek Community Support:

    • If problems persist, consider posting detailed findings in forums or communities dedicated to Nvidia Jetson hardware for further assistance.

By following these steps, users should be able to diagnose and potentially resolve issues related to simultaneous PWM operation on their Nvidia Jetson Orin Nano Dev board.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *