RM500U /dev/stty_nr31串口节点打开失败

串口打开log

root@ImmortalWrt:/# microcom -s 115200 /dev/stty_nr31
[  524.757880] spipe 1-6 not ready to open!
microcom: can't open '/dev/stty_nr31': No such device
root@ImmortalWrt:/#

pci查询设备

root@ImmortalWrt:/# lspci
00:00.0 Class 0604: 14c3:1f32
00:00.0 Class 0002: 14c3:7986
01:00.0 Class 0d80: 16c3:abcd
root@ImmortalWrt:/#

完整的kernel log
MobaXterm_COM5USB-SERIALCH340COM5_20250207_120205.txt (146.2 KB)

[    9.660593] sprd-pcie-ep-device 0001:01:00.0: pci alloc msi irq cnt = 32
[    9.667286] sprd-pcie-ep-device 0001:01:00.0: ep: BAR[0] [mem 0x20000000-0x23ffffff pref]
[    9.675450] sprd-pcie-ep-device 0001:01:00.0: ep: BAR[1] [mem 0x26100000-0x2610ffff]
[    9.683180] sprd-pcie-ep-device 0001:01:00.0: ep: BAR[2] [mem 0x24000000-0x25ffffff pref]
[    9.691346] sprd-pcie-ep-device 0001:01:00.0: ep: BAR[3] [mem 0x26110000-0x2611ffff]
[    9.699077] sprd-pcie-ep-device 0001:01:00.0: ep: BAR[4] [mem 0x26000000-0x260fffff]
[    9.706807] sprd-pcie-ep-device 0001:01:00.0: ep: BAR[5] [mem 0x26120000-0x2612ffff]
[    9.714557] sprd-pcie-ep-device 0001:01:00.0: ep: atu_view_port val = 0xffffffff
[    9.721941] sprd-pcie-ep-device 0001:01:00.0: ep: request IRQ = 135, cnt =32

这里第二次中断申请失败要查下。

  1. 这个驱动的Makefile 里打开了哪些配置?
  2. 这个模块有些坑,有条件还是要查询下AT+QCFG=“pcie/mode”
    因为就算在RC模式也能用lspci 看到。

1.Make file内容如下

#
# Makefile for the sprd staging modem files
#
EXTRA_CFLAGS += -Wno-error -Wno-packed-bitfield-compat -Wno-unused-result -Wno-format
ccflags-y += -DCONFIG_SPRD_PCIE_EP_DEVICE
ccflags-y += -DCONFIG_SPRD_SIPA


########## Option feature ##########
# For NSS feature of some Qualcom platform(eg.ipq5018)
#ccflags-y += -DCONFIG_QCA_NSS_DRV

# define is normal mode, net dev type is ethernet;
# undefine is direct mode, net dev type is rawip, should set module to direct by
# using AT command[AT+QCFG="pcie/direct",1];
ccflags-y += -DCONFIG_SPRD_ETHERNET

# For pcie msi type interrupt
ccflags-y += -DCONFIG_PCI_IRQ_MSI

# For big endian platform
#ccflags-y += -DCONFIG_SIPC_BIG_TO_LITTLE


obj-m += sprd_pcie.o
sprd_pcie-objs := pcie/sprd_pcie_ep_device.o pcie/pcie_host_resource.o pcie/sprd_pcie_quirks.o sipc/sipc.o sipc/sblock.o sipc/sbuf.o \
                  sipc/sipc_debugfs.o sipc/smem.o sipc/smsg.o sipc/spipe.o sipc/spool.o power_manager/power_manager.o \
                  sipa/sipa_core.o sipa/sipa_eth.o sipa/sipa_nic.o sipa/sipa_skb_send.o sipa/sipa_skb_recv.o sipa/sipa_dummy.o  sipa/sipa_debugfs.o sipa/sipa_dele_cmn.o \
                  sipa/sipa_phy_v0/sipa_fifo_irq_hal.o sipa/sipa_phy_v0/sipa_common_fifo_hal.o

PWD := $(shell pwd)
ifeq ($(ARCH),)
ARCH := $(shell uname -m)
endif
ifeq ($(CROSS_COMPILE),)
CROSS_COMPILE :=
endif
ifeq ($(KDIR),)
KDIR := /lib/modules/$(shell uname -r)/build
endif

sprd_pcie: clean
        $(MAKE) ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} -C $(KDIR) M=$(PWD) modules

clean:
        $(MAKE) ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} -C $(KDIR) M=$(PWD) clean
        find . -name *.o.ur-safe | xargs rm -f

install: sprd_pcie
        sudo cp sprd_pcie.ko /lib/modules/${shell uname -r}/kernel/drivers/pci/
        sudo depmod

2.已经切换成EP模式了

AT+QCFG="pcie/mode"
+QCFG: "pcie/mode",0

OK

这个也注释掉。这个驱动一般不能编译成内核模块,一般要built-in.

