技术专栏
xavier nx平台调试spi从模式2
1. 前言
承接上篇调试记录
https://www.ebaina.com/articles/140000012611
2. 修改如下
硬件连接:
SPI1_MOSI<-->SPI3_MISO,
SPI1_CLK<-->SPI3_CLK,
SP1_CS0 <--> SPI3_CS0
SPI1_CS1->SPI3_CS1.
设备树:
SPI1 has to be configured as Master and SPI3 has to be configured as slave in the dt and pinmux settings have to be updated.
SPI1 DT:
spi@3210000 {
status = "okay";
compatible = "nvidia,tegra186-spi";
spi@0 {
compatible = "spidev";
reg = <0>;
spi-max-frequency = <65000000>;
controller-data {
nvidia,enable-hw-based-cs;
};
};
};
SPI3 DT
spi@3230000 {
status = "okay";
compatible = "nvidia,tegra186-spi-slave";
spi@0 {
compatible = "spidev";
reg = <0>;
spi-max-frequency = <65000000>;
controller-data {
nvidia,enable-hw-based-cs;
};
};
};
PINMUX settings are listed below for SPI1 and SP13 for loopback.
(Note: SPI1 and SP3 have an internal loopback connection for Xavier)
pinmux:
SPI_1 pinmux settings:
PADCTL_UART_SPI1_MISO_0 (0x0243d020) = 0x440;
PADCTL_UART_SPI1_MOSI_0 (0x0243d058) = 0x440;
PADCTL_UART_SPI1_SCK_0 (0x0243d040) = 0x440;
PADCTL_UART_SPI1_CS0_0 (0x0243d010) = 0x448;
PADCTL_UART_SPI1_CS1_0 (0x0243d050) = 0x448;
SPI_3 pinmux settings:
PADCTL_UART_SPI3_MISO_0 (0x0243d008) = 0x440;
PADCTL_UART_SPI3_MOSI_0 (0x0243d060) = 0x440;
PADCTL_UART_SPI3_SCK_0 (0x0243d048) = 0x444;
PADCTL_UART_SPI3_CS0_0 (0x0243d018) = 0x448;
PADCTL_UART_SPI3_CS1_0 (0x0243d028) = 0x448;
3. 更新dtb方式
(1)反编译更新
这种方式无需搭建SDK环境,比较便捷
(1)在/opt/nvidia/jetson-io/jetson-io.py目录下激活spi1、spi3
(2) dtb反编译
sudo dtc -I dtb -O dts -o ~/ user-custom.dts / boot / tegra194-p3668-all- p3509-0000-user-custom.dtb
(3)打开~/ user-custom.dts 并将spi3(spi@3230000)更改为slave
(4) dts编译
→sudo dtc - i dts -o dtb -o /boot/tegra194-p3668-all- p3509-0000-user-custom.dts
(5)重新启动jetson
(6)使用devmem2 (temporary)修改reg值
(7)连接:
SPI1_MOSI<–>SPI3_MISO, SPI1_CLK<–>SPI3_CLK, SP1_CS0 <–> SPI3_CS0 and SPI1_CS1<–>SPI3_CS1
(8)测试
(2)依赖SDK编译dts刷机更新dtb
(1) Jetson_Xavier_NX_Pinmux_Configuration_Template_v1.06使用.xlsm设置pinmux并创建DT
(tegra19x-jetson_xavier_nx_module-gpio-default。dtsi tegra19x-jetson_xavier_nx_module-padvoltage-default。dtsi tegra19x-jetson_xavier_nx_module-pinmux.dtsi)
(2)在Linux主机PC上通过SDK Manager安装Linux_for_Tegra
3)进入“/Linux_for_Tegra/kernel/pinmux/t19x”目录
(4)导入dtsi
(tegra19x-jetson_xavier_nx_module-gpio-default.dtsi,
tegra19x-jetson_xavier_nx_module-padvoltage-default.dtsi,
tegra19x-jetson_xavier_nx_module-pinmux.dtsi)
文件拷贝到Linux主机PC上,生成cfg文件。
;Python pinmux-dts2cfg.py
pinmux addr_info.txtdtsi
gpio_addr_info.txt
por_val.txt
tegra19x-jetson_xavier_nx_module-pinmux.dtsi
tegra19x-jetson_xavier_nx_module-gpio-default.dtsi 1.0>galen.cfg
(5)修改“galen.cfg”为“/Linux_for_Tegra/bootloader/t186ref/BCT/tegra19x-mb1-pinmux-p3668-a01”
(6) Flash with sdk manager(或sudo ./ Flash .sh jetson-xavier-nx-devkit mmcblk0p1 .
3. 调试记录
(1)运行出错
先运行从服务器,然后再运行主服务器,
但是当我运行从服务器(/dev/spidev2.0)时,我得到一个错误。
can’t send spi message: Invalid argument
Aborted (core dumped)
<<<<< dmesg >>>>>>
spi-tegra124-slave 3230000.spi: Tx is not supported in mode 0
spi-tegra124-slave 3230000.spi: spi can not start transfer, err -22
spi_master spi2: failed to transfer one message from queue
(2)继续修改SDK文件
a. Modify dt to slave
/boot/tegra194-p3668-all-p3509-0000-user-custom.dtb
b. 修改pin配置表
c. 硬件连接
SPI1 MOSI (pin 19) <-> SPI3 MOSI (pin 37),
SPI1 MISO (pin 21) <-> SPI3 MISO (pin 22),
SPI1 SCK (pin 23) <-> SPI3 SCK (pin 13),
SPI1 CS0 (pin 24) <-> SPI3 CS0 (pin 18),
SPI1 CS1 (pin 26) <-> SPI3 CS1 (pin 16)
仍然得到从模式的错误
声明:本文内容由易百纳平台入驻作者撰写,文章观点仅代表作者本人,不代表易百纳立场。如有内容侵权或者其他问题,请联系本站进行删除。
红包
84
6
评论
打赏
- 分享
- 举报
评论
0个
手气红包
暂无数据
相关专栏
-
浏览量:10205次2021-06-08 17:32:00
-
浏览量:7868次2021-06-09 14:49:23
-
浏览量:7417次2021-05-11 17:51:48
-
浏览量:10848次2021-05-06 16:22:01
-
浏览量:5289次2021-07-09 15:20:08
-
浏览量:7084次2021-05-20 16:37:42
-
浏览量:8583次2021-05-14 14:43:43
-
浏览量:7940次2021-06-04 16:25:58
-
浏览量:9456次2021-05-26 14:17:15
-
浏览量:9407次2021-04-27 17:56:41
-
2021-05-06 16:03:00
-
浏览量:5980次2021-06-03 17:33:36
-
浏览量:5249次2021-05-10 17:48:42
-
浏览量:6225次2021-07-09 15:17:28
-
浏览量:7087次2021-05-11 17:04:57
-
浏览量:5201次2021-07-09 15:23:33
-
浏览量:6277次2021-06-11 11:34:24
-
浏览量:7481次2021-05-20 17:08:14
-
浏览量:9218次2021-05-19 17:32:00
置顶时间设置
结束时间
删除原因
-
广告/SPAM
-
恶意灌水
-
违规内容
-
文不对题
-
重复发帖
打赏作者
free-jdx
您的支持将鼓励我继续创作!
打赏金额:
¥1
¥5
¥10
¥50
¥100
支付方式:
微信支付
打赏成功!
感谢您的打赏,如若您也想被打赏,可前往 发表专栏 哦~
举报反馈
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明
审核成功
发布时间设置
发布时间:
请选择发布时间设置
是否关联周任务-专栏模块
审核失败
失败原因
请选择失败原因
备注
请输入备注