14 Star 23 Fork 22

Phytium嵌入式软件 / Phytium-FreeRTOS-SDK

 / 详情

我用pcie cherryusb检测不到设备拔出

开发中
需求
创建于  
2024-03-05 13:37

该问题是怎么引起的?

使用cherryusb插入设备之后初始化成功 设备拔出检测不到设备拔出

重现步骤

报错信息

评论 (4)

Yeon 创建了缺陷
huanghe 任务状态待办的 修改为已确认
huanghe 负责人设置为zhugengyu
展开全部操作日志

您好,请问可以提供更多的测试信息吗,比如 开发板型号,PCIe 卡型号,USB 设备信息,打印日志等,谢谢,可以参考下面的步骤再测试一下

  1. 看能不能在 E2000 平台设备上尝试复现一下问题,我们测试平台设备是可以插拔的
  2. 可以参考下例程说明 https://gitee.com/phytium_embedded/phytium-free-rtos-sdk/blob/master/example/peripheral/usb/xhci_pcie/README.md,目前有些情况下协议栈是没有支持好的
  3. 在 usb_config.h 里修改日志级别 CONFIG_USB_DBG_LEVEL 为 USB_DBG_LOG,尽量把运行日志收集一下
  4. 我们 freertos 里移植的第三方协议栈 cherryusb ,插拔部分的实现是开源框架提供的,可以参考下 https://github.com/cherry-embedded/CherryUSB 的说明,有条件的话,可以对照验证一下

拔出usb之后 能检测到PORTSC 寄存器中CSC 和CCS 变化 但是没有产生对应的trb,目前用的是S2500 pcie卡型号8748 usb设备是鼠标
<usbh_initialize :824> usbh_class_info_table_begin:0xfffffff40012de00 usbh_class_info_table_end:0xfffffff40012de30
<usb_hc_malloc :407> malloc pa:0xcffea000 va:0xfffffff40ffea000 size:4096

<usb_hc_malloc :407> malloc pa:0xcffe8000 va:0xfffffff40ffe8000 size:4096

<usb_hc_malloc :407> malloc pa:0xcffe4000 va:0xfffffff40ffe4000 size:12288

<usb_hc_malloc :407> malloc pa:0xcffdd000 va:0xfffffff40ffdd000 size:24576

<usbh_initialize :845> &(usb->list):0xfffffff400630488 usb_buses:0xfffffff400630d30 usb_buses.next :0xfffffff400630488 usb->id:0
<usbh_initialize :848> bus:0xfffffff400630488
<usbh_hub_initialize :717> bus:0xfffffff400630488
<pcie_xhci_init :299> regs:65c00000
<pcie_xhci_init :302> bar0:65c00000,fffffff415c00000
<pcie_xhci_init :306> bar0size:0x1
<pcie_xhci_init :314> PCI PM version V3
<pcie_xhci_init :317> PCI PM CTRL NO SOFT RESET
<pcie_xhci_init :321> PME# supported from D0 D1 D2 D3hot D3cold

vecAddr 0x0 Val 0x0
<pcie_xhci_init :334> vecAddr:0x0 vecVal:0 index:0
vxbPciIntrExclusiveEnable - enable MSI/MSI-X
<pcie_xhci_init :345> vecAddr:0x2a030040 vecVal:0 index:0

<usb_hc_init :89> bus:0xfffffff400630488 id:0 xhci:0xfffffff400630d38 xhci->bus:0xfffffff400630488
<xhci_probe :544> [xhci_probe 544]

<xhci_init :147> XHCI 0 version 110 cap 65c00000 op 65c00080 run 65c01000 db 65c03000

<xhci_init :161> XHCI 0 has 16 slots 1 intrs 2 ports

<xhci_init :167> XHCI 0 needs 0 scratchpads hcsparams2:0x5a

<xhci_init :175> XHCI 0 context 64 bit

<xhci_init :183> XHCI 0 page size 4096 bytes

