add custom board for nrf52 dongle without usb
This commit is contained in:
4
boards/nrf52840dongle_no_usb/CMakeLists.txt
Normal file
4
boards/nrf52840dongle_no_usb/CMakeLists.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
zephyr_library()
|
||||
zephyr_library_sources(board.c)
|
||||
19
boards/nrf52840dongle_no_usb/Kconfig
Normal file
19
boards/nrf52840dongle_no_usb/Kconfig
Normal file
@@ -0,0 +1,19 @@
|
||||
# nRF52840 Dongle NRF52840 board configuration
|
||||
|
||||
# Copyright (c) 2018-2023 Nordic Semiconductor ASA
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
if BOARD_NRF52840DONGLE
|
||||
|
||||
config BOARD_HAS_NRF5_BOOTLOADER
|
||||
bool "Board has nRF5 bootloader"
|
||||
default y
|
||||
help
|
||||
If selected, applications are linked so that they can be loaded by Nordic
|
||||
nRF5 bootloader.
|
||||
|
||||
config BOARD_SERIAL_BACKEND_CDC_ACM
|
||||
bool "USB CDC"
|
||||
default y
|
||||
|
||||
endif # BOARD_NRF52840DONGLE
|
||||
83
boards/nrf52840dongle_no_usb/Kconfig.defconfig
Normal file
83
boards/nrf52840dongle_no_usb/Kconfig.defconfig
Normal file
@@ -0,0 +1,83 @@
|
||||
# nRF52840 Dongle NRF52840 board configuration
|
||||
#
|
||||
# Copyright (c) 2018-2023 Nordic Semiconductor ASA
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
if BOARD_NRF52840DONGLE
|
||||
|
||||
# To let the nRF5 bootloader load an application, the application
|
||||
# must be linked after Nordic MBR, that is factory-programmed on the board.
|
||||
|
||||
# Nordic nRF5 bootloader exists outside of the partitions specified in the
|
||||
# DTS file, so we manually override FLASH_LOAD_OFFSET to link the application
|
||||
# correctly, after Nordic MBR.
|
||||
|
||||
# When building MCUBoot, MCUBoot itself will select USE_DT_CODE_PARTITION
|
||||
# which will make it link into the correct partition specified in DTS file,
|
||||
# the offset is applied here so that the full partition size can be used when
|
||||
# the bootloader Kconfig option has been disabled.
|
||||
|
||||
config FLASH_LOAD_OFFSET
|
||||
default 0x1000
|
||||
depends on BOARD_HAS_NRF5_BOOTLOADER && (MCUBOOT || !USE_DT_CODE_PARTITION)
|
||||
|
||||
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 SHELL_BACKEND_SERIAL_CHECK_DTR
|
||||
default SHELL
|
||||
depends on UART_LINE_CTRL
|
||||
|
||||
config UART_LINE_CTRL
|
||||
default SHELL
|
||||
|
||||
config USB_DEVICE_REMOTE_WAKEUP
|
||||
default n
|
||||
|
||||
if LOG
|
||||
|
||||
# Logger cannot use itself to log
|
||||
choice USB_CDC_ACM_LOG_LEVEL_CHOICE
|
||||
default USB_CDC_ACM_LOG_LEVEL_OFF
|
||||
endchoice
|
||||
|
||||
# Set USB log level to error only
|
||||
choice USB_DEVICE_LOG_LEVEL_CHOICE
|
||||
default USB_DEVICE_LOG_LEVEL_ERR
|
||||
endchoice
|
||||
|
||||
# Wait 4000ms at startup for logging
|
||||
config LOG_PROCESS_THREAD_STARTUP_DELAY_MS
|
||||
default 4000
|
||||
|
||||
endif # LOG
|
||||
|
||||
if USB_DEVICE_STACK
|
||||
|
||||
# Enable UART driver, needed for CDC ACM
|
||||
config SERIAL
|
||||
default y
|
||||
|
||||
endif # USB_DEVICE_STACK
|
||||
|
||||
endif # BOARD_SERIAL_BACKEND_CDC_ACM
|
||||
|
||||
config BT_CTLR
|
||||
default BT
|
||||
|
||||
endif # BOARD_NRF52840DONGLE
|
||||
@@ -0,0 +1,7 @@
|
||||
# nRF52840 Dongle NRF52840 board configuration
|
||||
|
||||
# Copyright (c) 2018 Nordic Semiconductor ASA
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
config BOARD_NRF52840DONGLE_NO_USB
|
||||
select SOC_NRF52840_QIAA
|
||||
45
boards/nrf52840dongle_no_usb/board.c
Normal file
45
boards/nrf52840dongle_no_usb/board.c
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 2018 Nordic Semiconductor ASA.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <zephyr/init.h>
|
||||
#include <hal/nrf_power.h>
|
||||
|
||||
static int board_nrf52840dongle_nrf52840_init(void)
|
||||
{
|
||||
|
||||
/* if the nrf52840dongle_nrf52840 board is powered from USB
|
||||
* (high voltage mode), GPIO output voltage is set to 1.8 volts by
|
||||
* default and that is not enough to turn the green and blue LEDs on.
|
||||
* Increase GPIO voltage to 3.0 volts.
|
||||
*/
|
||||
if ((nrf_power_mainregstatus_get(NRF_POWER) ==
|
||||
NRF_POWER_MAINREGSTATUS_HIGH) &&
|
||||
((NRF_UICR->REGOUT0 & UICR_REGOUT0_VOUT_Msk) ==
|
||||
(UICR_REGOUT0_VOUT_DEFAULT << UICR_REGOUT0_VOUT_Pos))) {
|
||||
|
||||
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos;
|
||||
while (NRF_NVMC->READY == NVMC_READY_READY_Busy) {
|
||||
;
|
||||
}
|
||||
|
||||
NRF_UICR->REGOUT0 =
|
||||
(NRF_UICR->REGOUT0 & ~((uint32_t)UICR_REGOUT0_VOUT_Msk)) |
|
||||
(UICR_REGOUT0_VOUT_3V0 << UICR_REGOUT0_VOUT_Pos);
|
||||
|
||||
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos;
|
||||
while (NRF_NVMC->READY == NVMC_READY_READY_Busy) {
|
||||
;
|
||||
}
|
||||
|
||||
/* a reset is required for changes to take effect */
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
SYS_INIT(board_nrf52840dongle_nrf52840_init, PRE_KERNEL_1,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
|
||||
7
boards/nrf52840dongle_no_usb/board.cmake
Normal file
7
boards/nrf52840dongle_no_usb/board.cmake
Normal file
@@ -0,0 +1,7 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
board_runner_args(jlink "--device=nRF52840_xxAA" "--speed=4000")
|
||||
board_runner_args(pyocd "--target=nrf52840" "--frequency=4000000")
|
||||
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
|
||||
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
|
||||
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
|
||||
6
boards/nrf52840dongle_no_usb/board.yml
Normal file
6
boards/nrf52840dongle_no_usb/board.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
board:
|
||||
name: nrf52840dongle_no_usb
|
||||
full_name: nRF52840 Dongle no usb
|
||||
vendor: nordic
|
||||
socs:
|
||||
- name: nrf52840
|
||||
1991
boards/nrf52840dongle_no_usb/doc/img/nRF52840_dongle_press_reset.svg
Normal file
1991
boards/nrf52840dongle_no_usb/doc/img/nRF52840_dongle_press_reset.svg
Normal file
File diff suppressed because it is too large
Load Diff
|
After Width: | Height: | Size: 185 KiB |
BIN
boards/nrf52840dongle_no_usb/doc/img/nrf52840dongle_nrf52840.jpg
Normal file
BIN
boards/nrf52840dongle_no_usb/doc/img/nrf52840dongle_nrf52840.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 42 KiB |
348
boards/nrf52840dongle_no_usb/doc/index.rst
Normal file
348
boards/nrf52840dongle_no_usb/doc/index.rst
Normal file
@@ -0,0 +1,348 @@
|
||||
.. _nrf52840dongle_nrf52840:
|
||||
|
||||
nRF52840 Dongle
|
||||
###############
|
||||
|
||||
Overview
|
||||
********
|
||||
|
||||
The nRF52840 Dongle (PCA10059) hardware provides support for the Nordic
|
||||
Semiconductor nRF52840 ARM Cortex-M4F CPU and the following devices:
|
||||
|
||||
* :abbr:`ADC (Analog to Digital Converter)`
|
||||
* CLOCK
|
||||
* FLASH
|
||||
* :abbr:`GPIO (General Purpose Input Output)`
|
||||
* :abbr:`I2C (Inter-Integrated Circuit)`
|
||||
* :abbr:`MPU (Memory Protection Unit)`
|
||||
* :abbr:`NVIC (Nested Vectored Interrupt Controller)`
|
||||
* :abbr:`PWM (Pulse Width Modulation)`
|
||||
* RADIO (Bluetooth Low Energy and 802.15.4)
|
||||
* :abbr:`RTC (nRF RTC System Clock)`
|
||||
* :abbr:`SPI (Serial Peripheral Interface)`
|
||||
* :abbr:`UART (Universal asynchronous receiver-transmitter)`
|
||||
* :abbr:`USB (Universal Serial Bus)`
|
||||
* :abbr:`WDT (Watchdog Timer)`
|
||||
|
||||
.. figure:: img/nrf52840dongle_nrf52840.jpg
|
||||
:align: center
|
||||
:alt: nRF52840 Dongle
|
||||
|
||||
nRF52840 Dongle
|
||||
|
||||
More information about the board can be found at the
|
||||
`nRF52840 Dongle website`_. The `nRF52840 Dongle guide`_
|
||||
contains the processor's information and the datasheet.
|
||||
|
||||
|
||||
Hardware
|
||||
********
|
||||
|
||||
The ``nrf52840dongle/nrf52840`` has two external oscillators. The frequency of
|
||||
the slow clock is 32.768 kHz. The frequency of the main clock
|
||||
is 32 MHz.
|
||||
|
||||
Supported Features
|
||||
==================
|
||||
|
||||
The ``nrf52840dongle/nrf52840`` board configuration supports the following
|
||||
hardware features:
|
||||
|
||||
+-----------+------------+----------------------+
|
||||
| Interface | Controller | Driver/Component |
|
||||
+===========+============+======================+
|
||||
| ADC | on-chip | adc |
|
||||
+-----------+------------+----------------------+
|
||||
| CLOCK | on-chip | clock_control |
|
||||
+-----------+------------+----------------------+
|
||||
| FLASH | on-chip | flash |
|
||||
+-----------+------------+----------------------+
|
||||
| GPIO | on-chip | gpio |
|
||||
+-----------+------------+----------------------+
|
||||
| I2C(M) | on-chip | i2c |
|
||||
+-----------+------------+----------------------+
|
||||
| MPU | on-chip | arch/arm |
|
||||
+-----------+------------+----------------------+
|
||||
| NVIC | on-chip | arch/arm |
|
||||
+-----------+------------+----------------------+
|
||||
| PWM | on-chip | pwm |
|
||||
+-----------+------------+----------------------+
|
||||
| RADIO | on-chip | Bluetooth, |
|
||||
| | | ieee802154 |
|
||||
+-----------+------------+----------------------+
|
||||
| RTC | on-chip | system clock |
|
||||
+-----------+------------+----------------------+
|
||||
| SPI(M/S) | on-chip | spi |
|
||||
+-----------+------------+----------------------+
|
||||
| UART | on-chip | serial |
|
||||
+-----------+------------+----------------------+
|
||||
| USB | on-chip | usb |
|
||||
+-----------+------------+----------------------+
|
||||
| WDT | on-chip | watchdog |
|
||||
+-----------+------------+----------------------+
|
||||
|
||||
Other hardware features have not been enabled yet for this board.
|
||||
See `nRF52840 Dongle website`_ and `nRF52840 Dongle Hardware description`_
|
||||
for a complete list of nRF52840 Dongle board hardware features.
|
||||
|
||||
Connections and IOs
|
||||
===================
|
||||
|
||||
LED
|
||||
---
|
||||
|
||||
* LED0 (green) = P0.6
|
||||
* LED1 (red) = P0.8
|
||||
* LED1 (green) = P1.9
|
||||
* LED1 (blue) = P0.12
|
||||
|
||||
Push buttons
|
||||
------------
|
||||
|
||||
* BUTTON1 = SW1 = P1.6
|
||||
* RESET = SW2 = P0.18
|
||||
|
||||
Programming and Debugging
|
||||
*************************
|
||||
|
||||
Applications for the ``nrf52840dongle/nrf52840`` board configuration 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 the built-in bootloader only
|
||||
2. Using MCUboot in serial recovery mode
|
||||
3. Using an external :ref:`debug probe <debug-probes>`
|
||||
|
||||
These instructions use the :ref:`west <west>` tool and assume you are in the
|
||||
root directory of your :term:`west installation`.
|
||||
|
||||
Option 1: Using the Built-In Bootloader Only
|
||||
--------------------------------------------
|
||||
|
||||
The board is factory-programmed with Nordic's bootloader from Nordic's nRF5
|
||||
SDK. With this option, you'll use Nordic's `nrfutil`_ program to create
|
||||
firmware packages supported by this bootloader and flash them to the
|
||||
device. Make sure ``nrfutil`` is installed before proceeding.
|
||||
|
||||
#. Reset the board into the Nordic bootloader by pressing the RESET button.
|
||||
|
||||
The push button is on the far side of the board from the USB connector. Note
|
||||
that the button does not face up. You will have to push it from the outside
|
||||
in, towards the USB connector:
|
||||
|
||||
.. image:: img/nRF52840_dongle_press_reset.svg
|
||||
:alt: Location of RESET button and direction of push
|
||||
|
||||
The red LED should start a fade pattern, signalling the bootloader is
|
||||
running.
|
||||
|
||||
#. Compile a Zephyr application; we'll use :zephyr:code-sample:`blinky`.
|
||||
|
||||
.. zephyr-app-commands::
|
||||
:app: zephyr/samples/basic/blinky
|
||||
:board: nrf52840dongle/nrf52840
|
||||
:goals: build
|
||||
|
||||
#. Package the application for the bootloader using ``nrfutil``:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
nrfutil pkg generate --hw-version 52 --sd-req=0x00 \
|
||||
--application build/zephyr/zephyr.hex \
|
||||
--application-version 1 blinky.zip
|
||||
|
||||
#. Flash it onto the board. Note :file:`/dev/ttyACM0` is for Linux; it will be
|
||||
something like ``COMx`` on Windows, and something else on macOS.
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
nrfutil dfu usb-serial -pkg blinky.zip -p /dev/ttyACM0
|
||||
|
||||
When this command exits, observe the green LED on the board blinking,
|
||||
instead of the red LED used by the bootloader.
|
||||
|
||||
For more information, see `Nordic Semiconductor USB DFU`_.
|
||||
|
||||
Option 2: Using MCUboot in Serial Recovery Mode
|
||||
-----------------------------------------------
|
||||
|
||||
It is also possible to use the MCUboot bootloader with this board to flash
|
||||
Zephyr applications. You need to do some one-time set-up to build and flash
|
||||
MCUboot on your board. From that point on, you can build and flash other Zephyr
|
||||
applications using MCUboot's serial recovery mode. This process does not
|
||||
overwrite the built-in Nordic bootloader, so you can always go back to using
|
||||
Option 1 later.
|
||||
|
||||
Install `nrfutil`_ and `mcumgr`_ 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. We'll assume you've cloned
|
||||
the `MCUboot`_ repository into the directory ``mcuboot``, and that it is next
|
||||
to the zephyr repository on your computer.
|
||||
|
||||
#. Reset the board into the Nordic bootloader as described above.
|
||||
|
||||
#. Compile MCUboot as a Zephyr application.
|
||||
|
||||
.. zephyr-app-commands::
|
||||
:app: mcuboot/boot/zephyr
|
||||
:board: nrf52840dongle/nrf52840
|
||||
:build-dir: mcuboot
|
||||
:goals: build
|
||||
|
||||
#. Package the application for the bootloader using ``nrfutil``:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
nrfutil pkg generate --hw-version 52 --sd-req=0x00 \
|
||||
--application build/mcuboot/zephyr/zephyr.hex \
|
||||
--application-version 1 mcuboot.zip
|
||||
|
||||
#. Flash it onto the board. Note :file:`/dev/ttyACM0` is for Linux; it will be
|
||||
something like ``COMx`` on Windows, and something else on macOS.
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
nrfutil dfu usb-serial -pkg mcuboot.zip -p /dev/ttyACM0
|
||||
|
||||
You can now flash a Zephyr application to the board using MCUboot's serial
|
||||
recovery mode. We'll use the :zephyr:code-sample:`smp-svr` sample since it's ready to be
|
||||
compiled for chain-loading by MCUboot (and itself supports firmware updates
|
||||
over Bluetooth).
|
||||
|
||||
#. Boot into MCUboot serial recovery mode by plugging the board in with the SW1
|
||||
button pressed down. See above for a picture showing where SW1 is.
|
||||
|
||||
**Do not press RESET**; that will run the Nordic bootloader, which is
|
||||
different than MCUboot.
|
||||
|
||||
A serial port will enumerate on your board. On Windows, "MCUBOOT" should
|
||||
appear under "Other Devices" in the Device Manager (in addition to the usual
|
||||
``COMx`` device). On Linux, something like
|
||||
:file:`/dev/serial/by-id/usb-ZEPHYR_MCUBOOT_0.01-if00` should be created.
|
||||
|
||||
If no serial port appears, try plugging it in again, making sure SW1 is
|
||||
pressed. If it still doesn't appear, retry the one-time MCUboot setup.
|
||||
|
||||
#. Compile ``smp_svr``.
|
||||
|
||||
.. zephyr-app-commands::
|
||||
:app: zephyr/samples/subsys/mgmt/mcumgr/smp_svr
|
||||
:board: nrf52840dongle/nrf52840
|
||||
:build-dir: smp_svr
|
||||
:goals: build
|
||||
|
||||
#. Sign ``smp_svr`` for chain-loading by MCUboot.
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
west sign -t imgtool --bin --no-hex -d build/smp_svr \
|
||||
-B smp_svr.signed.bin -- --key mcuboot/root-rsa-2048.pem
|
||||
|
||||
#. Flash the application to the MCUboot serial port using ``mcumgr``:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
mcumgr --conntype=serial --connstring='dev=/dev/ttyACM0,baud=115200' \
|
||||
image upload -e smp_svr.signed.bin
|
||||
|
||||
#. Reset the device:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
mcumgr --conntype=serial --connstring='dev=/dev/ttyACM0,baud=115200' reset
|
||||
|
||||
You should now be able to scan for Bluetooth devices using a smartphone or
|
||||
computer. The device you just flashed will be listed with ``Zephyr`` in its
|
||||
name.
|
||||
|
||||
.. note::
|
||||
|
||||
This board supports building other Zephyr applications for flashing with
|
||||
MCUboot in this way also. Just make sure :kconfig:option:`CONFIG_BOOTLOADER_MCUBOOT`
|
||||
is set when building your application. For example, to compile blinky for
|
||||
loading by MCUboot, use this:
|
||||
|
||||
.. zephyr-app-commands::
|
||||
:app: zephyr/samples/basic/blinky
|
||||
:board: nrf52840dongle/nrf52840
|
||||
:build-dir: blinky
|
||||
:goals: build
|
||||
:gen-args: -DCONFIG_BOOTLOADER_MCUBOOT=y
|
||||
|
||||
You can then sign and flash it using the steps above.
|
||||
|
||||
Option 3: Using an External Debug Probe
|
||||
---------------------------------------
|
||||
|
||||
If you have one, you can also use an external :ref:`debug probe <debug-probes>`
|
||||
to flash and debug Zephyr applications, but you need to solder an SWD header
|
||||
onto the back side of the board.
|
||||
|
||||
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`.
|
||||
|
||||
Locate the DTS file: :zephyr_file:`boards/nordic/nrf52840dongle/nrf52840dongle_nrf52840.dts`.
|
||||
This file requires a small modification to use a different partition table.
|
||||
Edit the include directive to include "fstab-debugger" instead of "fstab-stock".
|
||||
|
||||
In addition, the Kconfig file in the same directory must be modified by setting
|
||||
``BOARD_HAS_NRF5_BOOTLOADER`` to be default ``n``, otherwise the code will be
|
||||
flashed with an offset.
|
||||
|
||||
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:`blinky` application.
|
||||
|
||||
.. zephyr-app-commands::
|
||||
:zephyr-app: samples/basic/blinky
|
||||
:board: nrf52840dongle/nrf52840
|
||||
:goals: build flash
|
||||
|
||||
Observe the LED on the board blinking.
|
||||
|
||||
Debugging
|
||||
=========
|
||||
|
||||
The ``nrf52840dongle/nrf52840`` board does not have an on-board J-Link debug IC
|
||||
as some nRF5x development boards, however, instructions from the
|
||||
:ref:`nordic_segger` page also apply to this board, with the additional step
|
||||
of connecting an external debugger.
|
||||
|
||||
Testing the LEDs and buttons on the nRF52840 Dongle
|
||||
***************************************************
|
||||
|
||||
There are 2 samples that allow you to test that the buttons (switches) and LEDs on
|
||||
the board are working properly with Zephyr:
|
||||
|
||||
* :zephyr:code-sample:`blinky`
|
||||
|
||||
You can build and program the examples to make sure Zephyr is running correctly
|
||||
on your board.
|
||||
|
||||
|
||||
References
|
||||
**********
|
||||
|
||||
.. target-notes::
|
||||
|
||||
.. _nRF52840 Dongle website:
|
||||
https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-Dongle
|
||||
.. _nRF52840 Dongle guide: https://docs.nordicsemi.com/bundle/ug_nrf52840_dk/page/UG/dk/intro.html
|
||||
.. _nRF52840 Dongle Hardware description: https://docs.nordicsemi.com/bundle/ug_nrf52840_dongle/page/UG/nrf52840_Dongle/hw_description.html
|
||||
.. _J-Link Software and documentation pack:
|
||||
https://www.segger.com/jlink-software.html
|
||||
.. _Nordic Semiconductor USB DFU:
|
||||
https://docs.nordicsemi.com/bundle/sdk_nrf5_v17.1.0/page/sdk_app_serial_dfu_bootloader.html
|
||||
.. _nrfutil:
|
||||
https://github.com/NordicSemiconductor/pc-nrfutil
|
||||
.. _MCUboot:
|
||||
https://github.com/JuulLabs-OSS/mcuboot
|
||||
.. _mcumgr:
|
||||
https://github.com/apache/mynewt-mcumgr-cli
|
||||
36
boards/nrf52840dongle_no_usb/fstab-debugger.dtsi
Normal file
36
boards/nrf52840dongle_no_usb/fstab-debugger.dtsi
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (c) 2019 Nordic Semiconductor ASA
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/* Flash partition table without support for Nordic nRF5 bootloader */
|
||||
|
||||
&flash0 {
|
||||
partitions {
|
||||
compatible = "fixed-partitions";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
/* The size of this partition ensures that MCUBoot can be built
|
||||
* with an RTT console, CDC ACM support, and w/o optimizations.
|
||||
*/
|
||||
boot_partition: partition@0 {
|
||||
label = "mcuboot";
|
||||
reg = <0x00000000 0x00012000>;
|
||||
};
|
||||
|
||||
slot0_partition: partition@12000 {
|
||||
label = "image-0";
|
||||
reg = <0x00012000 0x00075000>;
|
||||
};
|
||||
slot1_partition: partition@87000 {
|
||||
label = "image-1";
|
||||
reg = <0x00087000 0x00075000>;
|
||||
};
|
||||
storage_partition: partition@fc000 {
|
||||
label = "storage";
|
||||
reg = <0x000fc000 0x00004000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
44
boards/nrf52840dongle_no_usb/fstab-stock.dtsi
Normal file
44
boards/nrf52840dongle_no_usb/fstab-stock.dtsi
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 2019 Nordic Semiconductor ASA
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/* Flash partition table compatible with Nordic nRF5 bootloader */
|
||||
|
||||
&flash0 {
|
||||
partitions {
|
||||
compatible = "fixed-partitions";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
/* MCUboot placed after Nordic MBR (this is set with the FLASH_LOAD_OFFSET
|
||||
* Kconfig value when BOARD_HAS_NRF5_BOOTLOADER is enabled), otherwise MCUboot
|
||||
* will be placed at 0x0. The size of this partition ensures that MCUBoot can
|
||||
* be built with CDC ACM support and w/o optimizations.
|
||||
*/
|
||||
boot_partition: partition@0 {
|
||||
label = "mcuboot";
|
||||
reg = <0x00000000 0x00010000>;
|
||||
};
|
||||
|
||||
slot0_partition: partition@10000 {
|
||||
label = "image-0";
|
||||
reg = <0x00010000 0x00066000>;
|
||||
};
|
||||
slot1_partition: partition@76000 {
|
||||
label = "image-1";
|
||||
reg = <0x00076000 0x00066000>;
|
||||
};
|
||||
storage_partition: partition@dc000 {
|
||||
label = "storage";
|
||||
reg = <0x000dc000 0x00004000>;
|
||||
};
|
||||
|
||||
/* Nordic nRF5 bootloader <0xe0000 0x1c000>
|
||||
*
|
||||
* In addition, the last and second last flash pages
|
||||
* are used by the nRF5 bootloader and MBR to store settings.
|
||||
*/
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Nordic Semiconductor
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
&pinctrl {
|
||||
uart0_default: uart0_default {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(UART_TX, 0, 13)>,
|
||||
<NRF_PSEL(UART_RTS, 0, 17)>;
|
||||
};
|
||||
group2 {
|
||||
psels = <NRF_PSEL(UART_RX, 0, 15)>,
|
||||
<NRF_PSEL(UART_CTS, 0, 20)>;
|
||||
bias-pull-up;
|
||||
};
|
||||
};
|
||||
|
||||
uart0_sleep: uart0_sleep {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(UART_TX, 0, 13)>,
|
||||
<NRF_PSEL(UART_RX, 0, 15)>,
|
||||
<NRF_PSEL(UART_RTS, 0, 17)>,
|
||||
<NRF_PSEL(UART_CTS, 0, 20)>;
|
||||
low-power-enable;
|
||||
};
|
||||
};
|
||||
|
||||
pwm0_default: pwm0_default {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(PWM_OUT0, 0, 8)>,
|
||||
<NRF_PSEL(PWM_OUT1, 1, 9)>,
|
||||
<NRF_PSEL(PWM_OUT2, 0, 12)>;
|
||||
nordic,invert;
|
||||
};
|
||||
};
|
||||
|
||||
pwm0_sleep: pwm0_sleep {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(PWM_OUT0, 0, 8)>,
|
||||
<NRF_PSEL(PWM_OUT1, 1, 9)>,
|
||||
<NRF_PSEL(PWM_OUT2, 0, 12)>;
|
||||
low-power-enable;
|
||||
};
|
||||
};
|
||||
|
||||
spi0_default: spi0_default {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(SPIM_SCK, 0, 27)>,
|
||||
<NRF_PSEL(SPIM_MOSI, 0, 26)>,
|
||||
<NRF_PSEL(SPIM_MISO, 1, 10)>;
|
||||
};
|
||||
};
|
||||
|
||||
spi0_sleep: spi0_sleep {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(SPIM_SCK, 0, 27)>,
|
||||
<NRF_PSEL(SPIM_MOSI, 0, 26)>,
|
||||
<NRF_PSEL(SPIM_MISO, 1, 10)>;
|
||||
low-power-enable;
|
||||
};
|
||||
};
|
||||
|
||||
spi1_default: spi1_default {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(SPIM_SCK, 0, 31)>,
|
||||
<NRF_PSEL(SPIM_MOSI, 0, 30)>,
|
||||
<NRF_PSEL(SPIM_MISO, 1, 13)>;
|
||||
};
|
||||
};
|
||||
|
||||
spi1_sleep: spi1_sleep {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(SPIM_SCK, 0, 31)>,
|
||||
<NRF_PSEL(SPIM_MOSI, 0, 30)>,
|
||||
<NRF_PSEL(SPIM_MISO, 1, 13)>;
|
||||
low-power-enable;
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
147
boards/nrf52840dongle_no_usb/nrf52840dongle_no_usb_nrf52840.dts
Normal file
147
boards/nrf52840dongle_no_usb/nrf52840dongle_no_usb_nrf52840.dts
Normal file
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2023 Nordic Semiconductor ASA
|
||||
* Copyright (c) 2017 Linaro Limited
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
#include <nordic/nrf52840_qiaa.dtsi>
|
||||
#include "nrf52840dongle_no_usb_nrf52840-pinctrl.dtsi"
|
||||
#include <zephyr/dt-bindings/input/input-event-codes.h>
|
||||
|
||||
|
||||
&uart0 {
|
||||
compatible = "nordic,nrf-uarte";
|
||||
status = "okay";
|
||||
current-speed = <1000000>;
|
||||
pinctrl-0 = <&uart0_default>;
|
||||
pinctrl-1 = <&uart0_sleep>;
|
||||
pinctrl-names = "default", "sleep";
|
||||
hw-flow-control;
|
||||
};
|
||||
|
||||
|
||||
/ {
|
||||
model = "Nordic nRF52840 Dongle NRF52840";
|
||||
compatible = "nordic,nrf52840-dongle_no_usb-nrf52840";
|
||||
|
||||
chosen {
|
||||
//zephyr,console = &uart0;
|
||||
//zephyr,shell-uart = &uart0;
|
||||
//zephyr,uart-mcumgr = &uart0;
|
||||
//zephyr,bt-mon-uart = &uart0;
|
||||
zephyr,bt-c2h-uart = &uart0; // make uart0 the hci interfac
|
||||
|
||||
zephyr,sram = &sram0;
|
||||
zephyr,flash = &flash0;
|
||||
zephyr,code-partition = &slot0_partition;
|
||||
zephyr,ieee802154 = &ieee802154;
|
||||
};
|
||||
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
led0_green: led_0 {
|
||||
gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
|
||||
label = "Green LED 0";
|
||||
};
|
||||
led1_red: led_1 {
|
||||
gpios = <&gpio0 8 GPIO_ACTIVE_LOW>;
|
||||
label = "Red LED 1";
|
||||
};
|
||||
led1_green: led_2 {
|
||||
gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
|
||||
label = "Green LED 1";
|
||||
};
|
||||
led1_blue: led_3 {
|
||||
gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
|
||||
label = "Blue LED 1";
|
||||
};
|
||||
};
|
||||
|
||||
pwmleds {
|
||||
compatible = "pwm-leds";
|
||||
red_pwm_led: pwm_led_0 {
|
||||
pwms = <&pwm0 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
|
||||
};
|
||||
green_pwm_led: pwm_led_1 {
|
||||
pwms = <&pwm0 1 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
|
||||
};
|
||||
blue_pwm_led: pwm_led_2 {
|
||||
pwms = <&pwm0 2 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
|
||||
};
|
||||
};
|
||||
|
||||
buttons {
|
||||
compatible = "gpio-keys";
|
||||
button0: button_0 {
|
||||
gpios = <&gpio1 6 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
|
||||
label = "Push button switch 0";
|
||||
zephyr,code = <INPUT_KEY_0>;
|
||||
};
|
||||
};
|
||||
|
||||
/* These aliases are provided for compatibility with samples */
|
||||
aliases {
|
||||
sw0 = &button0;
|
||||
led0 = &led0_green;
|
||||
led1 = &led1_red;
|
||||
led2 = &led1_green;
|
||||
led3 = &led1_blue;
|
||||
led0-green = &led0_green;
|
||||
led1-red = &led1_red;
|
||||
led1-green = &led1_green;
|
||||
led1-blue = &led1_blue;
|
||||
pwm-led0 = &red_pwm_led;
|
||||
pwm-led1 = &green_pwm_led;
|
||||
pwm-led2 = &blue_pwm_led;
|
||||
red-pwm-led = &red_pwm_led;
|
||||
green-pwm-led = &green_pwm_led;
|
||||
blue-pwm-led = &blue_pwm_led;
|
||||
mcuboot-button0 = &button0;
|
||||
mcuboot-led0 = &led0_green;
|
||||
watchdog0 = &wdt0;
|
||||
};
|
||||
};
|
||||
|
||||
®0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
®1 {
|
||||
regulator-initial-mode = <NRF5X_REG_MODE_DCDC>;
|
||||
};
|
||||
|
||||
&adc {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&gpiote {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&uicr {
|
||||
nfct-pins-as-gpios;
|
||||
gpio-as-nreset;
|
||||
};
|
||||
|
||||
&gpio0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&gpio1 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
|
||||
&ieee802154 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
/* Include flash partition table.
|
||||
* Two partition tables are available:
|
||||
* fstab-stock -compatible with Nordic nRF5 bootloader, default
|
||||
* fstab-debugger -to use an external debugger, w/o the nRF5 bootloader
|
||||
*/
|
||||
#include "fstab-debugger.dtsi"
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
identifier: nrf52840dongle/nrf52840
|
||||
name: nRF52840-Dongle-NRF52840
|
||||
type: mcu
|
||||
arch: arm
|
||||
ram: 256
|
||||
flash: 1024
|
||||
toolchain:
|
||||
- zephyr
|
||||
- gnuarmemb
|
||||
- xtools
|
||||
supported:
|
||||
- adc
|
||||
- usb_device
|
||||
- ble
|
||||
- pwm
|
||||
- spi
|
||||
- watchdog
|
||||
- counter
|
||||
- netif:openthread
|
||||
- gpio
|
||||
vendor: nordic
|
||||
@@ -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
|
||||
7
boards/nrf52840dongle_no_usb/pre_dt_board.cmake
Normal file
7
boards/nrf52840dongle_no_usb/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")
|
||||
1
no_bootloader.conf
Normal file
1
no_bootloader.conf
Normal file
@@ -0,0 +1 @@
|
||||
CONFIG_BOARD_HAS_NRF5_BOOTLOADER=n
|
||||
Reference in New Issue
Block a user