From 7c5edcdf9e0a6c6e131d9e45ad357fa0757a5584 Mon Sep 17 00:00:00 2001 From: scrapforge <99104728+scrapforge@users.noreply.github.com> Date: Thu, 26 Oct 2023 14:48:17 +0200 Subject: [PATCH] Fix of unknown Ringbuffer and not found USB-Serial Device (#125) * Added Ringbuffer-config in prj.conf for eliminating error * Added Label CDC_ACM_0 label with an overlay so "modules/libmicroros/microros_transports/serial-usb/microros_transports.c" can find the device * Update app.overlay * Update app.overlay A fix for backwards compability * Update app.overlay * Update app.overlay * Update prj.conf * Better comments * Changed settings to conditional from transport choice * Update prj.conf Co-authored-by: Pablo Garrido * Update modules/libmicroros/Kconfig Co-authored-by: Pablo Garrido --------- Co-authored-by: scrapforge Co-authored-by: Pablo Garrido --- app.overlay | 16 ++++++++++++++++ modules/libmicroros/Kconfig | 20 ++++++++++++++++---- prj.conf | 6 ------ 3 files changed, 32 insertions(+), 10 deletions(-) create mode 100644 app.overlay diff --git a/app.overlay b/app.overlay new file mode 100644 index 0000000..15cc0b0 --- /dev/null +++ b/app.overlay @@ -0,0 +1,16 @@ +/*Added these lines for compability with Zephyr v2.7*/ +zephyr_udc0: &usbotg_fs { + pinctrl-0 = <&usb_otg_fs_dm_pa11 &usb_otg_fs_dp_pa12 + &usb_otg_fs_id_pa10>; + pinctrl-names = "default"; + status = "okay"; +}; +/* End of compability part */ + + +&zephyr_udc0 { + cdc_acm_uart0: cdc_acm_uart0 { + compatible = "zephyr,cdc-acm-uart"; + label = "CDC_ACM_0"; + }; +}; diff --git a/modules/libmicroros/Kconfig b/modules/libmicroros/Kconfig index b6e9cb3..d918025 100644 --- a/modules/libmicroros/Kconfig +++ b/modules/libmicroros/Kconfig @@ -18,10 +18,11 @@ if MICROROS config MICROROS_TRANSPORT_SERIAL bool "micro-ROS serial transport" - + select RING_BUFFER config MICROROS_TRANSPORT_SERIAL_USB bool "micro-ROS USB serial transport" - + select RING_BUFFER + select USB_DEVICE_STACK config MICROROS_TRANSPORT_UDP bool "micro-ROS UDP network transport" @@ -64,7 +65,18 @@ if MICROROS micro-ROS Agent IP. endif - + if MICROROS_TRANSPORT_SERIAL_USB + config USB_CDC_ACM + bool + default y + config USB_CDC_ACM_RINGBUF_SIZE + int "USB-CDC-ACM Ringbuffer size" + default "2048" + config USB_DEVICE_PRODUCT + string "USB Device Product" + default "Zephyr micro-ROS" + + endif config MICROROS_NODES string "available micro-ROS nodes" default "1" @@ -98,4 +110,4 @@ if MICROROS default "4" endif - \ No newline at end of file + diff --git a/prj.conf b/prj.conf index ccb67ed..aa11d31 100644 --- a/prj.conf +++ b/prj.conf @@ -13,13 +13,7 @@ CONFIG_APP_LINK_WITH_POSIX_SUBSYS=y CONFIG_POSIX_CLOCK=y CONFIG_STDOUT_CONSOLE=y -CONFIG_USB_DEVICE_STACK=y -CONFIG_USB_DEVICE_PRODUCT="Zephyr micro-ROS" CONFIG_LOG=y -CONFIG_USB_CDC_ACM=y CONFIG_SERIAL=y CONFIG_UART_INTERRUPT_DRIVEN=y CONFIG_UART_LINE_CTRL=y -CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y -CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y -CONFIG_USB_CDC_ACM_RINGBUF_SIZE=2048