From 19cc4c823fea98ee58b74874918c1b901689aa17 Mon Sep 17 00:00:00 2001 From: rbb666 Date: Fri, 24 Oct 2025 17:34:27 +0800 Subject: [PATCH 1/3] cherryusb:Fixed the issue where the USB device in the cdc_rndis_template example could not enable DHCP. --- .../drivers/usb/cherryusb/demo/cdc_rndis_template.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/components/drivers/usb/cherryusb/demo/cdc_rndis_template.c b/components/drivers/usb/cherryusb/demo/cdc_rndis_template.c index ff9526413ae..c7bda9316b8 100644 --- a/components/drivers/usb/cherryusb/demo/cdc_rndis_template.c +++ b/components/drivers/usb/cherryusb/demo/cdc_rndis_template.c @@ -189,14 +189,14 @@ void usbd_rndis_data_send_done(uint32_t len) #error rndis must enable RT_LWIP_DHCP #endif -#ifndef LWIP_USING_DHCPD -#error rndis must enable LWIP_USING_DHCPD +#ifdef LWIP_USING_DHCPD +#include #endif #include #include #include -#include +#include struct eth_device rndis_dev; @@ -250,7 +250,14 @@ void rndis_lwip_init(void) eth_device_init(&rndis_dev, "u0"); eth_device_linkchange(&rndis_dev, RT_TRUE); +#ifdef LWIP_USING_DHCPD dhcpd_start("u0"); +#else + struct netdev *netdev = netdev_get_by_name("u0"); + if (netdev) { + netdev_dhcp_enabled(netdev, RT_TRUE); + } +#endif } void usbd_rndis_data_recv_done(uint32_t len) From 4d69efc89e7503cf437cc2cb68dfb5580d521633 Mon Sep 17 00:00:00 2001 From: rbb666 Date: Fri, 24 Oct 2025 17:38:04 +0800 Subject: [PATCH 2/3] cherryusb:Add the missing header files for bsp/frdm-mcxa156. --- .../mcx/mcxa/frdm-mcxa156/board/ports/cherryusb/usb_config.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bsp/nxp/mcx/mcxa/frdm-mcxa156/board/ports/cherryusb/usb_config.h b/bsp/nxp/mcx/mcxa/frdm-mcxa156/board/ports/cherryusb/usb_config.h index a03acd4155a..3ff89e6adb1 100644 --- a/bsp/nxp/mcx/mcxa/frdm-mcxa156/board/ports/cherryusb/usb_config.h +++ b/bsp/nxp/mcx/mcxa/frdm-mcxa156/board/ports/cherryusb/usb_config.h @@ -10,6 +10,8 @@ #ifndef CHERRYUSB_CONFIG_H #define CHERRYUSB_CONFIG_H +#include + /* ================ USB common Configuration ================ */ #define CONFIG_USB_PRINTF(...) printf(__VA_ARGS__) From ddd69285352d4e814bcf91da01f1f0d4ab61497b Mon Sep 17 00:00:00 2001 From: rbb666 Date: Fri, 24 Oct 2025 17:45:02 +0800 Subject: [PATCH 3/3] cherryusb:Adapt the usbd_kinetis_delay_ms interface in usb_glue_mcx. --- .../drivers/usb/cherryusb/port/kinetis/usb_glue_mcx.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/drivers/usb/cherryusb/port/kinetis/usb_glue_mcx.c b/components/drivers/usb/cherryusb/port/kinetis/usb_glue_mcx.c index bdd03314d34..4ae73f1ca06 100644 --- a/components/drivers/usb/cherryusb/port/kinetis/usb_glue_mcx.c +++ b/components/drivers/usb/cherryusb/port/kinetis/usb_glue_mcx.c @@ -82,4 +82,12 @@ void usb_dc_low_level_deinit(uint8_t busid) void usbd_kinetis_delay_ms(uint8_t ms) { +#ifdef __RTTHREAD__ + rt_thread_mdelay(ms); +#else + for (uint32_t i = 0; i < ms; i++) + { + for (volatile uint32_t j = 0; j < 10000; j++); + } +#endif } \ No newline at end of file