diff --git a/examples/device/cdc_dual_ports/src/tusb_config.h b/examples/device/cdc_dual_ports/src/tusb_config.h index ea059f08a..90805397a 100644 --- a/examples/device/cdc_dual_ports/src/tusb_config.h +++ b/examples/device/cdc_dual_ports/src/tusb_config.h @@ -59,7 +59,7 @@ #endif #ifndef CFG_TUSB_DEBUG -#define CFG_TUSB_DEBUG 3 +#define CFG_TUSB_DEBUG 0 #endif #ifdef CFG_TUSB_DEBUG #define CFG_TUSB_DEBUG_PRINTF rt_kprintf diff --git a/examples/device/net_lwip_webserver/src/lwipopts.h b/examples/device/net_lwip_webserver/src/lwipopts.h index c02baf47d..85028585b 100644 --- a/examples/device/net_lwip_webserver/src/lwipopts.h +++ b/examples/device/net_lwip_webserver/src/lwipopts.h @@ -379,7 +379,7 @@ #define TCPIP_THREAD_STACKSIZE RT_LWIP_TCPTHREAD_STACKSIZE #else #define TCPIP_MBOX_SIZE 8 -#define TCPIP_THREAD_PRIO 128 +#define TCPIP_THREAD_PRIO 7 #define TCPIP_THREAD_STACKSIZE 4096 #endif #define TCPIP_THREAD_NAME "tcpip" diff --git a/examples/device/net_lwip_webserver/src/main.c b/examples/device/net_lwip_webserver/src/main.c index 4d44562f4..c12c0a31e 100644 --- a/examples/device/net_lwip_webserver/src/main.c +++ b/examples/device/net_lwip_webserver/src/main.c @@ -116,7 +116,7 @@ static err_t linkoutput_fn(struct netif *netif, struct pbuf *p) { tud_network_xmit(p, 0 /* unused for this example */); return ERR_OK; } - + return ERR_USE; /* transfer execution to TinyUSB in the hopes that it will finish transmitting the prior packet */ /*rc: if use rtos, this function still will be called? */ // tud_task(); @@ -195,6 +195,7 @@ bool dns_query_proc(const char *name, ip4_addr_t *addr) { } bool tud_network_recv_cb(const uint8_t *src, uint16_t size) { + err_t err = ERR_OK; struct netif *netif = &netif_data; if (size) { @@ -212,8 +213,8 @@ bool tud_network_recv_cb(const uint8_t *src, uint16_t size) { // Only call pbuf_free if not Ok else it will panic with "pbuf_free: p->ref > 0" // or steal it from whatever took ownership of it with undefined consequences. // See: https://savannah.nongnu.org/patch/index.php?10121 - if (netif->input(p, netif) != ERR_OK) { - TU_LOG(2,"ERROR: netif input failed\n"); + if (err=netif->input(p, netif),err != ERR_OK) { + rt_kprintf("ERROR: netif input failed, err=%d\n", err); pbuf_free(p); } // Signal tinyusb that the current frame has been processed. @@ -290,9 +291,9 @@ void usb_irq_enable(){ static void tusb_thread_entry(void *parameter) { - (void) parameter; - while (1) - { + TU_LOG(2, "TinyUSB task started\n"); + (void) parameter; + while (1) { #if CFG_TUH_ENABLED tuh_task(); #endif @@ -349,9 +350,9 @@ int init_tinyusb(void) { #endif #if CFG_TUD_NCM - TU_LOG(2,"USB NCM network interface initialized\n"); + rt_kprintf("USB NCM network interface initialized\n"); #elif CFG_TUD_ECM_RNDIS - TU_LOG(2,"USB RNDIS/ECM network interface initialized\n"); + rt_kprintf("USB RNDIS/ECM network interface initialized\n"); #endif #ifdef RT_USING_HEAP diff --git a/examples/device/net_lwip_webserver/src/tusb_config.h b/examples/device/net_lwip_webserver/src/tusb_config.h index 0befbb365..4d5dbf5ae 100644 --- a/examples/device/net_lwip_webserver/src/tusb_config.h +++ b/examples/device/net_lwip_webserver/src/tusb_config.h @@ -64,6 +64,9 @@ extern "C" { #ifndef CFG_TUSB_DEBUG #define CFG_TUSB_DEBUG 3 #endif +#ifdef CFG_TUSB_DEBUG +#define CFG_TUSB_DEBUG_PRINTF rt_kprintf +#endif /* CFG_TUSB_DEBUG */ // Enable Device stack #define CFG_TUD_ENABLED 1