nrf: Add board definition for nRF52840-MDK-USB-Dongle.

This commit is contained in:
Matt Trentini 2020-05-18 14:45:46 +10:00 committed by Damien George
parent d9e8edc8bc
commit 486cb6dd4a
7 changed files with 152 additions and 2 deletions

View File

@ -41,6 +41,7 @@ This is a port of MicroPython to the Nordic Semiconductor nRF series of chips.
* [PCA10056](http://www.nordicsemi.com/eng/Products/nRF52840-Preview-DK)
* [PCA10059](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-Dongle)
* [Particle Xenon](https://docs.particle.io/xenon/)
* [nRF52840 MDK USB Dongle](boards/nrf52840-mdk-usb-dongle/README.md)
* nRF9160
* [PCA10090](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF9160-DK)
* [Actinius Icarus](https://www.actinius.com/icarus)

View File

@ -1,14 +1,17 @@
/* Flash layout: softdevice | application | filesystem */
/* RAM layout: softdevice RAM | application RAM */
_sd_size = DEFINED(_sd_size) ? _sd_size : 0;
_ram_start = DEFINED(_ram_start) ? _ram_start : 0x20000000;
_flash_start = DEFINED(_flash_start) ? _flash_start : 0;
_sd_size = DEFINED(_sd_size) ? _sd_size : _flash_start;
_sd_ram = DEFINED(_sd_ram) ? _sd_ram : 0;
_fs_size = DEFINED(_fs_size) ? _fs_size : 64K; /* TODO: set to 0 if not using the filesystem */
_app_size = _flash_size - _sd_size - _fs_size;
_app_start = _sd_size;
_fs_start = _sd_size + _app_size;
_fs_end = _fs_start + _fs_size;
_app_ram_start = 0x20000000 + _sd_ram;
_app_ram_start = _ram_start + _sd_ram;
_app_ram_size = _ram_size - _sd_ram;
_heap_start = _ebss;
_heap_end = _ram_end - _stack_size;

View File

@ -0,0 +1,49 @@
nRF52840 MDK USB Dongle
=======================
The *[nRF52840 MDK USB
Dongle](https://wiki.makerdiary.com/nrf52840-mdk-usb-dongle)* is a small,
low-cost development board in a USB dongle form-factor powered by an nRF52840
with 1MB flash and 256KB RAM.
This device is pre-installed with [Open
Bootloader](https://wiki.makerdiary.com/nrf52840-mdk-usb-dongle/programming/),
allowing DFU upgrades over USB using Nordic [nRF
Connect](https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Connect-for-desktop)
or [nrfutil](https://github.com/NordicSemiconductor/pc-nrfutil/). To support
Open Bootloader, the flash and memory layout must be adjusted slightly (details
[here](https://devzone.nordicsemi.com/nordic/short-range-guides/b/getting-started/posts/nrf52840-dongle-programming-tutorial))
from the typical nRF build; this board definition ensure the appropriate build
configuration is used for MicroPython.
Pinout
------
The [pinout
diagram](https://wiki.makerdiary.com/nrf52840-mdk-usb-dongle/#pinout-diagram)
provides an overview of the available pins and their capabilities. All pins are
available in MicroPython, using the pin numbers labelled in the diagram
(excluding the leading port number, *P0*).
The three LEDs are available either through the usual `Pin` mechanism - pins
22-24 - or by `board.LED(n)` where n can be 1, 2 or 3.
Build instructions
------------------
Follow the standard [nRF Port build instructions](../../README.md); but use
`nrf52840-mdk-usb-dongle` as the value for `BOARD`:
make BOARD=nrf52840-mdk-usb-dongle
The build artifacts will be created in `build-nrf52840-mdk-usb-dongle`. Once
built, the easiest way to deploy to the device is to open `firmware.hex` using
*nRF Connect* and select *Write*. Detailed instructions can be found on the
[developer
wiki](https://wiki.makerdiary.com/nrf52840-mdk-usb-dongle/programming/).
**Note** that the regular method of deployment for the MicroPython nRF port
(using `make deploy`) will *not* operate correctly and will overwrite the
bootloader.

View File

@ -0,0 +1,71 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2020 Matt Trentini
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#define MICROPY_HW_BOARD_NAME "MDK-USB-DONGLE"
#define MICROPY_HW_MCU_NAME "NRF52840"
#define MICROPY_PY_SYS_PLATFORM "nrf52840-MDK-USB-Dongle"
#define MICROPY_PY_MACHINE_UART (1)
#define MICROPY_PY_MACHINE_HW_PWM (1)
#define MICROPY_PY_MACHINE_HW_SPI (1)
#define MICROPY_PY_MACHINE_TIMER (1)
#define MICROPY_PY_MACHINE_RTCOUNTER (1)
#define MICROPY_PY_MACHINE_I2C (1)
#define MICROPY_PY_MACHINE_ADC (1)
#define MICROPY_PY_MACHINE_TEMP (1)
#define MICROPY_HW_ENABLE_RNG (1)
#define MICROPY_HW_USB_CDC (1)
#define MICROPY_HW_HAS_LED (1)
#define MICROPY_HW_LED_COUNT (3)
#define MICROPY_HW_LED_PULLUP (1)
#define MICROPY_HW_LED1 (22) // LED1 GREEN
#define MICROPY_HW_LED2 (23) // LED2 RED
#define MICROPY_HW_LED3 (24) // LED3 BLUE
// UART config
#define MICROPY_HW_UART1_RX (7)
#define MICROPY_HW_UART1_TX (8)
#define MICROPY_HW_UART1_CTS (9)
#define MICROPY_HW_UART1_RTS (10)
#define MICROPY_HW_UART1_HWFC (1)
// SPI0 config
#define MICROPY_HW_SPI0_NAME "SPI0"
#define MICROPY_HW_SPI0_SCK (19)
#define MICROPY_HW_SPI0_MOSI (20)
#define MICROPY_HW_SPI0_MISO (21)
#define MICROPY_HW_PWM0_NAME "PWM0"
#define MICROPY_HW_PWM1_NAME "PWM1"
#define MICROPY_HW_PWM2_NAME "PWM2"
#define MICROPY_HW_PWM3_NAME "PWM3"
#define HELP_TEXT_BOARD_LED "1,2,3"

View File

@ -0,0 +1,7 @@
MCU_SERIES = m4
MCU_VARIANT = nrf52
MCU_SUB_VARIANT = nrf52840
SOFTDEV_VERSION = 6.1.1
LD_FILES += boards/nrf52840-mdk-usb-dongle/nrf52840_open_bootloader.ld boards/nrf52840_1M_256k.ld
NRF_DEFINES += -DNRF52840_XXAA

View File

@ -0,0 +1,2 @@
_ram_start = 0x20000008;
_flash_start = 0x1000;

View File

@ -0,0 +1,17 @@
P2,P2,ADC1_CH0
P3,P3,ADC1_CH1
P4,P4,ADC1_CH2
P5,P5,ADC1_CH3
P6,P6
P7,P7
P8,P8
P9,P9
P10,P10
USER,P18,P18
P19,P19
P20,P20
P21,P21
LED_G,P22,P22
LED_R,P23,P23
LED_B,P24,P24
P25,P25
1 P2,P2,ADC1_CH0
2 P3,P3,ADC1_CH1
3 P4,P4,ADC1_CH2
4 P5,P5,ADC1_CH3
5 P6,P6
6 P7,P7
7 P8,P8
8 P9,P9
9 P10,P10
10 USER,P18,P18
11 P19,P19
12 P20,P20
13 P21,P21
14 LED_G,P22,P22
15 LED_R,P23,P23
16 LED_B,P24,P24
17 P25,P25