Xavier stepping on the pit-GPIO as external trigger

Getting started with Xavier

PWM problem

Due to the need to synchronize the trigger of the external sensor, a square wave is needed. Consider using Xavier's PWM. As a result, after a long period of tossing, I found that the internal hardware needs to be configured. I want to refer to other blogs if I want to toss myself, mainly searching for pinmux.

Solution

1. Refer to pinmux related tutorials to configure Xavier hardware.
2. Use GPIO high and low level flip to achieve square wave. Since my external synchronization trigger requirements are not so strict, I use this method directly.
The specific code is as follows:

import Jetson.GPIO as GPIO
import time
import datetime

PWM_PIN = 29

if __name__ == '__main__':
    GPIO.setwarnings(False)
    GPIO.cleanup() 
    GPIO.setmode(GPIO.BOARD)
    GPIO.setup(PWM_PIN, GPIO.OUT, initial=GPIO.LOW)

    curr_value = GPIO.LOW
    try:
        while True:
            GPIO.output(PWM_PIN, curr_value)
            curr_value ^= GPIO.HIGH
            print(curr_value)
            #提醒一下此处的sleep,尽量用小数,别用分数
            time.sleep(0.05)   #10HZ
    finally:
        GPIO.cleanup()

GPIO problem

It is easy to write simple PWM square wave output with GPIO. But when the camera was triggered externally, it was found that it could not be triggered. Because the pins I used at the beginning were all 12 13 15 18 introduced in the blog, but it happened that these IO ports had pull-down resistors in the board, which caused the output to fail to drive the external trigger of the camera. (PS: Because of this problem, I moved out the signal generator, oscilloscope, and logic analyzer. In the end, I felt that the driving ability was insufficient. I planned to connect an external pull-up resistor or amplifier circuit. When I finally struggled to find the information, I found the following solution)

Solution

After a series of searching information, it was found that pin 29 has a 100K pull-up resistor inside. Changing the pin to No. 29 directly solves the problem.

Guess you like

Origin blog.csdn.net/qq_38337524/article/details/114904429