Skip to content

Commit

Permalink
samples: Add USB to UART bridge
Browse files Browse the repository at this point in the history
Adds USB to UART bridge intended for PCA20035.

Signed-off-by: Jan Tore Guggedal <jantore.guggedal@nordicsemi.no>
Signed-off-by: Bernt Johan Damslora <bernt.johan.damslora@nordicsemi.no>
  • Loading branch information
bjda authored and carlescufi committed Sep 19, 2019
1 parent 5ffa5b7 commit f4c2c52
Show file tree
Hide file tree
Showing 7 changed files with 385 additions and 0 deletions.
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ subsys/debug/CMakeLists.txt @nordic-krch
/samples/nrf9160/ @rlubos @lemrey
/samples/nrf9160/spm/ @lemrey @hakonfam @ioannisg
/samples/profiler/ @pdunaj @pizi-nordic
/samples/usb/usb_uart_bridge/ @joakimtoe @jtguggedal
/samples/CMakeLists.txt @SebastianBoe
/scripts/ @mbolivar @tejlmand
/scripts/hid_configurator/ @pdunaj
Expand Down
1 change: 1 addition & 0 deletions doc/nrf/samples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@ In addition, the |NCS| provides the following samples that showcase the use of a
../../samples/*/README
../../samples/debug/*/README
../../samples/sensor/*/README
../../samples/usb/*/README

For more complex examples, see :ref:`applications`.
15 changes: 15 additions & 0 deletions samples/usb/usb_uart_bridge/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#
# Copyright (c) 2018 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
#

cmake_minimum_required(VERSION 3.8.2)

include($ENV{ZEPHYR_BASE}/../nrf/cmake/boilerplate.cmake)

include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(NONE)

target_sources(app PRIVATE src/main.c)
zephyr_include_directories(src)
41 changes: 41 additions & 0 deletions samples/usb/usb_uart_bridge/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
.. _usb_uart_bridge_sample:

USB-UART bridge
###############

The USB-UART bridge acts as a serial adapter, exposing 2 UART pairs to a USB host as 2 CDC ACM devices.


Requirements
************

* One of the following development boards:

* Thingy:91 board (PCA20035)

* A USB host which can communicate with CDC ACM devices, like a Windows or Linux PC


Building and running
********************
.. |sample path| replace:: :file:`samples/usb/usb_uart_bridge`

.. include:: /includes/build_and_run.txt


Testing
=======

After programming the sample to your board, test it by performing the following steps:

1. Connect the board to the host via a USB cable
#. Observe that the CDC ACM devices enumerate on the USB host (Typically COM ports on Windows, /dev/tty* on Linux)
#. Use a serial client on the USB host to communicate over the board's UART pins


Dependencies
************

This sample uses the following Zephyr subsystems:

* :ref:`zephyr:usb_device_stack`
34 changes: 34 additions & 0 deletions samples/usb/usb_uart_bridge/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#General
CONFIG_REBOOT=y
CONFIG_HEAP_MEM_POOL_SIZE=16384
CONFIG_GPIO=y
CONFIG_POLL=y
CONFIG_BOOTLOADER_MCUBOOT=y

# USB
CONFIG_USB=y
CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DEVICE_MANUFACTURER="Nordic Semiconductor"
CONFIG_USB_DEVICE_PRODUCT="Thingy:91 UART"
CONFIG_USB_DEVICE_VID=0x1915
CONFIG_USB_DEVICE_PID=0x520F
CONFIG_USB_DEVICE_SN="PCA20035 12PLACEHLDRS"
CONFIG_USB_COMPOSITE_DEVICE=y
CONFIG_USB_CDC_ACM=y
CONFIG_USB_CDC_ACM_RINGBUF_SIZE=4096
CONFIG_USB_CDC_ACM_DEVICE_COUNT=2

# Logging
CONFIG_LOG=y
CONFIG_USE_SEGGER_RTT=y
CONFIG_LOG_BACKEND_RTT=y
CONFIG_LOG_BACKEND_RTT_MODE_DROP=y

# UART
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_UART_LINE_CTRL=y
CONFIG_UART_0_NRF_UARTE=y
CONFIG_UART_0_NRF_FLOW_CONTROL=n
CONFIG_UART_1_NRF_UARTE=y
CONFIG_UART_1_NRF_FLOW_CONTROL=n
9 changes: 9 additions & 0 deletions samples/usb/usb_uart_bridge/sample.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
sample:
description: USB-UART bridge sample
name: USB-UART bridge
tests:
test_build:
build_only: true
build_on_all: true
platform_whitelist: nrf52840_pca20035
tags: ci_build

0 comments on commit f4c2c52

Please sign in to comment.