<xhci_probe :548> [xhci_probe 548]

<xhci_legacy_init :241> XHCI 0 bios offset 0x65c02002

<xhci_legacy_init :247> XHCI 0 USB legacy support already disabled

<xhci_reset :392> usbsts : 1.

<xhci_port_protocol :509> XHCI 0-1 USB v0200 type 0

<xhci_port_protocol :514> speeds

<xhci_port_protocol :519> 1:12Mbps

<xhci_port_protocol :519> 2:1500kbps

<xhci_port_protocol :519> 3:480Mbps

<xhci_port_protocol :509> XHCI 0-2 USB v0310 type 0

<xhci_port_protocol :514> speeds

<xhci_port_protocol :519> 4:5Gbps

<xhci_port_protocol :519> 5:10Gbps

<usb_hc_malloc :407> malloc pa:0xcffd6000 va:0xfffffff40ffd6000 size:136

<usb_hc_malloc :407> malloc pa:0xcffd4000 va:0xfffffff40ffd4000 size:4096

<xhci_dcbaa_alloc :600> ret = 0 dcbcontext_phyAdd:0xcffd4000
<xhci_dcbaa_alloc :611> XHCI 0 DCBAA at [fffffff40ffd4000,fffffff40ffd4440)

<xhci_scratchpad_alloc :640> XHCI 0 no need to allocate scratchpad buffers

<usb_hc_malloc :407> malloc pa:0xcffd2000 va:0xfffffff40ffd2000 size:4096

<xhci_command_alloc :715> ret = 0 cmd_phyAdd:0xcffd2000, sizeof(*xhci->evts):296
<xhci_command_alloc :730> XHCI 0 CRCR at [fffffff40ffd2000,fffffff40ffd3000)

<usb_hc_malloc :407> malloc pa:0xcffd0000 va:0xfffffff40ffd0000 size:4096

<xhci_event_alloc :762> ret = 0 evt_phyAdd:0xcffd0000, xhci->evts:0xfffffff40ffd0000 sizeof(*xhci->evts):296
<usb_hc_malloc :407> malloc pa:0xcffce000 va:0xfffffff40ffce000 size:4096

<xhci_event_alloc :773> ret = 0 eseg_phyAdd:0xcffce000 xhci->eseg:0xfffffff40ffce000 sizeof(*xhci->eseg):16
<xhci_event_alloc :792> XHCI 0 event ring [fffffff40ffd0000,fffffff40ffd1000) table [fffffff40ffce000,fffffff40ffce100) evt_phyAdd:0xcffd0000 eseg_phyAdd:0xcffce000 xhci->eseg->base:0xcffd0000

<xhci_run :831> XHCI 0 start running usbsts:1 config:10

<xhci_run :841> XHCI 0 start running usbsts:1

<xhci_run :856> XHCI 0 start running usbsts:0x0 usbcmd:0x5 runtime:0x2 imod:0x2

<usbh_hub_thread :664> wait event of mq@0xfffffff40061c0f8

Init cherryusb host :0 successfully.put 'usb lsusb -t' to see devices.

<xhci_event_process :2610> have events need to handle evt_type:34 port:1
<xhci_dump_port_status :605> ====port-1====

<xhci_dump_port_status :606> connect=1

<xhci_dump_port_status :607> enabled=0

<xhci_dump_port_status :608> powered=0

<xhci_dump_port_status :609> =====+++++++++=====

<usbh_roothub_thread_wakeup :703> port-1 wakeup roothub@0xfffffff40ffe4000

<usbh_hub_thread :669> handle event of hub@0xfffffff40ffe4000

<usbh_hub_events :477> Port change:0x02, Port:1

<usbh_hub_events :483> Port 1 change

<usbh_hub_dump_status :432> =====================

<usbh_hub_dump_status :433> hub-1 port-1 status 0x101

<usbh_hub_dump_status :434> connection: 1

<usbh_hub_dump_status :435> enable: 0

<usbh_hub_dump_status :436> suspend: 0

