nvidia xavier nx平台上精确时间协议(PTP)调试记录2
1. 前言
承接上一篇继续记录
https://www.ebaina.com/articles/140000012547
2. 参考xaiver平台精确同步时间方法
在启动时,Xavier时间已经与网络同步。
如果您不依赖于以太网模块,可以尝试以下步骤来精确同步
1. 使能 CONFIG_TEGRA_HTS_GTE=y
2. 修改个内核 dts
gte@c1e0000 {
status = “okay”;
}
3.在目标设备上运行GTE用户空间示例应用程序:
在这个示例应用程序中,我们每1秒切换40引脚头Pin 16 (gpio=256)并将信号馈送到Pin 32(gpio=257)。在内核源代码中:
4.找到 tegra-gte-ioctl.h
5.拷贝到 /usr/include/linux/
6.找到 tegra_gte_mon.c and compile gcc tegra_gte_mon.c -o gte_mon
7.运行
app, ./gte_mon -d gtechip0 -g 257 -r -f &
./gte_mon -h to print usage.
8.echo 256 >/sys/class/gpio/export
9.echo out >/sys/class/gpio/gpio256/direction
开始切换GPIO 256来观察事件。
10.
while true: do
echo 1 >/sys/class/gpio/gpio256/value
echo 0 >/sys/class/gpio/gpio256/value
sleep 1
done
//这应该打印下面的消息。
HW timestamp GPIO EVENT xxxx
11.echo 0 >/sys/class/gpio/gpio256/value
HW timestamp GPIO EVENT yyyy
12.To close the app, execute fg and ctrl+c
13.echo 256 >/sys/class/gpio/unexport to release GPIO 256
3.Nx平台GPIO模拟pps功能几个疑问
(1)NX设备上没有硬编码的PPS pin,NX GPIO的哪个引脚用于连接gps时间脉冲输出?
选择别针。
使用pinmux电子表格选择一个。
如果你使用的是NX devkit,选择一个出现在40引脚头部的gpio
例如,
如果想在头部使用GPIO01 (pin 29),查看电子表格,
将看到它是GPIO3_PQ.05。
(2)源代码如何构建内核来支持pps
必须从源代码编译内核才能使用它,因为它在默认情况下没有启用。
nvpps {
compatible = “nvidia,tegra194-nvpps”;
gpio = <&gpio TEGRA_GPIO(Q, 5) GPIO_ACTIVE_LOW>;
status = “okay”;
};
(3)在设备/dev/pps以某种方式创建后-如何使用它作为以太网网卡Linux PTP操作的输入?
pps {
gpios = <&tegra_aon_gpio TEGRA194_AON_GPIO(AA, 0) GPIO_ACTIVE_LOW>;
compatible = “pps-gpio”;
assert-falling-edge;
status = “okay”;
};
只需要启用“Tegra NVPPS支持”下的设备驱动程序
缺省情况下,ps-gpio已经启用。
4. 环境搭建如下
mkdir development
cd development
pwd
/mnt/development
wget https://developer.nvidia.com/embedded/L4T/r32_Release_v4.2/Sources/T186/public_sources.tbz2 2
tar -xjf public_sources.tbz2
cd Linux_for_Tegra/
cd source/
cd public/
tar -xjf kernel_src.tbz2
mkdir /mnt/outdir
TEGRA_KERNEL_OUT=/mnt/outdir
cd kernel/
cd kernel-4.9/
make ARCH=arm64 O=$TEGRA_KERNEL_OUT tegra_defconfig
报错如下
make -j8 ARCH=arm64 O=$TEGRA_KERNEL_OUT dtbs
make[1]: Entering directory '/mnt/outdir'
CHK scripts/mod/devicetable-offsets.h
DTC arch/arm64/boot/dts/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/hardware/nvidia/platform/t18x/quill/kernel-dts/tegra186-quill-p3310-1000-a00-00-base.dtb
DTC arch/arm64/boot/dts/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/hardware/nvidia/platform/t18x/quill/kernel-dts/tegra186-quill-p3310-1000-a00-00-ape-cam.dtb
DTC arch/arm64/boot/dts/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/hardware/nvidia/platform/t18x/quill/kernel-dts/tegra186-quill-p3310-1000-a00-00-edp.dtb
DTC arch/arm64/boot/dts/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/hardware/nvidia/platform/t18x/quill/kernel-dts/tegra186-quill-p3310-1000-a00-00-dsi-hdmi-dp.dtb
DTC arch/arm64/boot/dts/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/hardware/nvidia/platform/t18x/quill/kernel-dts/tegra186-quill-p3310-1000-c03-00-dsi-hdmi-dp.dtb
DTC arch/arm64/boot/dts/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/hardware/nvidia/platform/t18x/quill/kernel-dts/tegra186-quill-p3310-1000-a00-00-dsi-dp.dtb
DTC arch/arm64/boot/dts/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/hardware/nvidia/platform/t18x/quill/kernel-dts/tegra186-quill-hdmi-primary-p3310-1000-c03-00.dtb
DTC arch/arm64/boot/dts/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/hardware/nvidia/platform/t18x/quill/kernel-dts/tegra186-quill-hdmi-primary-p3310-1000-a00-00.dtb
DTC arch/arm64/boot/dts/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/hardware/nvidia/platform/t18x/quill/kernel-dts/tegra186-quill-p3310-1000-a00-00-base-mods-display.dtb
DTC arch/arm64/boot/dts/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/hardware/nvidia/platform/t18x/quill/kernel-dts/tegra186-quill-p3310-1000-a00-00-imx274.dtb
DTC arch/arm64/boot/dts/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/hardware/nvidia/platform/t18x/quill/kernel-dts/tegra186-quill-p3310-1000-a00-00-imx185_v1.dtb
DTC arch/arm64/boot/dts/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/hardware/nvidia/platform/t18x/quill/kernel-dts/tegra186-quill-p3310-1000-a00-00-lc898212.dtb
DTC arch/arm64/boot/dts/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/hardware/nvidia/platform/t18x/quill/kernel-dts/tegra186-quill-hdmi-primary-p3310-1000-a00-00-imx274.dtb
DTC arch/arm64/boot/dts/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/hardware/nvidia/platform/t18x/quill/kernel-dts/tegra186-quill-hdmi-primary-p3310-1000-c03-00-imx274.dtb
DTC arch/arm64/boot/dts/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/hardware/nvidia/platform/t18x/quill/kernel-dts/tegra186-quill-p3310-1000-c03-00-ape-cam.dtb
DTC arch/arm64/boot/dts/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/hardware/nvidia/platform/t18x/quill/kernel-dts/tegra186-quill-p3310-1000-c03-00-base.dtb
DTC arch/arm64/boot/dts/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/hardware/nvidia/platform/t18x/quill/kernel-dts/tegra186-quill-p3310-1000-c03-00-imx185_v1.dtb
DTC arch/arm64/boot/dts/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/hardware/nvidia/platform/t18x/quill/kernel-dts/tegra186-quill-p3310-1000-c03-00-dsi-dp.dtb
DTC arch/arm64/boot/dts/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/hardware/nvidia/platform/t18x/quill/kernel-dts/tegra186-quill-p3310-1000-c03-00-dsi-hdmi-hdmi.dtb
DTC arch/arm64/boot/dts/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/hardware/nvidia/platform/t18x/quill/kernel-dts/tegra186-quill-p3310-1000-c03-00-dsi-hdmi-hdmi-imx274-hdmiin.dtb
DTC arch/arm64/boot/dts/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/hardware/nvidia/platform/t18x/quill/kernel-dts/tegra186-quill-p3310-1000-c00-00-auo-1080p-edp.dtb
DTC arch/arm64/boot/dts/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/hardware/nvidia/platform/t18x/quill/kernel-dts/tegra186-quill-e3313-1000-a00-00-e2598.dtb
DTC arch/arm64/boot/dts/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/hardware/nvidia/platform/t18x/quill/kernel-dts/tegra186-quill-p3489-1000-a00-00-ucm1.dtb
DTC arch/arm64/boot/dts/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/hardware/nvidia/platform/t18x/quill/kernel-dts/tegra186-quill-p3489-1000-a00-00-ucm2.dtb
DTC arch/arm64/boot/dts/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/hardware/nvidia/platform/t18x/quill/kernel-dts/tegra186-quill-p3489-1000-a00-00-e2598.dtb
DTC arch/arm64/boot/dts/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/hardware/nvidia/platform/t18x/quill/kernel-dts/tegra186-quill-p3489-0888-a00-00-base.dtb
DTC arch/arm64/boot/dts/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/hardware/nvidia/platform/t18x/quill/kernel-dts/tegra186-quill-p3489-0888-a00-00-e2598.dtb
DTC arch/arm64/boot/dts/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/hardware/nvidia/platform/t18x/quill/kernel-dts/tegra186-quill-p3310-1000-as-0888.dtb
DTC arch/arm64/boot/dts/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/hardware/nvidia/platform/t19x/jakku/kernel-dts/tegra194-p3668-all-p3509-0000.dtb
DTC arch/arm64/boot/dts/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/hardware/nvidia/platform/t19x/galen/kernel-dts/tegra194-p2888-0001-p2822-0000.dtb
DTC arch/arm64/boot/dts/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/hardware/nvidia/platform/t19x/galen/kernel-dts/tegra194-p2888-0001-p2822-0000-imx274-hdmi.dtb
DTC arch/arm64/boot/dts/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/hardware/nvidia/platform/t19x/galen/kernel-dts/tegra194-p2888-0001-p2822-0000-imx185_v1.dtb
Error: /mnt/developoment/Linux_for_Tegra/source/public/kernel/kernel-4.9/arch/arm64/boot/dts/../../../../../../hardware/nvidia/platform/t19x/jakku/kernel-dts/tegra194-p3668-all-p3509-0000.dts:27.19-20 syntax error
FATAL ERROR: Unable to parse input tree
/mnt/developoment/Linux_for_Tegra/source/public/kernel/kernel-4.9/arch/arm64/boot/dts/Makefile:120: recipe for target 'arch/arm64/boot/dts/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/hardware/nvidia/platform/t19x/jakku/kernel-dts/tegra194-p3668-all-p3509-0000.dtb' failed
make[2]: *** [arch/arm64/boot/dts/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/hardware/nvidia/platform/t19x/jakku/kernel-dts/tegra194-p3668-all-p3509-0000.dtb] Error 1
make[2]: *** Waiting for unfinished jobs....
arch/arm64/Makefile:154: recipe for target 'dtbs' failed
make[1]: *** [dtbs] Error 2
make[1]: Leaving directory '/mnt/outdir'
Makefile:171: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2
修改dts:
hardware/nvidia/platform/t19x/jakku/kernel-dts/tegra194-p3668-all-p3509-0000.dts
还有其他方法可以在设备树中启用gpio,包括创建自己的覆盖层,但有点复杂
在tegra194-p3668-all-p3509-0000.dts,可以从上面添加适当的样本…
/ {
nvidia,dtsfilename = __FILE__;
nvidia,dtbbuildtime = __DATE__, __TIME__;
compatible = "nvidia,p3449-0000+p3668-0000", "nvidia,p3449-0000+p3668-0001", "nvidia,p3509-0000+p3668-0000", "nvidia,p3509-0000+p3668-0001", "nvidia,tegra194";
nvpps {
compatible = “nvidia,tegra194-nvpps”;
gpio = <&gpio TEGRA_GPIO(Q, 5) GPIO_ACTIVE_LOW>;
status = “okay”;
};
};
编译通过
5. 如何转换代码和传递更改到动态dtb
sudo fdtput -t i /boot/tegra194-p3668-all-p3509-0000.dtb nvpps compatible nvidia,tegra194-nvpps gpio &gpio TEGRA_GPIO(Q, 5) GPIO_ACTIVE_LOW status okay
创建dtb覆盖层的问题是,必须自己转换TEGRA_GPIO宏,因为它通常由内核构建dtb生成过程解析。要转换它,请查看kernel-4.9/include/dt-bindings/gpio/tegra-gpio.h。
找到与GPIO字母相关联的数字,在本例中Q为16,将其乘以8,然后将GPIO数字相加,得到133。现在您需要将GPIO_ACTIVE_LOW替换为“1”。
gpio = <&gpio 133 1>;
所以现在一个覆盖的源文件应该是这样的…
/dts-v1/;
/plugin/;
/ {
overlay-name = "PPS Overlay";
compatible = "nvidia,p3509-0000+p3668-0000";
fragment@pps {
target-path = "/";
__overlay__ {
pps {
gpio = <&gpio 133 1>;
compatible = “pps-gpio”;
assert-falling-edge;
status = “okay”;
};
};
};
};
- 分享
- 举报
-
浏览量:7481次2021-05-20 17:08:14
-
浏览量:9218次2021-05-19 17:32:00
-
浏览量:7905次2021-05-25 15:32:16
-
浏览量:9388次2021-05-25 17:31:40
-
浏览量:7417次2021-05-11 17:51:48
-
浏览量:10848次2021-05-06 16:22:01
-
浏览量:8583次2021-05-14 14:43:43
-
浏览量:9456次2021-05-26 14:17:15
-
浏览量:9407次2021-04-27 17:56:41
-
浏览量:7445次2021-06-09 14:29:23
-
2021-05-06 16:03:00
-
浏览量:9360次2021-07-21 16:55:40
-
浏览量:6452次2021-04-21 17:42:58
-
浏览量:5249次2021-05-10 17:48:42
-
浏览量:7087次2021-05-11 17:04:57
-
浏览量:5289次2021-07-09 15:20:08
-
2021-04-23 15:54:21
-
2021-07-30 17:20:54
-
2021-01-16 14:38:27
-
178篇
- 化身视频UP主!ShadowPlay和Fraps谁更适合?
- 准备接招吧!你必须知道的《魔兽世界•德拉诺之王》
- 初创加速 | NVIDIA GPU加速AI智能数据处理,助力数字化医、药、险联动
- Nfan的盛大节日!2014英伟达游戏群英汇正式开幕!
- nvidia xavier nx平台使用system.img编写分区APP出错调试
- AI 艺术画廊 —— 用 AI 诠释艺术与音乐 十一
- 游戏、奖品爽翻天!NGF 2014最后一轮招募开始!
- 游戏性能激增!NVIDIA全新GeForce 337.50版本驱动发布
- VR解剖“历险记”:NVIDIA CloudXR 和 5G 赋力大学科学可视化
- 15年,提名奥斯卡视觉特效的电影皆由NVIDIA的技术所呈现
-
广告/SPAM
-
恶意灌水
-
违规内容
-
文不对题
-
重复发帖
free-jdx
感谢您的打赏,如若您也想被打赏,可前往 发表专栏 哦~
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明