diff --git a/examples/rpi_pico/CMakeLists.txt b/examples/rpi_pico/CMakeLists.txt index 7ae847c02..8cf1b42e1 100644 --- a/examples/rpi_pico/CMakeLists.txt +++ b/examples/rpi_pico/CMakeLists.txt @@ -142,20 +142,22 @@ function(add_example name) ) if(ZENOH_USB_UART) pico_enable_stdio_uart(${name} 1) + pico_enable_stdio_usb(${name} 0) else() + pico_enable_stdio_uart(${name} 0) pico_enable_stdio_usb(${name} 1) endif() pico_add_extra_outputs(${name}) endfunction() -add_example(z_get) +#add_example(z_get) add_example(z_pub) -add_example(z_pub_st) -add_example(z_pub_thr) -add_example(z_pull) -add_example(z_put) -add_example(z_queryable) -add_example(z_scout) -add_example(z_sub) -add_example(z_sub_st) -add_example(z_sub_thr) +#add_example(z_pub_st) +#add_example(z_pub_thr) +#add_example(z_pull) +#add_example(z_put) +#add_example(z_queryable) +#add_example(z_scout) +#add_example(z_sub) +#add_example(z_sub_st) +#add_example(z_sub_thr) diff --git a/examples/rpi_pico/main.c b/examples/rpi_pico/main.c index 253b81541..5184f6b91 100644 --- a/examples/rpi_pico/main.c +++ b/examples/rpi_pico/main.c @@ -44,7 +44,7 @@ void print_ip_address() { void main_task(void *params) { (void)params; - vTaskDelay(pdMS_TO_TICKS(1000)); + vTaskDelay(pdMS_TO_TICKS(3000)); #if WIFI_SUPPORT_ENABLED if (cyw43_arch_init()) { printf("Failed to initialise\n"); diff --git a/src/system/rpi_pico/usb_uart.c b/src/system/rpi_pico/usb_uart.c index 19e86cd62..3a00c02c1 100644 --- a/src/system/rpi_pico/usb_uart.c +++ b/src/system/rpi_pico/usb_uart.c @@ -13,6 +13,7 @@ // #include "zenoh-pico/system/platform.h" +#include "zenoh-pico/utils/logging.h" #if Z_FEATURE_LINK_SERIAL == 1 && Z_FEATURE_LINK_SERIAL_USB == 1 @@ -20,6 +21,9 @@ #include "tusb.h" // ===== USB descriptors ===== +// Copied from +// https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2_common/pico_stdio_usb/stdio_usb_descriptors.c +// #ifndef USBD_VID #define USBD_VID (0x2E8A) // Raspberry Pi #endif @@ -180,6 +184,7 @@ static void *_z_usb_uart_task_proc(void *) { _z_mutex_unlock(&_z_usb_uart_mutex); z_sleep_ms(1); } + return NULL; } void _z_usb_uart_init() { @@ -187,7 +192,10 @@ void _z_usb_uart_init() { _z_mutex_init(&_z_usb_uart_mutex); _z_usb_uart_task_run = true; _z_task_init(&_z_usb_uart_task, NULL, &_z_usb_uart_task_proc, NULL); - z_sleep_s(10); + _Z_DEBUG("whating for host..."); + while (!tud_cdc_connected()) { + z_sleep_ms(100); + } } void _z_usb_uart_deinit() {