<usbh_hub_dump_status :437> overcurrent: 0

<usbh_hub_dump_status :438> reseting: 0

<usbh_hub_dump_status :439> power: 1

<usbh_hub_dump_status :445> full-speed

<usbh_hub_dump_status :447> test: 0

<usbh_hub_dump_status :448> indicator: 0

<usbh_hub_dump_status :449> hub-1 port-1 change 0x1

<usbh_hub_dump_status :450> connection change: 1

<usbh_hub_dump_status :451> enable change: 0

<usbh_hub_dump_status :452> suspend change: 0

<usbh_hub_dump_status :453> overcurrent change: 0

<usbh_hub_dump_status :454> reset change: 0

<usbh_hub_dump_status :455> =====================

<usbh_roothub_control :198> pclear: 0X000002E0
<usbh_hub_events :507> portchange :0X1
<usbh_hub_events :531> Port 1, status:0x101, change:0x00

<usbh_hub_thread_wakeup :693> try to wakeup hub0xfffffff40ffe4000 usb:0xfffffff400630488 hub_mq:0xfffffff40061c0f8 ret:0

<usbh_hub_events :531> Port 1, status:0x101, change:0x00

<usbh_hub_events :531> Port 1, status:0x101, change:0x00

<usbh_hub_events :531> Port 1, status:0x101, change:0x00

<usbh_hub_events :531> Port 1, status:0x101, change:0x00

<xhci_dump_port_status :605> ====port-1====

<xhci_dump_port_status :606> connect=1

<xhci_dump_port_status :607> enabled=0

<xhci_dump_port_status :608> powered=0

<xhci_dump_port_status :609> =====+++++++++=====

<xhci_dump_port_status :605> ====port-1====

<xhci_dump_port_status :606> connect=1

<xhci_dump_port_status :607> enabled=0

<xhci_dump_port_status :608> powered=0

<xhci_dump_port_status :609> =====+++++++++=====

<xhci_event_process :2610> have events need to handle evt_type:34 port:1
<xhci_dump_port_status :605> ====port-1====

<xhci_dump_port_status :606> connect=1

<xhci_dump_port_status :607> enabled=0

<xhci_dump_port_status :608> powered=0

<xhci_dump_port_status :609> =====+++++++++=====

<xhci_port_protocol :509> XHCI 0-1 USB v0200 type 0

<xhci_port_protocol :514> speeds

<xhci_port_protocol :519> 1:12Mbps

<xhci_port_protocol :519> 2:1500kbps

<xhci_port_protocol :519> 3:480Mbps

<xhci_root_speed :1281> XHCI 0-1 status is 0x00200a03, protocol 0x200

<xhci_root_speed :1288> XHCI 0 port-1 ccs: 1, ped: 1, csc: 0, psiv: 0x2

<usbh_roothub_control :265> Port-1 speed = 1

<usbh_hub_events :575> Reset: 0, Enable: 1

<usbh_hub_events :620> New low-speed device on Hub 1, Port 1 connected

<usbh_hport_activate_ep0 :464> Ep=00 Mps=8 Interval=00 Mult=00

<usb_hc_malloc :407> malloc pa:0xcffcc000 va:0xfffffff40ffcc000 size:4096

<usbh_pipe_alloc :363> allocate device for port-1

<xhci_event_process :2610> have events need to handle evt_type:33 port:207
<xhci_complete :2536> command-0xfffffff40ffd2100 completed trb->command :0xcffd2000 trb:0xfffffff40ffd0020!!!

<xhci_enable_slot :1513> XHCI 0 slot 1 enabled

<usb_hc_malloc :407> malloc pa:0xcffcb000 va:0xfffffff40ffcb000 size:304

<usb_hc_malloc :407> malloc pa:0xcffc9000 va:0xfffffff40ffc9000 size:4096

<xhci_device_open :1829> XHCI 0 slot 1 device context [fffffff40ffc9000,fffffff40ffd9000)

