Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STM32 USB: netusb: kernel crash when testing example echo_server with nucleo_f412zg (ECM on Windows) #13560

Closed
Jeepgoing opened this issue Feb 20, 2019 · 24 comments
Assignees
Labels
area: Networking area: USB Universal Serial Bus bug The issue is a bug, or the PR is fixing a bug platform: STM32 ST Micro STM32 priority: low Low impact/importance bug

Comments

@Jeepgoing
Copy link

I have configured board with this command
cmake -GNinja -DBOARD=nucleo_f412zg -DOVERLAY_CONFIG=overlay-netusb.conf ..

when i boot up kernel crashed.

�[1;32muart:~$ �[m***** Booting Zephyr OS v1.14.0-rc1-348-gcda3fad5c8 *****
�[8D�[J[00:00:00.059,036] �[0m<inf> usb_net: netusb initialized�[0m
�[1;32muart:~$ �[m�[8D�[J[00:00:00.059,210] �[1;31m<err> usb_net: interface disabled�[0m
�[1;32muart:~$ �[m�[8D�[J[00:00:00.059,380] �[1;31m<err> usb_net: interface disabled�[0m
�[1;32muart:~$ �[m�[8D�[J[00:00:00.059,532] �[1;31m<err> usb_net: interface disabled�[0m
�[1;32muart:~$ �[m�[8D�[J[00:00:00.059,684] �[1;31m<err> usb_net: interface disabled�[0m
�[1;32muart:~$ �[m�[8D�[J[00:00:00.064,681] �[0m<inf> net_config: Initializing network�[0m
�[1;32muart:~$ �[m�[8D�[J[00:00:00.064,716] �[0m<inf> net_config: IPv4 address: 192.0.2.1�[0m
�[1;32muart:~$ �[m�[8D�[J[00:00:00.064,918] �[1;31m<err> usb_net: interface disabled�[0m
�[1;32muart:~$ �[m�[8D�[J[00:00:00.065,077] �[1;31m<err> usb_net: interface disabled�[0m
�[1;32muart:~$ �[m�[8D�[J[00:00:00.160,084] �[0m<inf> net_config: IPv6 address: fe80::200:5eff:fe00:5300�[0m
�[1;32muart:~$ �[m�[8D�[J�[1;32muart:~$ �[m�[1B�[9D�[8D�[J[00:00:00.166,094] �[0m<inf> net_config: IPv6 address: fe80::200:5eff:fe00:5300�[0m

***** USAGE FAULT *****
  Division by zero
***** Hardware exception *****
Current thread ID = 0x20003620
Faulting instruction address = 0x80027d4
Fatal fault in ISR! Spinning...

so anyone have met this issue?

@Jeepgoing Jeepgoing added the bug The issue is a bug, or the PR is fixing a bug label Feb 20, 2019
@Jeepgoing Jeepgoing changed the title USB: netusb: kernel crash when testing example echo_server with nucleo_f412zg STM32 USB: netusb: kernel crash when testing example echo_server with nucleo_f412zg Feb 20, 2019
@nashif nashif added area: Networking priority: low Low impact/importance bug area: USB Universal Serial Bus labels Feb 21, 2019
@qianfan-Zhao
Copy link
Collaborator

an advice not related this issue:

your serial port software doesn't support color so there has something such as [1;

you can try putty

@Jeepgoing
Copy link
Author

@qianfan-Zhao thanks

@finikorg
Copy link
Collaborator

finikorg commented Feb 26, 2019

I have reel_board and frdm_k64f, the sample works fine with them. Do you have other USB samples working on that board?

@Jeepgoing
Copy link
Author

@finikorg I have tested hid sample,it't works good
https://github.com/zephyrproject-rtos/zephyr/tree/master/samples/subsys/usb/hid

@finikorg finikorg added the platform: STM32 ST Micro STM32 label Mar 8, 2019
@finikorg
Copy link
Collaborator

@Jeepgoing are you using USB Ethernet ECM with Windows? You should use RNDIS. I can verify that RNDIS works with Windows while selecting ECM produces crash (which is also might be an issue, I will check it).

@finikorg
Copy link
Collaborator

There seems to be division by zero bug inside stm32cube

#3  <signal handler called>
#4  0x080017b8 in USB_EPStartXfer (USBx=0x50000000, ep=0x20000ad8 <usb_dc_stm32_state+532>, 
    dma=0 '\000')
    at /usr/local/src/viper/foss-rtos/ext/hal/st/stm32cube/stm32f4xx/drivers/src/stm32f4xx_ll_usb.c:750
#5  0x080138ec in HAL_PCD_EP_Receive (hpcd=hpcd@entry=0x200008c4 <usb_dc_stm32_state>, 
    ep_addr=ep_addr@entry=1 '\001', pBuf=pBuf@entry=0x20000f18 <usb_dc_stm32_state+1620> "", 
    len=<optimized out>)
    at /usr/local/src/viper/foss-rtos/ext/hal/st/stm32cube/stm32f4xx/drivers/src/stm32f4xx_hal_pcd.c:1040
#6  0x08005f6e in usb_dc_ep_start_read (ep=<optimized out>, data=<optimized out>, 
    max_data_len=<optimized out>)
(gdb) frame 4
#4  0x080017b8 in USB_EPStartXfer (USBx=0x50000000, ep=0x20000ad8 <usb_dc_stm32_state+532>, 
    dma=0 '\000')
    at /usr/local/src/viper/foss-rtos/ext/hal/st/stm32cube/stm32f4xx/drivers/src/stm32f4xx_ll_usb.c:750
750	      pktcnt = (ep->xfer_len + ep->maxpacket -1U)/ ep->maxpacket;
(gdb) p ep->maxpacket
$2 = 0

@erwango
Copy link
Member

erwango commented Mar 18, 2019

@ydamigos , @loicpoulain can you have a check?

@ydamigos
Copy link
Collaborator

I couldn't reproduce the error. I tested echo_server using netusb on my 96b_carbon. It starts without crashing:

uart:~$ ***** Booting Zephyr OS v1.14.0-rc1-1291-g94ae61f765d3 *****
[00:00:00.059,000] <inf> usb_net: netusb initialized
[00:00:00.059,000] <err> usb_net: interface disabled
[00:00:00.059,000] <err> usb_net: interface disabled
[00:00:00.059,000] <err> usb_net: interface disabled
[00:00:00.059,000] <err> usb_net: interface disabled
[00:00:00.324,000] <inf> spi_ll_stm32: CS control inhibited (no GPIO device)
[00:00:00.373,000] <wrn> bt_hci_core: ECC HCI commands not available
[00:00:00.374,000] <inf> net_config: Initializing network
[00:00:00.374,000] <inf> net_config: IPv4 address: 192.0.2.1
[00:00:00.374,000] <wrn> net_if: iface 0x200110e0 is down
[00:00:00.374,000] <err> net_if: Cannot join all nodes address ff02::1 (-1)
[00:00:01.060,000] <err> usb_net: interface disabled
[00:00:03.375,000] <inf> net_echo_server_sample: Run echo server
[00:00:03.375,000] <inf> net_echo_server_sample: Waiting for TCP connection on port 4242 (IPv6)...
[00:00:03.375,000] <inf> net_echo_server_sample: Waiting for TCP connection on port 4242 (IPv4)...
[00:00:03.375,000] <inf> net_echo_server_sample: Waiting for UDP packets on port 4242 (IPv6)...
[00:00:03.375,000] <inf> net_echo_server_sample: Waiting for UDP packets on port 4242 (IPv4)...
uart:~$ 

@finikorg
Copy link
Collaborator

@ydamigos How do you run it? I can reproduce the crash building echo_server with netusb overlay (default would be ECM protocol) and connecting it to Windows, not Linux. @Jeepgoing is this correct procedure?

@Jeepgoing
Copy link
Author

@finikorg yes, i have tested netusb with defconfig.

@finikorg
Copy link
Collaborator

@finikorg yes, i have tested netusb with defconfig.

with Windows, right? Because in Linux it should work just fine.

@Jeepgoing
Copy link
Author

Jeepgoing commented Mar 20, 2019

@finikorg yep,i test with windows, i have not test with linux.

@ydamigos
Copy link
Collaborator

ydamigos commented Mar 20, 2019

How do you run it? I can reproduce the crash building echo_server with netusb overlay (default would be ECM protocol) and connecting it to Windows, not Linux. @Jeepgoing is this correct procedure?

@finikorg I built echo_server with netusb overlay and connected it to Linux. I need to try it on Windows.
It seems similar to #13066 and #7364 crashes. Probably some EP is used before it is configured.

@finikorg
Copy link
Collaborator

@ydamigos So, have you verified the crash?

@finikorg finikorg changed the title STM32 USB: netusb: kernel crash when testing example echo_server with nucleo_f412zg STM32 USB: netusb: kernel crash when testing example echo_server with nucleo_f412zg (ECM on Windows) Mar 21, 2019
@finikorg
Copy link
Collaborator

How do you run it? I can reproduce the crash building echo_server with netusb overlay (default would be ECM protocol) and connecting it to Windows, not Linux. @Jeepgoing is this correct procedure?

@finikorg I built echo_server with netusb overlay and connected it to Linux. I need to try it on Windows.
It seems similar to #13066 and #7364 crashes. Probably some EP is used before it is configured.

Yes, exactly, Probably Windows does not configure ECM.

@ydamigos
Copy link
Collaborator

ydamigos commented Mar 21, 2019

So, have you verified the crash?

@finikorg Yes, it crashes on Windows. It tries to read from EP01 without configuring it.

uart:~$ ***** Booting Zephyr OS v1.14.0-rc1-1291-g94ae61f765d3 *****
[00:00:00.000,000] <dbg> usb_dc_stm32.usb_dc_ep_check_cap: ep 81, mps 16, type 3
[00:00:00.000,000] <dbg> usb_dc_stm32.usb_dc_ep_check_cap: ep 82, mps 64, type 2
[00:00:00.000,000] <dbg> usb_dc_stm32.usb_dc_ep_check_cap: ep 1, mps 64, type 2
[00:00:00.000,000] <dbg> usb_dc_stm32.usb_dc_set_status_callback: 
[00:00:00.000,000] <dbg> usb_dc_stm32.usb_dc_attach: 
[00:00:00.000,000] <dbg> usb_dc_stm32.usb_dc_stm32_init: HAL_PCD_Init
[00:00:00.055,000] <dbg> usb_dc_stm32.usb_dc_stm32_init: HAL_PCD_Start
[00:00:00.059,000] <dbg> usb_dc_stm32.HAL_PCD_ResetCallback: 
[00:00:00.059,000] <dbg> usb_dc_stm32.usb_dc_ep_configure: ep 0x00, ep_mps 64, ep_type 0
[00:00:00.059,000] <dbg> usb_dc_stm32.usb_dc_ep_configure: ep 0x80, ep_mps 64, ep_type 0
[00:00:00.059,000] <dbg> usb_dc_stm32.usb_dc_ep_set_callback: ep 0x00
[00:00:00.059,000] <dbg> usb_dc_stm32.usb_dc_ep_set_callback: ep 0x80
[00:00:00.059,000] <dbg> usb_dc_stm32.usb_dc_ep_set_callback: ep 0x81
[00:00:00.059,000] <dbg> usb_dc_stm32.usb_dc_ep_set_callback: ep 0x01
[00:00:00.061,000] <dbg> usb_dc_stm32.HAL_PCD_SuspendCallback: 
[00:00:00.416,000] <dbg> usb_dc_stm32.HAL_PCD_ResetCallback: 
[00:00:00.848,000] <dbg> usb_dc_stm32.HAL_PCD_SetupStageCallback: 
[00:00:00.848,000] <dbg> usb_dc_stm32.usb_dc_ep_read_wait: ep 0x00, 8 bytes, 0+8, 0x200007dc
[00:00:00.848,000] <dbg> usb_dc_stm32.usb_dc_ep_write: ep 0x80, len 18
[00:00:00.848,000] <dbg> usb_dc_stm32.usb_dc_ep_start_read: ep 0x80, len 0
[00:00:00.850,000] <dbg> usb_dc_stm32.usb_dc_ep_read_wait: ep 0x00, 0 bytes, 0+0, 0x20011f2a
[00:00:00.901,000] <dbg> usb_dc_stm32.HAL_PCD_ResetCallback: 
[00:00:00.933,000] <inf> spi_ll_stm32: CS control inhibited (no GPIO device)
[00:00:00.935,000] <dbg> usb_dc_stm32.HAL_PCD_SetupStageCallback: 
[00:00:00.935,000] <dbg> usb_dc_stm32.usb_dc_ep_read_wait: ep 0x00, 8 bytes, 0+8, 0x200007dc
[00:00:00.935,000] <dbg> usb_dc_stm32.usb_dc_set_address: addr 2 (0x02)
[00:00:00.935,000] <dbg> usb_dc_stm32.usb_dc_ep_write: ep 0x80, len 0
[00:00:00.936,000] <dbg> usb_dc_stm32.HAL_PCD_DataInStageCallback: epnum 0x00
[00:00:00.948,000] <dbg> usb_dc_stm32.HAL_PCD_SetupStageCallback: 
[00:00:00.948,000] <dbg> usb_dc_stm32.usb_dc_ep_read_wait: ep 0x00, 8 bytes, 0+8, 0x200007dc
[00:00:00.948,000] <dbg> usb_dc_stm32.usb_dc_ep_write: ep 0x80, len 18
[00:00:00.948,000] <dbg> usb_dc_stm32.usb_dc_ep_start_read: ep 0x80, len 0
[00:00:00.949,000] <dbg> usb_dc_stm32.HAL_PCD_DataInStageCallback: epnum 0x00
[00:00:00.950,000] <dbg> usb_dc_stm32.HAL_PCD_DataOutStageCallback: epnum 0x00, rx_count 0
[00:00:00.950,000] <dbg> usb_dc_stm32.usb_dc_ep_read_wait: ep 0x00, 0 bytes, 0+0, 0x20011f2a
[00:00:00.955,000] <dbg> usb_dc_stm32.HAL_PCD_SetupStageCallback: 
[00:00:00.955,000] <dbg> usb_dc_stm32.usb_dc_ep_read_wait: ep 0x00, 8 bytes, 0+8, 0x200007dc
[00:00:00.955,000] <dbg> usb_dc_stm32.usb_dc_ep_write: ep 0x80, len 80
[00:00:00.955,000] <dbg> usb_dc_stm32.usb_dc_ep_start_read: ep 0x80, len 0
[00:00:00.956,000] <dbg> usb_dc_stm32.HAL_PCD_DataInStageCallback: epnum 0x00
[00:00:00.956,000] <dbg> usb_dc_stm32.usb_dc_ep_write: ep 0x80, len 16
[00:00:00.956,000] <dbg> usb_dc_stm32.usb_dc_ep_start_read: ep 0x80, len 0
[00:00:00.957,000] <dbg> usb_dc_stm32.HAL_PCD_DataInStageCallback: epnum 0x00
[00:00:00.958,000] <dbg> usb_dc_stm32.HAL_PCD_DataOutStageCallback: epnum 0x00, rx_count 0
[00:00:00.958,000] <dbg> usb_dc_stm32.usb_dc_ep_read_wait: ep 0x00, 0 bytes, 0+0, 0x20011f7a
[00:00:00.961,000] <dbg> usb_dc_stm32.HAL_PCD_SetupStageCallback: 
[00:00:00.961,000] <dbg> usb_dc_stm32.usb_dc_ep_read_wait: ep 0x00, 8 bytes, 0+8, 0x200007dc
[00:00:00.961,000] <dbg> usb_dc_stm32.usb_dc_ep_write: ep 0x80, len 10
[00:00:00.961,000] <dbg> usb_dc_stm32.usb_dc_ep_start_read: ep 0x80, len 0
[00:00:00.962,000] <dbg> usb_dc_stm32.HAL_PCD_DataInStageCallback: epnum 0x00
[00:00:00.963,000] <dbg> usb_dc_stm32.HAL_PCD_DataOutStageCallback: epnum 0x00, rx_count 0
[00:00:00.963,000] <dbg> usb_dc_stm32.usb_dc_ep_read_wait: ep 0x00, 0 bytes, 0+0, 0x20011fa6
[00:00:00.966,000] <dbg> usb_dc_stm32.HAL_PCD_SetupStageCallback: 
[00:00:00.966,000] <dbg> usb_dc_stm32.usb_dc_ep_read_wait: ep 0x00, 8 bytes, 0+8, 0x200007dc
[00:00:00.966,000] <dbg> usb_dc_stm32.usb_dc_ep_write: ep 0x80, len 4
[00:00:00.966,000] <dbg> usb_dc_stm32.usb_dc_ep_start_read: ep 0x80, len 0
[00:00:00.967,000] <dbg> usb_dc_stm32.HAL_PCD_DataInStageCallback: epnum 0x00
[00:00:00.968,000] <dbg> usb_dc_stm32.HAL_PCD_DataOutStageCallback: epnum 0x00, rx_count 0
[00:00:00.968,000] <dbg> usb_dc_stm32.usb_dc_ep_read_wait: ep 0x00, 0 bytes, 0+0, 0x20011f7e
[00:00:00.971,000] <dbg> usb_dc_stm32.HAL_PCD_SetupStageCallback: 
[00:00:00.971,000] <dbg> usb_dc_stm32.usb_dc_ep_read_wait: ep 0x00, 8 bytes, 0+8, 0x200007dc
[00:00:00.971,000] <dbg> usb_dc_stm32.usb_dc_ep_write: ep 0x80, len 16
[00:00:00.971,000] <dbg> usb_dc_stm32.usb_dc_ep_start_read: ep 0x80, len 0
[00:00:00.972,000] <dbg> usb_dc_stm32.HAL_PCD_DataInStageCallback: epnum 0x00
[00:00:00.973,000] <dbg> usb_dc_stm32.HAL_PCD_DataOutStageCallback: epnum 0x00, rx_count 0
[00:00:00.973,000] <dbg> usb_dc_stm32.usb_dc_ep_read_wait: ep 0x00, 0 bytes, 0+0, 0x20011f9c
[00:00:00.975,000] <dbg> usb_dc_stm32.HAL_PCD_SetupStageCallback: 
[00:00:00.975,000] <dbg> usb_dc_stm32.usb_dc_ep_read_wait: ep 0x00, 8 bytes, 0+8, 0x200007dc
[00:00:00.975,000] <dbg> usb_dc_stm32.usb_dc_ep_set_stall: ep 0x80
[00:00:00.982,000] <dbg> usb_dc_stm32.HAL_PCD_SetupStageCallback: 
[00:00:00.982,000] <dbg> usb_dc_stm32.usb_dc_ep_read_wait: ep 0x00, 8 bytes, 0+8, 0x200007dc
[00:00:00.982,000] <dbg> usb_dc_stm32.usb_dc_ep_write: ep 0x80, len 18
[00:00:00.982,000] <dbg> usb_dc_stm32.usb_dc_ep_start_read: ep 0x80, len 0
[00:00:00.983,000] <dbg> usb_dc_stm32.HAL_PCD_DataInStageCallback: epnum 0x00
[00:00:00.984,000] <dbg> usb_dc_stm32.HAL_PCD_DataOutStageCallback: epnum 0x00, rx_count 0
[00:00:00.984,000] <dbg> usb_dc_stm32.usb_dc_ep_read_wait: ep 0x00, 0 bytes, 0+0, 0x20011f2a
[00:00:00.985,000] <wrn> bt_hci_core: ECC HCI commands not available
[00:00:00.985,000] <inf> net_config: Initializing network
[00:00:00.985,000] <inf> net_config: IPv4 address: 192.0.2.1
[00:00:00.985,000] <wrn> net_if: iface 0x20011ce0 is down
[00:00:00.985,000] <err> net_if: Cannot join all nodes address ff02::1 (-1)
[00:00:00.986,000] <dbg> usb_dc_stm32.HAL_PCD_SetupStageCallback: 
[00:00:00.986,000] <dbg> usb_dc_stm32.usb_dc_ep_read_wait: ep 0x00, 8 bytes, 0+8, 0x200007dc
[00:00:00.986,000] <dbg> usb_dc_stm32.usb_dc_ep_write: ep 0x80, len 9
[00:00:00.986,000] <dbg> usb_dc_stm32.usb_dc_ep_start_read: ep 0x80, len 0
[00:00:00.987,000] <dbg> usb_dc_stm32.HAL_PCD_DataInStageCallback: epnum 0x00
[00:00:00.989,000] <dbg> usb_dc_stm32.HAL_PCD_DataOutStageCallback: epnum 0x00, rx_count 0
[00:00:00.989,000] <dbg> usb_dc_stm32.usb_dc_ep_read_wait: ep 0x00, 0 bytes, 0+0, 0x20011f33
[00:00:00.991,000] <dbg> usb_dc_stm32.HAL_PCD_SetupStageCallback: 
[00:00:00.991,000] <dbg> usb_dc_stm32.usb_dc_ep_read_wait: ep 0x00, 8 bytes, 0+8, 0x200007dc
[00:00:00.991,000] <dbg> usb_dc_stm32.usb_dc_ep_write: ep 0x80, len 80
[00:00:00.991,000] <dbg> usb_dc_stm32.usb_dc_ep_start_read: ep 0x80, len 0
[00:00:00.993,000] <dbg> usb_dc_stm32.HAL_PCD_DataInStageCallback: epnum 0x00
[00:00:00.993,000] <dbg> usb_dc_stm32.usb_dc_ep_write: ep 0x80, len 16
[00:00:00.993,000] <dbg> usb_dc_stm32.usb_dc_ep_start_read: ep 0x80, len 0
[00:00:00.994,000] <dbg> usb_dc_stm32.HAL_PCD_DataInStageCallback: epnum 0x00
[00:00:00.995,000] <dbg> usb_dc_stm32.HAL_PCD_DataOutStageCallback: epnum 0x00, rx_count 0
[00:00:00.995,000] <dbg> usb_dc_stm32.usb_dc_ep_read_wait: ep 0x00, 0 bytes, 0+0, 0x20011f7a
[00:00:00.999,000] <dbg> usb_dc_stm32.HAL_PCD_SetupStageCallback: 
[00:00:00.999,000] <dbg> usb_dc_stm32.usb_dc_ep_read_wait: ep 0x00, 8 bytes, 0+8, 0x200007dc
[00:00:00.999,000] <dbg> usb_dc_stm32.usb_dc_ep_configure: ep 0x81, ep_mps 16, ep_type 3
[00:00:00.999,000] <dbg> usb_dc_stm32.usb_dc_ep_enable: ep 0x81
[00:00:00.999,000] <dbg> usb_dc_stm32.usb_dc_ep_enable: HAL_PCD_EP_Open(0x81, 16, 3)
[00:00:00.999,000] <dbg> usb_dc_stm32.usb_dc_ep_write: ep 0x80, len 0
[00:00:01.000,000] <dbg> usb_dc_stm32.HAL_PCD_DataInStageCallback: epnum 0x00
[00:00:01.002,000] <dbg> usb_dc_stm32.HAL_PCD_SetupStageCallback: 
[00:00:01.002,000] <dbg> usb_dc_stm32.usb_dc_ep_read_wait: ep 0x00, 8 bytes, 0+8, 0x200007dc
[00:00:01.002,000] <dbg> usb_dc_stm32.usb_dc_ep_start_read: ep 0x01, len 64
***** USAGE FAULT *****
  Division by zero
***** Hardware exception *****
Current thread ID = 0x20002e20
Faulting instruction address = 0x8002030
Fatal fault in ISR! Spinning...

@finikorg
Copy link
Collaborator

finikorg commented Mar 22, 2019

Window set iface 1 alt settings 0, we should not call callback then (or in the callback we need to check alt_setting parameter), I will fix this issue.

finikorg added a commit to finikorg/zephyr that referenced this issue Mar 27, 2019
Fix crash when reading invalid endpoint found in harness test.

Fixes zephyrproject-rtos#13560

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
finikorg added a commit to finikorg/zephyr that referenced this issue Apr 3, 2019
Only enable netusb for the right configuration of interface and
alt_setting.

Fixes zephyrproject-rtos#13560

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
finikorg added a commit to finikorg/zephyr that referenced this issue Apr 5, 2019
Only enable netusb for the right configuration of interface and
alt_setting.

Fixes zephyrproject-rtos#13560

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
@nashif nashif closed this as completed in 8ed215e Apr 5, 2019
jfischer-no pushed a commit to jfischer-no/zephyr that referenced this issue Apr 8, 2019
Only enable netusb for the right configuration of interface and
alt_setting.

Fixes zephyrproject-rtos#13560

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
nashif pushed a commit that referenced this issue Apr 11, 2019
Only enable netusb for the right configuration of interface and
alt_setting.

Fixes #13560

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
@Jeepgoing
Copy link
Author

I couldn't reproduce the error. I tested echo_server using netusb on my 96b_carbon. It starts without crashing:

uart:~$ ***** Booting Zephyr OS v1.14.0-rc1-1291-g94ae61f765d3 *****
[00:00:00.059,000] <inf> usb_net: netusb initialized
[00:00:00.059,000] <err> usb_net: interface disabled
[00:00:00.059,000] <err> usb_net: interface disabled
[00:00:00.059,000] <err> usb_net: interface disabled
[00:00:00.059,000] <err> usb_net: interface disabled
[00:00:00.324,000] <inf> spi_ll_stm32: CS control inhibited (no GPIO device)
[00:00:00.373,000] <wrn> bt_hci_core: ECC HCI commands not available
[00:00:00.374,000] <inf> net_config: Initializing network
[00:00:00.374,000] <inf> net_config: IPv4 address: 192.0.2.1
[00:00:00.374,000] <wrn> net_if: iface 0x200110e0 is down
[00:00:00.374,000] <err> net_if: Cannot join all nodes address ff02::1 (-1)
[00:00:01.060,000] <err> usb_net: interface disabled
[00:00:03.375,000] <inf> net_echo_server_sample: Run echo server
[00:00:03.375,000] <inf> net_echo_server_sample: Waiting for TCP connection on port 4242 (IPv6)...
[00:00:03.375,000] <inf> net_echo_server_sample: Waiting for TCP connection on port 4242 (IPv4)...
[00:00:03.375,000] <inf> net_echo_server_sample: Waiting for UDP packets on port 4242 (IPv6)...
[00:00:03.375,000] <inf> net_echo_server_sample: Waiting for UDP packets on port 4242 (IPv4)...
uart:~$ 

Hi, @ydamigos , can you tell me how to test this sample?

there have two unknow devices on my PC,
image

@ydamigos
Copy link
Collaborator

Hi @Jeepgoing,

On windows, I had to edit overlay-netusb.conf and change CONFIG_USB_DEVICE_NETWORK_ECM=y to CONFIG_USB_DEVICE_NETWORK_RNDIS=y.

Then I run:

$ cmake -DBOARD=96b_carbon -DOVERLAY_CONFIG=overlay-netusb.conf ../zephyr/samples/net/sockets/echo_server
$ make flash

I connected the device to Windows machine. A new Unknown device showed up in Device Manager. I chose to update drivers with the option Pick from a list and then selected ‘Network Adapters’ -> ‘Microsoft Corp’ -> ‘Remote NDIS Compatible device’.

New adapter showed up in network interfaces.

@finikorg
Copy link
Collaborator

@ydamigos Could you try enabling USB_DEVICE_OS_DESC, it should install Windows drivers automatically.

@ydamigos
Copy link
Collaborator

Could you try enabling USB_DEVICE_OS_DESC, it should install Windows drivers automatically.

@finikorg I enabled it but Windows drivers didn't install automatically.

@finikorg
Copy link
Collaborator

Could you try enabling USB_DEVICE_OS_DESC, it should install Windows drivers automatically.

@finikorg I enabled it but Windows drivers didn't install automatically.

I think you need to remove old drivers associated with this VID/PID, you can change that pair.

@ydamigos
Copy link
Collaborator

Could you try enabling USB_DEVICE_OS_DESC, it should install Windows drivers automatically.

@finikorg I enabled it but Windows drivers didn't install automatically.

I think you need to remove old drivers associated with this VID/PID, you can change that pair.

I changed VID/PID pair and "Remote NDIS Compatible device" driver installed automatically.

@Jeepgoing
Copy link
Author

@ydamigos @finikorg it works, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Networking area: USB Universal Serial Bus bug The issue is a bug, or the PR is fixing a bug platform: STM32 ST Micro STM32 priority: low Low impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants