boards: ct: ctcc: add ctcc/nrf52840 board definition
Adds CTHINGS.CO Connectivity Card nRF52840 (ctcc/nrf52840) board support. Signed-off-by: Jan Kowalewski <jkowalewski@cthings.co>
This commit is contained in:
parent
e2c9efc4c9
commit
c698ca6f4d
12 changed files with 430 additions and 0 deletions
21
boards/ct/ctcc/Kconfig
Normal file
21
boards/ct/ctcc/Kconfig
Normal file
|
@ -0,0 +1,21 @@
|
|||
# CTHINGS.CO Connectivity Card board configuration
|
||||
|
||||
# Copyright (c) 2024 CTHINGS.CO
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
if BOARD_CTCC
|
||||
|
||||
if BOARD_CTCC_NRF52840
|
||||
|
||||
config BOARD_ENABLE_DCDC
|
||||
bool "DCDC mode"
|
||||
select SOC_DCDC_NRF52X
|
||||
default y
|
||||
|
||||
config BOARD_SERIAL_BACKEND_CDC_ACM
|
||||
bool "USB CDC"
|
||||
default y
|
||||
|
||||
endif # BOARD_CTCC_NRF52840
|
||||
|
||||
endif # BOARD_CTCC
|
7
boards/ct/ctcc/Kconfig.ctcc
Normal file
7
boards/ct/ctcc/Kconfig.ctcc
Normal file
|
@ -0,0 +1,7 @@
|
|||
# CTHINGS.CO Connectivity Card board configuration
|
||||
|
||||
# Copyright (c) 2024 CTHINGS.CO
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
config BOARD_CTCC
|
||||
select SOC_NRF52840_QIAA if BOARD_CTCC_NRF52840
|
58
boards/ct/ctcc/Kconfig.defconfig
Normal file
58
boards/ct/ctcc/Kconfig.defconfig
Normal file
|
@ -0,0 +1,58 @@
|
|||
# CTHINGS.CO Connectivity Card board configuration
|
||||
|
||||
# Copyright (c) 2024 CTHINGS.CO
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
if BOARD_CTCC_NRF52840
|
||||
|
||||
if BOARD_SERIAL_BACKEND_CDC_ACM
|
||||
|
||||
config USB_DEVICE_STACK
|
||||
default y
|
||||
|
||||
config USB_CDC_ACM
|
||||
default SERIAL
|
||||
|
||||
config CONSOLE
|
||||
default y
|
||||
|
||||
config UART_CONSOLE
|
||||
default CONSOLE
|
||||
|
||||
config USB_DEVICE_INITIALIZE_AT_BOOT
|
||||
default y if !MCUBOOT && CONSOLE
|
||||
|
||||
config USB_DEVICE_REMOTE_WAKEUP
|
||||
default n
|
||||
|
||||
if LOG
|
||||
|
||||
# Turn off logging for USB CDC ACM
|
||||
choice USB_CDC_ACM_LOG_LEVEL_CHOICE
|
||||
default USB_CDC_ACM_LOG_LEVEL_OFF
|
||||
endchoice
|
||||
|
||||
# Turn off logging for USB Device
|
||||
choice USB_DEVICE_LOG_LEVEL_CHOICE
|
||||
default USB_DEVICE_LOG_LEVEL_OFF
|
||||
endchoice
|
||||
|
||||
# Wait 5s at startup for logging
|
||||
config LOG_PROCESS_THREAD_STARTUP_DELAY_MS
|
||||
default 5000
|
||||
|
||||
endif # LOG
|
||||
|
||||
if USB_DEVICE_STACK
|
||||
|
||||
config SERIAL
|
||||
default y
|
||||
|
||||
endif # USB_DEVICE_STACK
|
||||
|
||||
endif # BOARD_SERIAL_BACKEND_CDC_ACM
|
||||
|
||||
config BT_CTLR
|
||||
default BT
|
||||
|
||||
endif # BOARD_CTCC_NRF52840
|
6
boards/ct/ctcc/board.cmake
Normal file
6
boards/ct/ctcc/board.cmake
Normal file
|
@ -0,0 +1,6 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
board_runner_args(nrfjprog "--softreset")
|
||||
board_runner_args(pyocd "--target=nrf52840" "--frequency=4000000")
|
||||
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
|
||||
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
|
4
boards/ct/ctcc/board.yml
Normal file
4
boards/ct/ctcc/board.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
board:
|
||||
name: ctcc
|
||||
socs:
|
||||
- name: nrf52840
|
91
boards/ct/ctcc/ctcc_nrf52840.dts
Normal file
91
boards/ct/ctcc/ctcc_nrf52840.dts
Normal file
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* Copyright (c) 2024 CTHINGS.CO
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
#include <nordic/nrf52840_qiaa.dtsi>
|
||||
|
||||
/ {
|
||||
model = "CTHINGS.CO Connectivity Card nRF52840";
|
||||
compatible = "ct,ctcc-nrf52840";
|
||||
|
||||
chosen {
|
||||
zephyr,console = &cdc_acm_uart;
|
||||
zephyr,shell-uart = &cdc_acm_uart;
|
||||
zephyr,uart-mcumgr = &cdc_acm_uart;
|
||||
zephyr,bt-mon-uart = &cdc_acm_uart;
|
||||
zephyr,bt-c2h-uart = &cdc_acm_uart;
|
||||
zephyr,sram = &sram0;
|
||||
zephyr,flash = &flash0;
|
||||
zephyr,code-partition = &slot0_partition;
|
||||
zephyr,ieee802154 = &ieee802154;
|
||||
};
|
||||
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
led1: led_1 {
|
||||
gpios = <&gpio0 23 GPIO_ACTIVE_LOW>;
|
||||
label = "LED 1";
|
||||
};
|
||||
led2: led_2 {
|
||||
gpios = <&gpio0 22 GPIO_ACTIVE_LOW>;
|
||||
label = "LED 2";
|
||||
};
|
||||
};
|
||||
|
||||
aliases {
|
||||
led0 = &led1;
|
||||
led1 = &led2;
|
||||
mcuboot-led0 = &led1;
|
||||
watchdog0 = &wdt0;
|
||||
};
|
||||
};
|
||||
|
||||
&flash0 {
|
||||
|
||||
partitions {
|
||||
compatible = "fixed-partitions";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
boot_partition: partition@0 {
|
||||
label = "mcuboot";
|
||||
reg = <0x00000000 0x00012000>;
|
||||
};
|
||||
slot0_partition: partition@12000 {
|
||||
label = "image-0";
|
||||
reg = <0x00012000 0x00076000>;
|
||||
};
|
||||
slot1_partition: partition@87000 {
|
||||
label = "image-1";
|
||||
reg = <0x00088000 0x00074000>;
|
||||
};
|
||||
storage_partition: partition@fc000 {
|
||||
label = "storage";
|
||||
reg = <0x000fc000 0x00004000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&gpiote {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&gpio0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&ieee802154 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
zephyr_udc0: &usbd {
|
||||
compatible = "nordic,nrf-usbd";
|
||||
status = "okay";
|
||||
|
||||
cdc_acm_uart: cdc_acm_uart {
|
||||
compatible = "zephyr,cdc-acm-uart";
|
||||
};
|
||||
};
|
15
boards/ct/ctcc/ctcc_nrf52840.yaml
Normal file
15
boards/ct/ctcc/ctcc_nrf52840.yaml
Normal file
|
@ -0,0 +1,15 @@
|
|||
identifier: ctcc/nrf52840
|
||||
name: CTHINGS.CO Connectivity Card nRF52840
|
||||
type: mcu
|
||||
arch: arm
|
||||
toolchain:
|
||||
- zephyr
|
||||
- gnuarmemb
|
||||
- xtools
|
||||
supported:
|
||||
- ble
|
||||
- gpio
|
||||
- usb_cdc
|
||||
- usb_device
|
||||
- watchdog
|
||||
vendor: ct
|
16
boards/ct/ctcc/ctcc_nrf52840_defconfig
Normal file
16
boards/ct/ctcc/ctcc_nrf52840_defconfig
Normal file
|
@ -0,0 +1,16 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Enable MPU
|
||||
CONFIG_ARM_MPU=y
|
||||
|
||||
# Enable hardware stack protection
|
||||
CONFIG_HW_STACK_PROTECTION=y
|
||||
|
||||
# Enable GPIO
|
||||
CONFIG_GPIO=y
|
||||
|
||||
# Board Kconfig.defconfig enables USB CDC ACM and should disable USB remote
|
||||
# wakeup by default. It needs to be disabled here, because the USB nrfx
|
||||
# driver always overwrites option from Kconfig mentioned above with the
|
||||
# imply from CONFIG_USB_NRFX.
|
||||
CONFIG_USB_DEVICE_REMOTE_WAKEUP=n
|
BIN
boards/ct/ctcc/doc/img/ctcc_nrf52840.webp
Normal file
BIN
boards/ct/ctcc/doc/img/ctcc_nrf52840.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
195
boards/ct/ctcc/doc/index.rst
Normal file
195
boards/ct/ctcc/doc/index.rst
Normal file
|
@ -0,0 +1,195 @@
|
|||
.. _ctcc_nrf52840:
|
||||
|
||||
CTHINGS.CO Connectivity Card nRF52840
|
||||
#####################################
|
||||
|
||||
Overview
|
||||
********
|
||||
|
||||
The Connectivity Card nRF52840 enables BLE and IEEE 802.15.4 connectivity
|
||||
over mPCIe or M.2 using USB port with on-board nRF52840 SoC.
|
||||
|
||||
This board has following features:
|
||||
|
||||
* CLOCK
|
||||
* FLASH
|
||||
* :abbr:`GPIO (General Purpose Input Output)`
|
||||
* :abbr:`MPU (Memory Protection Unit)`
|
||||
* :abbr:`NVIC (Nested Vectored Interrupt Controller)`
|
||||
* RADIO (Bluetooth Low Energy and 802.15.4)
|
||||
* :abbr:`RTC (nRF RTC System Clock)`
|
||||
* :abbr:`USB (Universal Serial Bus)`
|
||||
* :abbr:`WDT (Watchdog Timer)`
|
||||
|
||||
.. figure:: img/ctcc_nrf52840.webp
|
||||
:align: center
|
||||
:width: 300
|
||||
:alt: CTCC nRF52840
|
||||
|
||||
ctcc/nrf52840 board target
|
||||
|
||||
More information about the board can be found at the
|
||||
`ctcc_nrf52840 Website`_ and for SoC information: `Nordic Semiconductor Infocenter`_.
|
||||
|
||||
Hardware
|
||||
********
|
||||
|
||||
The ``ctcc/nrf52840`` board target has one external oscillator of the 32.768 kHz.
|
||||
|
||||
Supported Features
|
||||
==================
|
||||
|
||||
The ``ctcc/nrf52840`` board target supports the following
|
||||
hardware features:
|
||||
|
||||
+-----------+------------+----------------------+
|
||||
| Interface | Controller | Driver/Component |
|
||||
+===========+============+======================+
|
||||
| CLOCK | on-chip | clock_control |
|
||||
+-----------+------------+----------------------+
|
||||
| FLASH | on-chip | flash |
|
||||
+-----------+------------+----------------------+
|
||||
| GPIO | on-chip | gpio |
|
||||
+-----------+------------+----------------------+
|
||||
| MPU | on-chip | arch/arm |
|
||||
+-----------+------------+----------------------+
|
||||
| NVIC | on-chip | arch/arm |
|
||||
+-----------+------------+----------------------+
|
||||
| RADIO | on-chip | Bluetooth, |
|
||||
| | | ieee802154 |
|
||||
+-----------+------------+----------------------+
|
||||
| RTC | on-chip | system clock |
|
||||
+-----------+------------+----------------------+
|
||||
| USB | on-chip | usb |
|
||||
+-----------+------------+----------------------+
|
||||
| WDT | on-chip | watchdog |
|
||||
+-----------+------------+----------------------+
|
||||
|
||||
Connections and IOs
|
||||
===================
|
||||
|
||||
LED
|
||||
---
|
||||
|
||||
Note that board does not have on-board LEDs, however it exposes
|
||||
LED signals on mPCIe/M.2 pins.
|
||||
|
||||
* LED1 = P0.23
|
||||
* LED2 = P0.22
|
||||
|
||||
Programming and Debugging
|
||||
*************************
|
||||
|
||||
Applications for the ``ctcc/nrf52840`` board target can be
|
||||
built in the usual way (see :ref:`build_an_application` for more details).
|
||||
|
||||
Flashing
|
||||
========
|
||||
|
||||
The board supports the following programming options:
|
||||
|
||||
1. Using an external :ref:`debug probe <debug-probes>`
|
||||
2. Using MCUboot with DFU support
|
||||
|
||||
Option 1: Using an External Debug Probe
|
||||
---------------------------------------
|
||||
|
||||
Connectivity Card can be programmed using an external debug probe (Segger J-Link) by connecting
|
||||
to on-board SWD test pads.
|
||||
|
||||
For Segger J-Link debug probes, follow the instructions in the
|
||||
:ref:`nordic_segger` page to install and configure all the necessary
|
||||
software. Further information can be found in :ref:`nordic_segger_flashing`.
|
||||
|
||||
Then build and flash applications as usual (see :ref:`build_an_application` and
|
||||
:ref:`application_run` for more details).
|
||||
|
||||
Here is an example for the :zephyr:code-sample:`usb-cdc-acm-console` application which prints out
|
||||
logs on emulated USB port.
|
||||
|
||||
.. zephyr-app-commands::
|
||||
:zephyr-app: samples/subsys/usb/console
|
||||
:board: ctcc/nrf52840
|
||||
:goals: build flash
|
||||
|
||||
Debugging
|
||||
=========
|
||||
|
||||
The ``ctcc/nrf52840`` board target does not have an on-board J-Link debug IC, however
|
||||
instructions from the :ref:`nordic_segger` page also apply to this board,
|
||||
with the additional step of connecting an external debugger.
|
||||
|
||||
Option 2: Using MCUboot with DFU support
|
||||
----------------------------------------
|
||||
|
||||
It is also possible to use the MCUboot bootloader with DFU support to flash
|
||||
Zephyr applications. You need to flash MCUboot with DFU support and fill in slot0 with
|
||||
some application one-time using Option 1. Then you can re-flash an application using DFU utility
|
||||
by loading images to slot1. Note, it's not possible to have only MCUboot and load directly
|
||||
software to slot0 due to DFU implementation in Zephyr, which for present slot0 and slot1 in flash
|
||||
map, it assumes only slot1 partition as writeable.
|
||||
|
||||
Install ``dfu-util`` first and make sure MCUboot's ``imgtool`` is
|
||||
available for signing your binary for MCUboot as described on :ref:`west-sign`.
|
||||
|
||||
Next, do the **one-time setup** to flash MCUboot with DFU support.
|
||||
We'll assume you've cloned the `MCUboot`_ as a submodule when initializing
|
||||
Zephyr repositories using :ref:`west` tool.
|
||||
|
||||
#. Compile MCUboot as a Zephyr application with DFU support.
|
||||
|
||||
.. zephyr-app-commands::
|
||||
:app: mcuboot/boot/zephyr
|
||||
:board: ctcc/nrf52840
|
||||
:build-dir: mcuboot
|
||||
:goals: build
|
||||
:gen-args: -DCONFIG_BOOT_USB_DFU_WAIT=y
|
||||
|
||||
#. Flash it onto the board as described in Option 1.
|
||||
|
||||
#. Flash other Zephyr application to fill in slot0 e.g:
|
||||
|
||||
.. zephyr-app-commands::
|
||||
:app: samples/subsys/usb/dfu
|
||||
:board: ctcc/nrf52840
|
||||
:build-dir: dfu
|
||||
:goals: build
|
||||
:gen-args: -DCONFIG_BOOTLOADER_MCUBOOT=y -DCONFIG_MCUBOOT_SIGNATURE_KEY_FILE=\"path/to/mcuboot/boot/root-rsa-2048.pem\"
|
||||
|
||||
You can now flash a Zephyr application to the board using DFU util.
|
||||
As an example we'll use the :zephyr:code-sample:`usb-cdc-acm-console` sample.
|
||||
|
||||
.. zephyr-app-commands::
|
||||
:zephyr-app: samples/subsys/usb/console
|
||||
:board: ctcc/nrf52840
|
||||
:goals: build flash
|
||||
:gen-args: -DCONFIG_BOOTLOADER_MCUBOOT=y -DCONFIG_MCUBOOT_SIGNATURE_KEY_FILE=\"path/to/mcuboot/boot/root-rsa-2048.pem\"
|
||||
|
||||
.. note::
|
||||
|
||||
In all examples it is assumed to use default `root-rsa-2048.pem` file from ``mcuboot/boot``
|
||||
directory. Providing certificate in build args produces signed binary automatically.
|
||||
Do not use this certificate in your production firmware!
|
||||
|
||||
#. Plug in ``ctcc/nrf52840`` card to mPCIe/M.2 slot or use mPCIe/M.2 adapter to USB
|
||||
and plug such adapter to USB port.
|
||||
|
||||
You should see ``NordicSemiconductor MCUBOOT`` or ``NordicSemiconductor Zephyr DFU sample``
|
||||
(if you flashed `dfu` sample to slot0) device once plugging it into host
|
||||
USB port. You can check that on Linux system by entering ``lsusb`` command.
|
||||
|
||||
To check if DFU device is visible you can enter ``sudo dfu-util -l`` command. Once the
|
||||
device is visible you can flash Zephyr image using DFU util: ``sudo dfu-util --alt 1 --download build/zephyr/zephyr.signed.bin``
|
||||
|
||||
|
||||
References
|
||||
**********
|
||||
|
||||
.. target-notes::
|
||||
|
||||
.. _ctcc_nrf52840 Website:
|
||||
https://cthings.co/products/connectivity-cards
|
||||
.. _Nordic Semiconductor Infocenter:
|
||||
https://infocenter.nordicsemi.com
|
||||
.. _MCUboot:
|
||||
https://github.com/JuulLabs-OSS/mcuboot
|
7
boards/ct/ctcc/pre_dt_board.cmake
Normal file
7
boards/ct/ctcc/pre_dt_board.cmake
Normal file
|
@ -0,0 +1,7 @@
|
|||
# Copyright (c) 2022 Nordic Semiconductor
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Suppress "unique_unit_address_if_enabled" to handle the following overlaps:
|
||||
# - power@40000000 & clock@40000000 & bprot@40000000
|
||||
# - acl@4001e000 & flash-controller@4001e000
|
||||
list(APPEND EXTRA_DTC_FLAGS "-Wno-unique_unit_address_if_enabled")
|
10
boards/ct/index.rst
Normal file
10
boards/ct/index.rst
Normal file
|
@ -0,0 +1,10 @@
|
|||
.. _boards-ct:
|
||||
|
||||
CTHINGS.CO
|
||||
##########
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
:glob:
|
||||
|
||||
**/*
|
Loading…
Add table
Add a link
Reference in a new issue