<xhci_ctrl_endpoint_open :2102> XHCI 0 slot 1 endpoint 0x0 ep type 0 xhci ep type 0x4

<xhci_ctrl_endpoint_open :2106> XHCI 0 slot 1 ctx 1 ring [fffffff40ffcc000,fffffff40ffcd000)

<usb_hc_malloc :407> malloc pa:0xcffc7000 va:0xfffffff40ffc7000 size:4096

<xhci_event_process :2610> have events need to handle evt_type:33 port:207
<xhci_complete :2536> command-0xfffffff40ffd2100 completed trb->command :0xcffd2010 trb:0xfffffff40ffd0030!!!

<usb_hc_free :482> find va:0xfffffff40ffc7000 ,addr pa :0xcffc7000 ,va:0xfffffff40ffc7000 size:4096

<xhci_address_device :1669> XHCI 0 slot ctx 0xffc9000 assigned address 0x1

<usb_hc_malloc :407> malloc pa:0xcffc8000 va:0xfffffff40ffc8000 size:72

<usbh_submit_urb :458> usbh_submit_urb request-6.

<xhci_endpoint_message :2277> ring doorbell slot-1 ep-1

<xhci_event_process :2610> have events need to handle evt_type:32 port:207
<usb_hc_free :482> find va:0xfffffff40ffc8000 ,addr pa :0xcffc8000 ,va:0xfffffff40ffc8000 size:72

<usbh_enumerate :549> Device rev=0110 cls=00 sub=00 proto=00 size=8

<usb_hc_malloc :407> malloc pa:0xcffc8000 va:0xfffffff40ffc8000 size:72

<usb_hc_free :482> find va:0xfffffff40ffc8000 ,addr pa :0xcffc8000 ,va:0xfffffff40ffc8000 size:72

<usb_hc_malloc :407> malloc pa:0xcffc8000 va:0xfffffff40ffc8000 size:72

<usbh_submit_urb :458> usbh_submit_urb request-6.

<xhci_endpoint_message :2277> ring doorbell slot-1 ep-1

<xhci_event_process :2610> have events need to handle evt_type:32 port:207
<usb_hc_free :482> find va:0xfffffff40ffc8000 ,addr pa :0xcffc8000 ,va:0xfffffff40ffc8000 size:72

<usbh_enumerate :610> New device found,idVendor:17ef,idProduct:608d,bcdDevice:0110

<usb_hc_malloc :407> malloc pa:0xcffc8000 va:0xfffffff40ffc8000 size:72

<usbh_submit_urb :458> usbh_submit_urb request-6.

<xhci_endpoint_message :2277> ring doorbell slot-1 ep-1

<xhci_event_process :2610> have events need to handle evt_type:32 port:207
<usb_hc_free :482> find va:0xfffffff40ffc8000 ,addr pa :0xcffc8000 ,va:0xfffffff40ffc8000 size:72

<usb_hc_malloc :407> malloc pa:0xcffc8000 va:0xfffffff40ffc8000 size:72

<usbh_submit_urb :458> usbh_submit_urb request-6.

<xhci_endpoint_message :2277> ring doorbell slot-1 ep-1

<xhci_event_process :2610> have events need to handle evt_type:32 port:207
<usb_hc_free :482> find va:0xfffffff40ffc8000 ,addr pa :0xcffc8000 ,va:0xfffffff40ffc8000 size:72

<usbh_enumerate :650> The device has 1 interfaces

<usb_hc_malloc :407> malloc pa:0xcffc8000 va:0xfffffff40ffc8000 size:34

<usb_hc_malloc :407> malloc pa:0xcffc7000 va:0xfffffff40ffc7000 size:72

<usbh_submit_urb :458> usbh_submit_urb request-9.

<xhci_endpoint_message :2277> ring doorbell slot-1 ep-1

<xhci_event_process :2610> have events need to handle evt_type:32 port:207
<usb_hc_free :482> find va:0xfffffff40ffc7000 ,addr pa :0xcffc7000 ,va:0xfffffff40ffc7000 size:72

