16002.Jetson orin/nano平台gpio配置记录

1 查看当前系统gpio配置信息

sudo cat /sys/kernel/debug/gpio

在这里插入图片描述

2 orin / nano gpio

2.1 GPIO 映射表

orin 平台提供了一个 xls 表,可通过它生成dtb 设备树,同样可以看到管脚的定义:

Jetson_Orin_NX_and_Orin_Nano_series_Pinmux_Config_Template.xlsm

在这里插入图片描述在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

2.2 nano 平台对外提供的2排端口表

https://jetsonhacks.com/nvidia-jetson-orin-nano-gpio-header-pinout/
在这里插入图片描述
在这里插入图片描述

3 配置GPIO 电平

3.1 通过指令配置普通GPIO高电平

  • 配置gpio 9为高电平
nano@orin-nano:/sys/class/gpio$ sudo -s
[sudo] password for nano: 
root@orin-nano:/sys/class/gpio# echo 492 > /sys/class/gpio/export    
root@orin-nano:/sys/class/gpio# ls
export  gpiochip316  gpiochip348  PAC.06  unexport
root@orin-nano:/sys/class/gpio/PAC.06# echo out > direction 
root@orin-nano:/sys/class/gpio/PAC.06# echo 1 > value
root@orin-nano:/sys/class/gpio/PAC.06# 
  • cat /sys/kernel/debug/gpio
    在这里插入图片描述

3.2 通过设备树配置普通GPIO高电平

在这里插入图片描述

3.3 配置特定 gpio 高电平 GPIO_AON

  • AON 特定管脚,使用的宏, GPIO6 代表的就是 CC , 3
/*
 * Copyright (c) 2021-2023, Fangzhu Tech Corp. All rights reserved.
 * Copyright (c) 2021-2023, NVIDIA CORPORATION.  All rights reserved.

 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#include <t234-common-modules/tegra234-camera-imx459-a00.dtsi>
#include "dt-bindings/clock/tegra234-clock.h"

#define CAM0_PWDN	TEGRA234_MAIN_GPIO(H, 6)  //Pin93 --- UART4_CTS L49/397 - MAX9296_1 PWDN
#define CAM1_PWDN	TEGRA234_MAIN_GPIO(H, 3)  //Pin95 --- UART4_TX L5/394 - MAX9296_2 PWDN
#define CAM2_PWDN	TEGRA234_MAIN_GPIO(AC, 0) //Pin90 --- GPIO15 F10/486 - MAX9296_3 PWDN
#define CAM3_PWDN	TEGRA234_MAIN_GPIO(AC, 1) //Pin92 --- GPIO16 E9/487 - MAX9296_4 PWDN
#define CAM_I2C_MUX 	TEGRA234_AON_GPIO(CC, 3)   //配置GPIO6  为高电平
#define GPIO_09  	TEGRA234_MAIN_GPIO(AC, 6) //GPIO09 

#define CAMERA_I2C_MUX_BUS(x) (0x1E + x)

/* camera control gpio definitions */

/ {
	gpio@2200000 {
		cam-pwdn-high {
			gpio-hog;
			output-high;
			gpios = <CAM0_PWDN 0 CAM1_PWDN 0
				 CAM2_PWDN 0 CAM3_PWDN 0>;
			label = "cam0-pwdn", "cam1-pwdn",
				"cam2-pwdn", "cam3-pwdn";
		};
	};

	gpio@c2f0000{
		cam-i2cmux-high{
			gpio-hog;
			output-high;
			gpios = <CAM_I2C_MUX 0>;
			label = "cam-i2c-mux";
		};
	};
	
	i2c@3180000 {		
		imx459_1a@1a {
			/* Define any required hw resources needed by driver */
			/* ie. clocks, io pins, power sources */
			clocks = <&bpmp_clks TEGRA234_CLK_EXTPERIPH1>,
					<&bpmp_clks TEGRA234_CLK_EXTPERIPH1>;
			clock-names = "extperiph1", "pllp_grtba";
			mclk = "extperiph1";
			channel = <0>;
		};
		imx459_1b@1b {
			/* Define any required hw resources needed by driver */
			/* ie. clocks, io pins, power sources */
			clocks = <&bpmp_clks TEGRA234_CLK_EXTPERIPH1>,
					<&bpmp_clks TEGRA234_CLK_EXTPERIPH1>;
			clock-names = "extperiph1", "pllp_grtba";
			mclk = "extperiph1";
			channel = <1>;
		};
	};
	
};

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

guangshui516

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值