ccflags-y += -DCONFIG_PCI_IRQ_MSI如果注释掉,中断请求就没有了,lspci命令就找到不到模块ID了,

                        --- PCI support                                                                                 │ │
  │ │                         [ ]   PCI Express Port Bus support                                                              │ │
  │ │                         -*-   Message Signaled Interrupts (MSI and MSI-X)                                               │ │
  │ │                         [*]   Enable PCI quirk workarounds                                                              │ │
  │ │                         [ ]   PCI Debugging                                                                             │ │
  │ │                         < >   PCI Stub driver                                                                           │ │
  │ │                         [ ]   PCI disable common quirks                                                                 │ │
  │ │                         [ ]   PCI IOV support                                                                           │ │
  │ │                         [ ]   PCI PRI support                                                                           │ │
  │ │                         [ ]   PCI PASID support                                                                         │ │
  │ │                         [ ]   Support for PCI Hotplug  ----                                                             │ │
  │ │                               PCI controller drivers  --->                                                              │ │
  │ │                               PCI Endpoint  --->                                                                        │ │
  │ │                               PCI switch controller drivers  --->                                                       │ │

ap端pci配置如上

已经编译成built-in

已上传完整log
kernel_log_没有注释DCONFIG_PCI_IRQ_MS.txt (296.7 KB)
kernel_log_注释DCONFIG_PCI_IRQ_MS.txt (289.8 KB)

我看上面的那份log 没有报错了。
看看打开/dev/stty_nr31 有什么报错和内核的打印。
看看中断 cat /proc/interrupts

回复晚了,现在可以打开串口了
重新上传一下log
注释Makefile CONFIG_PCI_IRQ_MSI

kernel配置

                                         --- PCI support                                                                                                 │ │
  │ │                                          [*]   PCI Express Port Bus support                                                                              │ │
  │ │                                          [ ]     PCI Express Advanced Error Reporting support                                                            │ │
  │ │                                          [ ]     PCI Express ASPM control                                                                                │ │
  │ │                                          [ ]     PCI Express Precision Time Measurement support                                                          │ │
  │ │                                          [ ]     PCI Express Bandwidth Change Notification                                                               │ │
  │ │                                          -*-   Message Signaled Interrupts (MSI and MSI-X)                                                               │ │
  │ │                                          [*]   Enable PCI quirk workarounds                                                                              │ │
  │ │                                          [*]   PCI Debugging                                                                                             │ │
  │ │                                          < >   PCI Stub driver                                                                                           │ │
  │ │                                          [ ]   PCI disable common quirks                                                                                 │ │
  │ │                                          [ ]   PCI IOV support                                                                                           │ │
  │ │                                          [ ]   PCI PRI support                                                                                           │ │
  │ │                                          [ ]   PCI PASID support                                                                                         │ │
  │ │                                          [ ]   Support for PCI Hotplug  ----                                                                             │ │
  │ │                                                PCI controller drivers  --->                                                                              │ │
  │ │                                                PCI Endpoint  --->                                                                                        │ │
  │ │                                                PCI switch controller drivers  --->                             
[kernel_log_注释DCONFIG_PCI_IRQ_MS_20250217_184703.txt|attachment](upload://m3ShajbZjckkI6QB0l11MN25GUF.txt) (148.5 KB)

打开stty_nr31

root@ImmortalWrt:/# microcom -s 115200 /dev/stty_nr31

+CPIN: NOT INSERTED

+CFUN: 1
ATI
Quectel
RM500U-CN
Revision: RM500UCNCBR03A03M2G

OK

查看中断

root@ImmortalWrt:/# cat proc/interrupts
           CPU0       CPU1       CPU2       CPU3
  3:      53692      15923      16406      11116     GICv3  30 Level     arch_timer
  6:        701          0          0      30724     GICv3 237 Level     0000:00:00.0
  8:        600          0          0          0     GICv3 243 Level     ccif_wo_isr
 10:          0          0          0          0     GICv3 142 Level     wdt_bark
 12:        193          0          0          0     GICv3 155 Level     ttyS0
 15:          0          0          0          0     GICv3 168 Level     i2c-mt65xx
 18:          0          0          0          0     GICv3 148 Level     10320000.crypto
 19:          0          0          0          0     GICv3 149 Level     10320000.crypto
 20:          0          0          0          0     GICv3 150 Level     10320000.crypto
 21:          0          0          0          0     GICv3 151 Level     10320000.crypto
125:         10        317          0          0     GICv3 229 Level     15100000.ethernet
126:        634          0          0          0     GICv3 230 Level     15100000.ethernet
127:          0          0          0          0     GICv3 231 Level     15100000.ethernet
132:       2579          0          0          0     GICv3 175 Level     11230000.mmc
133:          0          0          0          0     GICv3 205 Level     xhci-hcd:usb1
135:        102          0          0          0      INTx   0 Edge    -INTx      sprd-pcie-ep-device
136:          0          0          0          0       MSI 134217728 Edge      PCIe PME
IPI0:      5972      11440       6094       8257       Rescheduling interrupts
IPI1:       241        692        496        593       Function call interrupts
IPI2:         0          0          0          0       CPU stop interrupts
IPI3:         0          0          0          0       CPU stop (for crash dump) interrupts
IPI4:         0          0          0          0       Timer broadcast interrupts
IPI5:         5          0          0          2       IRQ work interrupts
IPI6:         0          0          0          0       CPU wake-up interrupts
Err:          0
1 个赞

好的。理论上MSI和INTx都可以,不过好多客户使用MSI都没成功。
可以试下网卡和上网的功能。