<usbh_enumerate :717> Enumeration success, start loading class driver

<usbh_enumerate :720> Support 1 Interfaces, select the first one

<usbh_enumerate :739> Class:0x03,Subclass:0x01,Protocl:0x02

Loading hid class driver
<usb_hc_malloc :407> malloc pa:0xcffc7000 va:0xfffffff40ffc7000 size:160

<usb_hc_malloc :407> malloc pa:0xcffc6000 va:0xfffffff40ffc6000 size:72

<usbh_submit_urb :458> usbh_submit_urb request-10.

<xhci_endpoint_message :2277> ring doorbell slot-1 ep-1

<xhci_event_process :2610> have events need to handle evt_type:32 port:207
<usb_hc_free :482> find va:0xfffffff40ffc6000 ,addr pa :0xcffc6000 ,va:0xfffffff40ffc6000 size:72

<usb_hc_malloc :407> malloc pa:0xcffc6000 va:0xfffffff40ffc6000 size:72

<usbh_submit_urb :458> usbh_submit_urb request-6.

<xhci_endpoint_message :2277> ring doorbell slot-1 ep-1

<xhci_event_process :2610> have events need to handle evt_type:32 port:207
<usb_hc_free :482> find va:0xfffffff40ffc6000 ,addr pa :0xcffc6000 ,va:0xfffffff40ffc6000 size:72

<usbh_hport_activate_epx :503> Ep=81 Attr=03 Mps=4 Interval=10 Mult=00

<usb_hc_malloc :407> malloc pa:0xcffc5000 va:0xfffffff40ffc5000 size:4096

<usbh_pipe_alloc :383> work_endpoint for slot_id-1

<xhci_work_endpoint_open :2175> XHCI 0 slot 1 endpoint 0x81 ep type 3 xhci ep type 0x7

<usb_hc_malloc :407> malloc pa:0xcffc3000 va:0xfffffff40ffc3000 size:4096

<xhci_dump_endpoint :583> ===endpoint====

<xhci_dump_endpoint :584> xhci=0x630d38

<xhci_dump_endpoint :585> slot=0xffcb000

<xhci_dump_endpoint :586> address=0x81

<xhci_dump_endpoint :587> mtu=0x4

<xhci_dump_endpoint :588> burst=0x0

<xhci_dump_endpoint :589> ctx=0x3

<xhci_dump_endpoint :590> ep_type=intr-ep

<xhci_dump_endpoint :591> xhci_type=intr_in

<xhci_dump_endpoint :592> interval=0x3

<xhci_dump_endpoint :593> =====+++++++++=====

<xhci_dump_input_ctx :458> ===input ctx====

<xhci_dump_input_ctx :459> ctrl@0xfffffff40ffc3000=0xffdbc30

<xhci_dump_input_ctx :460> add=0x9

<xhci_dump_input_ctx :461> del=0x9

<xhci_dump_input_ctx :463> slot@0xfffffff40ffc3040

<xhci_dump_slot_ctx :389> ===== slot ctx =====

<xhci_dump_slot_ctx :390> ctx[0]=0xf8200000

<xhci_dump_slot_ctx :391> info: 0xf8200000

<xhci_dump_slot_ctx :392> ctx[1]=0x0

<xhci_dump_slot_ctx :393> latency: 0x0

<xhci_dump_slot_ctx :394> port: 0x0

<xhci_dump_slot_ctx :395> ports: 0x0

<xhci_dump_slot_ctx :396> ctx[2]=0x0

<xhci_dump_slot_ctx :397> tt_id: 0x0

<xhci_dump_slot_ctx :398> tt_port: 0x0

<xhci_dump_slot_ctx :399> ctx[3]=0x0

<xhci_dump_slot_ctx :400> intr: 0x0

<xhci_dump_slot_ctx :401> address: 0x0

<xhci_dump_slot_ctx :402> state: 0x0

