如何在jetson tx2 nx上正确使用sc16is752通过spi实现串口扩展

我现在在jetson tx2 nx(jetpack 4.6.4)上使用sc16is752通过spi进行串口扩展,现在遇到了一些问题:
1.我已经通过jetson-io打开了spi0的功能,并通过modprobe spidev, 在/dev下看到了spidev0.0\spidev0.1
2.我下载了spidev-test工具,使用./spidev_test -D /dev/spidev0.1 -v -p "\x88\x55\x55"命令进行测试,此时我用示波器测量sck(pin23)时,并未得到有效的波形变化,此时正常时应该会有一段持续的波形变化的,我认为是哪里配置不正确,是否需要根据pinmux spreadsheet配置spi相应管脚的状态?我的pinmux的配置如下:
spi0_mosi output pd
spi0_miso input pd
spi0_sck output pd
spi0_cs0 output pu
irq(pin7) input pu
3.我按照2中描述的pinmux进行了配置,生成了cfg文件进行替换,同时我完成了设备树的信息修改(加入了sc16is752的对应信息),然后采用flash.sh完成了刷机。并在jetpack 4.6.4中对应了source中找到了sc16is7xx.c文件在新刷系统的jetson平台上进行了编译驱动,加载sc167xx驱动后,成功在/dev下看到了ttySC0/ttySC1,但是使用cutecom测试时,出现了chip reports 255 free bytes in TX fifo, but in only has 64错误。设备树配置如下:
image

期待您的回复!谢谢

Hi 478723668,

Are you using the devkit or custom board for TX2 NX?

Please confirm the function is configured as spi rather than rsvd.

Could you also share the full dmesg for further check?

Thank you for your reply.
I am using a custom board.How can I confirm this(Please confirm the function is configured as spi rather than rsvd.)?

Here is dmesg.log
dmesg.log.txt (161.4 KB)
Firstly, I believe it is necessary to confirm that the SPI function is normal. I short circuited Miso and Mosi (spi0), but when using Spidev_test, I did not receive the transmitted data. At the same time, when using an oscilloscope to measure CS0 and SCK, there were no waveforms.

New Work:
I have verified the normal function of the SPI and measured the effective waveform using an oscilloscope. But I still got an error like this: chip reports 255 free bytes in TX fifo, but only has 64. The latest dmesg is as follows:
dmesg.log (64.8 KB)

Do you mean SPI loopback test withspidev_test works as expected?

Do you hit this issue after you port the driver for sc16is752?

[    0.965685] spi_master spi0: /spi@3210000/sc16is752_clk2 has no valid 'reg' property (-22)
[    0.973987] spi_master spi0: Failed to create SPI device for /spi@3210000/sc16is752_clk2

It seems reg property missing in device tree for your driver.

Yes, I ran spiev_test and got the correct result.

Yes, I encountered an issue after loading the sc16is7xx driver. I have compiled the kernel source code, added the compilation option for sc16is7xx in tegerdefconfig, and then re flashed. The new image should automatically load the driver for sc16is7xx. I encountered this issue when testing with cutecom.

Is this error message necessary to handle? Based on the device tree image I posted, I believe that /spi@3210000 /sc16is752_clk2 only refers to a clock information. Is my idea correct? I would like to confirm if the settings for sc16is752 on spi0 in my device tree file are correct?

Yes, I think you should fix this error message first.
So, it seems something missing in your clock configuration.
Please also ask the help from your vendor, they may better knows that how it works.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.