Skip to content

NCM interface stop transmitting packets after ifconfig down+up on Linux side (STM32H7 DWC2) #3436

@ceedriic

Description

@ceedriic

Operating System

Linux

Commit SHA

3af1bec

Board

Custom stm32h747 board

Firmware

Custom stm32h747 board, but the problematic code is very similar to net_lwip_webserver with NCM config.
Alpine Linux 3.23 on the host side.

What happened ?

When the system run for the first time, everything is fine.

Configuration:

#define CFG_TUD_NCM_IN_NTB_N		2
#define CFG_TUD_NCM_IN_NTB_MAX_SIZE	2048
#define CFG_TUD_NCM_OUT_NTB_N		2
#define CFG_TUD_NCM_OUT_NTB_MAX_SIZE	2048
  1. Start the net_lwip_webserver-similar TinyUSB device.
  2. On linux, after eth1 comes up, do ifconfig eth1 up and dhcpcd eth1
  3. At this point, eth1 gets an IP address (given by TinyUSB dhcpd server), and the interface can be pinged, all is fine.
  4. Run ifconfig eth1 down on the Linux side.
  5. At this point, Linux stop listening to the INTERRUPT and BULK endpoints.
  6. Run ifconfig eth1 up on the Linux side.
  7. At this point, Linux is again listening to the INTERRUPT and BULK endpoints.
  8. Observe that eth1 does not get an IP address anymore, because the TinyUSB device stop transmitting anything.

If I plug the debugger at this point, I notice that both xmit_free_ntb are null, but xmit_tinyusb_ntb is non null and xmit_ready_ntb[0] is non null (see image below), therefore tud_network_can_xmit() return false.

Image

I've tried with and without DMA it makes no difference.

Anyway, I would love to have some help/idea/suggestion at this point, I'm stuck.

How to reproduce ?

See above.

Debug Log as txt file (LOG/CFG_TUSB_DEBUG=2)

The following log starts at point 3) above, i.e. when everything is fine:

tinyusb.log

We can see at the end of the log, after the last ifconfig eth1 up that Linux sends DHCP Discover packets continuously, they get received by TinyUSB but generates no answer.

Screenshots

No response

I have checked existing issues, discussion and documentation

  • I confirm I have checked existing issues, discussion and documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions