From c8f24ec1d0123a78e6aa3e868b675ed32821d83d Mon Sep 17 00:00:00 2001 From: Alexander Bushnev Date: Fri, 6 Dec 2024 19:07:03 +0100 Subject: [PATCH] README update --- README.md | 51 ++++++++++++++++++++++++++++++----- src/system/rpi_pico/network.c | 2 ++ 2 files changed, 46 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index abc0fe0d0..2c545129b 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ Currently, zenoh-pico provides support for the following (RT)OSs and protocols: | **OpenCR** | UDP (unicast and multicast), TCP | IPv4 | WiFi | | **Emscripten** | Websocket | IPv4, IPv6 | WiFi, Ethernet | | **FreeRTOS-Plus-TCP** | UDP (unicast), TCP | IPv4 | Ethernet | -| **Raspberry Pi Pico** | UDP (unicast and multicast), TCP | IPv4 | WiFi (for "W" version), Serial | +| **Raspberry Pi Pico** | UDP (unicast and multicast), TCP | IPv4 | WiFi (for "W" version), Serial, USB (CDC) | Check the website [zenoh.io](http://zenoh.io) and the [roadmap](https://github.com/eclipse-zenoh/roadmap) for more detailed information. @@ -361,12 +361,12 @@ git submodule update --init ``` Setup and build the examples: - `PICO_BOARD` - Pico board type: pico, pico_w, pico2, pico2_w (default: pico_w) - `WIFI_SSID` - Wi-Fi network SSID - `WIFI_PASSWORD` - Wi-Fi password - `ZENOH_CONFIG_MODE` - client or peer mode (default: client) - `ZENOH_CONFIG_CONNECT` - connect endpoint (only for client mode, optional) - `ZENOH_CONFIG_LISTEN` - listen endpoint (only for peer mode, optional) +- `PICO_BOARD` - Pico board type: pico, pico_w, pico2, pico2_w (default: pico_w) +- `WIFI_SSID` - Wi-Fi network SSID +- `WIFI_PASSWORD` - Wi-Fi password +- `ZENOH_CONFIG_MODE` - client or peer mode (default: client) +- `ZENOH_CONFIG_CONNECT` - connect endpoint (only for client mode, optional) +- `ZENOH_CONFIG_LISTEN` - listen endpoint (only for peer mode, optional) ```bash cd examples/rpi_pico @@ -376,6 +376,43 @@ cmake --build ./build To flash the Raspberry Pi Pico board, connect it in bootloader mode (it will appear as a removable drive) and copy the generated .uf2 file onto it. +**Serial connection**: + +To connect via UART specify pins or predefined device name and baud rate: + +e.g. +``` +-DZENOH_CONFIG_CONNECT="serial/0.1#baudrate=38400" +-DZENOH_CONFIG_CONNECT="serial/uart1_0#baudrate=38400" +``` + +Valid PIN combinations and associated device names: + +| **PINS** | **Device name** | +|---------:|:---------------:| +| 0.1 | uart0_0 | +| 4.5 | uart1_0 | +| 8.9 | uart1_1 | +| 12.13 | uart0_1 | +| 16.17 | uart0_2 | + + +**USB Serial connection (experemental)**: + +To connect via USB CDC, specify `usb` device: + +e.g. +``` +-DZENOH_CONFIG_CONNECT="serial/usb#baudrate=112500" +``` + +On the host Zenoh, specify the USB CDC device: + +e.g. +``` +zenohd -l serial//dev/ttyACM1#baudrate=112500 +``` + ## 3. Running the Examples The simplest way to run some of the example is to get a Docker image of the **zenoh** router (see [http://zenoh.io/docs/getting-started/quick-test/](http://zenoh.io/docs/getting-started/quick-test/)) and then to run the examples on your machine. diff --git a/src/system/rpi_pico/network.c b/src/system/rpi_pico/network.c index db1091986..135d05c84 100644 --- a/src/system/rpi_pico/network.c +++ b/src/system/rpi_pico/network.c @@ -522,6 +522,7 @@ z_result_t _z_open_serial_from_pins(_z_sys_net_socket_t *sock, uint32_t txpin, u } if (sock->_serial == NULL) { + _Z_ERROR("invalid pin combination"); return _Z_ERR_INVALID; } @@ -555,6 +556,7 @@ z_result_t _z_open_serial_from_dev(_z_sys_net_socket_t *sock, char *dev, uint32_ } if (sock->_serial == NULL) { + _Z_ERROR("invalid device name"); return _Z_ERR_INVALID; }