GPIO and PWM Input Reading Issue on Nvidia Jetson Orin Nano

Issue Overview

Users are experiencing difficulties reading PWM input signals on the Nvidia Jetson Orin Nano development board. The specific symptoms include:

  • Inability to read PWM signals using GPIO pins
  • Low voltage levels (300mV) when connecting PWM signals to the Jetson
  • Interrupt Service Routines (ISRs) not being called as expected
  • No change in pin level when using gpioRead() function

The issue occurs during attempts to read PWM signals from external devices, such as remote controllers or buttons. It affects the functionality of projects requiring precise timing or servo control.

Possible Causes

  1. Incorrect Pin Configuration: The pins may not be properly configured for PWM input, as they are set to GPIO mode by default.

  2. Pin Multiplexing (PINMUX) Settings: The initial state of the pins in the PINMUX spreadsheet may not be suitable for PWM input.

  3. Software Library Limitations: The JETGPIO library being used does not have built-in functions for reading PWM signals.

  4. Hardware Pull-down: The pin might be pulled low by other hardware components or programs.

  5. Conflicting Drivers: Other drivers or programs may be occupying the pin, preventing proper signal reading.

  6. Voltage Level Mismatch: The input voltage from the external device may not be compatible with the Jetson’s input voltage requirements.

Troubleshooting Steps, Solutions & Fixes

  1. Verify GPIO Functionality:

    • Test basic GPIO input/output functionality to isolate the issue.
    • Connect an output pin to an input pin and verify correct readings.
  2. Check Pin Status:

    • Use the following command to check the status of specific pins:
      cat /sys/kernel/debug/gpio
      
    • Verify that the pins you’re using (e.g., pin 15 – PN.01 and pin 18 – PZ.06) are not in use by other processes.
  3. Configure Pins for PWM Input:

    • Use the Jetson IO tool to enable PWM on the desired pin:
      sudo /opt/nvidia/jetson-io/jetson-io.py
      
    • If this doesn’t resolve the issue, proceed to update the PINMUX spreadsheet.
  4. Update PINMUX Configuration:

    • Download the Jetson Orin NX and Orin Nano Series Pinmux Config Template.
    • Modify the spreadsheet to set the desired pin as PWM input.
    • Generate the .dtsi files from the spreadsheet.
    • Follow the NVIDIA documentation to flash the device with the custom PINMUX settings.
  5. Dynamic Pin Configuration:

    • For debugging, you can try changing pin configuration dynamically using the busybox devmem command.
    • Refer to the NVIDIA documentation for detailed instructions on modifying specific bit fields.
  6. Check for Conflicting Drivers:

    • Review the system logs and loaded modules to ensure no other drivers are interfering with the pin.
    • Use lsmod and dmesg commands to investigate loaded modules and kernel messages.
  7. Implement Custom PWM Reading Function:

    • Since the JETGPIO library lacks built-in PWM reading functionality, implement a custom function using GPIO interrupts and timers.
    • Example pseudo-code for PWM reading:
      volatile uint32_t rise_time = 0;
      volatile uint32_t fall_time = 0;
      volatile bool pulse_high = false;
      
      void pwm_isr(void) {
          uint32_t current_time = get_current_time_us();
          if (gpio_read(PWM_PIN) == HIGH) {
              rise_time = current_time;
              pulse_high = true;
          } else if (pulse_high) {
              fall_time = current_time;
              pulse_high = false;
              // Calculate pulse width and frequency here
          }
      }
      
      // In main function
      gpio_set_isr(PWM_PIN, CHANGE, pwm_isr);
      
  8. Voltage Level Adjustment:

    • If the input signal is too weak (300mV), consider using a logic level converter or voltage divider to match the Jetson’s input voltage requirements.
  9. Consult NVIDIA Developer Resources:

    • For advanced configuration and troubleshooting, refer to the Jetson Module Adaptation and Bring-Up guide.

If the issue persists after trying these solutions, consider reaching out to NVIDIA’s developer support or consulting the Jetson community forums for further assistance.

Similar Posts

Leave a Reply

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