<xhci_dump_slot_ctx :403> =====+++++++++=====

<xhci_dump_input_ctx :466> ep-3@0xfffffff40ffc3100

<xhci_dump_ep_ctx :416> ===== ep ctx =====

<xhci_dump_ep_ctx :417> ctx[0]=0x30000

<xhci_dump_ep_ctx :418> ep_state: 0x0

<xhci_dump_ep_ctx :419> mult: 0x0

<xhci_dump_ep_ctx :420> stream: 0x0

<xhci_dump_ep_ctx :421> lsa: 0x0

<xhci_dump_ep_ctx :422> interval: 0x3

<xhci_dump_ep_ctx :423> esit_high: 0x0

<xhci_dump_ep_ctx :424> ctx[1]=0x40038

<xhci_dump_ep_ctx :425> cerr: 0x0

<xhci_dump_ep_ctx :426> type: 0x7

<xhci_dump_ep_ctx :427> hid: 0x0

<xhci_dump_ep_ctx :428> burst: 0x0

<xhci_dump_ep_ctx :429> mtu: 0x4

<xhci_dump_ep_ctx :430> ctx[2]=0xcffc5001

<xhci_dump_ep_ctx :431> ctx[3]=0x0

<xhci_dump_ep_ctx :432> dequeue: 0xcffc5001

<xhci_dump_ep_ctx :433> dcs: 0x1

<xhci_dump_ep_ctx :434> ctx[4]=0x40010

<xhci_dump_ep_ctx :435> trb_len: 0x10

<xhci_dump_ep_ctx :436> esit_low: 0x4

<xhci_dump_ep_ctx :437> =====+++++++++=====

<xhci_dump_input_ctx :469> =====+++++++++=====

<xhci_event_process :2610> have events need to handle evt_type:33 port:207
<xhci_complete :2536> command-0xfffffff40ffd2100 completed trb->command :0xcffd2020 trb:0xfffffff40ffd00b0!!!

<usb_hc_free :482> find va:0xfffffff40ffc3000 ,addr pa :0xcffc3000 ,va:0xfffffff40ffc3000 size:4096

<xhci_configure_endpoint :2015> XHCI 0 slot 1 ctx 3 configured

<xhci_work_endpoint_open :2184> XHCI 0 slot 1 ctx 3 ring [fffffff40ffc5000,fffffff40ffc6000)

[usbh_hid_run :426].bInterfaceProtocol:2
<usb_hc_free :482> find va:0xfffffff40ffc8000 ,addr pa :0xcffc8000 ,va:0xfffffff40ffc8000 size:34

<usbh_hub_events :477> Port change:0x02, Port:2

<usbh_hub_thread :664> wait event of mq@0xfffffff40061c0f8

您好,感谢您的反馈,S2500 我们暂时还没支持,看您那边好像是用 MSI 中断的,这块我们也没有试过,后续有条件我们会测试下您这种使用场景,谢谢

还有,您这边鼠标好像是接到 hub 上使用的,CherryUSB 协议栈那边 USB 3.0 的 Hub 还没支持好,可能不能这样用

msi中断暂时未生效使用的是轮询方式触发,没有使用hub连接

李宗军 任务状态已确认 修改为修复中
李宗军 计划截止日期设置为2024-05-31
李宗军 任务类型缺陷 修改为需求
李宗军 任务状态修复中 修改为待办的
李宗军 修改了描述
李宗军 任务状态待办的 修改为设计中
李宗军 任务状态设计中 修改为开发中

登录 后才可以发表评论

状态
负责人
项目
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
预计工期 (小时)
参与者(2)
C
1
https://gitee.com/phytium_embedded/phytium-free-rtos-sdk.git
git@gitee.com:phytium_embedded/phytium-free-rtos-sdk.git
phytium_embedded
phytium-free-rtos-sdk
Phytium-FreeRTOS-SDK

搜索帮助

344bd9b3 5694891 D2dac590 5694891