Skip to content

Commit e7b03e5

Browse files
maxd-nordicmbrossard
authored andcommitted
nrf52840: Add nrf52840_dongle_if and thingy91_nrf52840_if projects
Signed-off-by: Maximilian Deubel <[email protected]>
1 parent 26ddd5c commit e7b03e5

File tree

10 files changed

+119
-1
lines changed

10 files changed

+119
-1
lines changed

projects.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,14 @@ projects:
629629
- *module_if
630630
- *module_hic_nrf52820
631631
- records/board/microbitv2_nrf52820.yaml
632+
nrf52840_dongle_if:
633+
- *module_if
634+
- *module_hic_nrf52840
635+
- records/board/nrf52840_dongle.yaml
636+
nrf52840_thingy91_if:
637+
- *module_if
638+
- *module_hic_nrf52840
639+
- records/board/thingy91.yaml
632640
sam3u2c_mkit_dk_dongle_nrf5x_if:
633641
- *module_if
634642
- *module_hic_sam3u2c

records/board/nrf52840_dongle.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
common:
2+
macros:
3+
- NRF52840DONGLE

records/board/thingy91.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
common:
2+
macros:
3+
- THINGY91
4+
sources:
5+
board:
6+
- source/board/thingy91.c

source/board/thingy91.c

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/**
2+
* @file thingy91.c
3+
* @brief board ID for the BBC Microbit board
4+
*
5+
* DAPLink Interface Firmware
6+
* Copyright (c) 2009-2019, ARM Limited, All Rights Reserved
7+
* SPDX-License-Identifier: Apache-2.0
8+
*
9+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
10+
* not use this file except in compliance with the License.
11+
* You may obtain a copy of the License at
12+
*
13+
* http://www.apache.org/licenses/LICENSE-2.0
14+
*
15+
* Unless required by applicable law or agreed to in writing, software
16+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
17+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
* See the License for the specific language governing permissions and
19+
* limitations under the License.
20+
*/
21+
22+
#include "IO_Config.h"
23+
#include "DAP.h"
24+
#include "target_family.h"
25+
#include "target_board.h"
26+
#include "nrf_nvmc.h"
27+
28+
extern target_cfg_t target_device_nrf51822_16;
29+
30+
const board_info_t g_board_info = {
31+
.info_version = kBoardInfoVersion,
32+
.family_id = kNordic_Nrf91_FamilyID,
33+
.daplink_url_name = "THINGY91HTM",
34+
.daplink_drive_name = "THINGY91 ",
35+
.daplink_target_url = "https://nordicsemi.com/thingy91",
36+
.board_vendor = "Nordic Semiconductor ASA",
37+
.board_name = "Thingy:91",
38+
};

source/daplink/daplink.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ extern "C" {
3737

3838
// ROM check
3939
COMPILER_ASSERT(DAPLINK_ROM_BL_START == DAPLINK_ROM_START);
40+
41+
#if !defined(THINGY91)
4042
COMPILER_ASSERT(DAPLINK_ROM_IF_START + DAPLINK_ROM_IF_SIZE == DAPLINK_ROM_CONFIG_USER_START);
4143
COMPILER_ASSERT(DAPLINK_ROM_CONFIG_USER_START + DAPLINK_ROM_CONFIG_USER_SIZE == DAPLINK_ROM_START + DAPLINK_ROM_SIZE);
44+
#endif
4245

4346
// RAM check
4447
COMPILER_ASSERT(DAPLINK_RAM_APP_START == DAPLINK_RAM_START);

source/hic_hal/nordic/nrf52840/DAP_config.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,12 @@ __STATIC_INLINE void PORT_SWD_SETUP (void) {
215215
NRF_GPIO_PIN_DIR_OUTPUT, NRF_GPIO_PIN_INPUT_CONNECT,
216216
NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_S0S1, NRF_GPIO_PIN_NOSENSE);
217217
gpio_set(GPIO_REG(PIN_SWDIO), GPIO_IDX(PIN_SWDIO));
218+
#ifdef PIN_SWD_CTRL
219+
gpio_cfg(GPIO_REG(PIN_SWD_CTRL), GPIO_IDX(PIN_SWD_CTRL),
220+
NRF_GPIO_PIN_DIR_OUTPUT, NRF_GPIO_PIN_INPUT_DISCONNECT,
221+
NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_S0S1, NRF_GPIO_PIN_NOSENSE);
222+
gpio_set(GPIO_REG(PIN_SWD_CTRL), GPIO_IDX(PIN_SWD_CTRL));
223+
#endif
218224
}
219225

220226
/** Disable JTAG/SWD I/O Pins.
@@ -228,6 +234,11 @@ __STATIC_INLINE void PORT_OFF (void) {
228234
gpio_cfg(GPIO_REG(PIN_SWCLK), GPIO_IDX(PIN_SWCLK),
229235
NRF_GPIO_PIN_DIR_INPUT, NRF_GPIO_PIN_INPUT_DISCONNECT,
230236
NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_S0S1, NRF_GPIO_PIN_NOSENSE);
237+
#ifdef PIN_SWD_CTRL
238+
gpio_cfg(GPIO_REG(PIN_SWD_CTRL), GPIO_IDX(PIN_SWD_CTRL),
239+
NRF_GPIO_PIN_DIR_INPUT, NRF_GPIO_PIN_INPUT_DISCONNECT,
240+
NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_S0S1, NRF_GPIO_PIN_NOSENSE);
241+
#endif
231242
}
232243

233244

source/hic_hal/nordic/nrf52840/IO_Config.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,24 @@ COMPILER_ASSERT(DAPLINK_HIC_ID == DAPLINK_HIC_ID_NRF52840);
9696
#define I2C_SCL_PIN NRF_GPIO_PIN_MAP(0, 20) // I2C
9797
#define I2C_SDA_PIN NRF_GPIO_PIN_MAP(0, 22) // I2C
9898

99+
#elif defined(THINGY91)
100+
101+
#define GPIO_LED_ACTIVE_STATE 0
102+
#define RESET_BUTTON_PULL NRF_GPIO_PIN_PULLUP
103+
#define PIN_SWD_CTRL NRF_GPIO_PIN_MAP(0, 17)
104+
#define PIN_SWCLK NRF_GPIO_PIN_MAP(1, 05) // SWDCLK (Output)
105+
#define PIN_SWDIO NRF_GPIO_PIN_MAP(0, 14) // SWDIO (Input/Output)
106+
#undef PIN_nRESET
107+
#undef LED_RUNNING
108+
#undef LED_CONNECTED
109+
#define LED_HID NRF_GPIO_PIN_MAP(0, 6)
110+
#define LED_MSC LED_HID
111+
#define LED_CDC LED_HID
112+
#undef LED_PWR
113+
#define RESET_BUTTON NRF_GPIO_PIN_MAP(1, 13) // SW1
114+
#define UART_TX_PIN NRF_GPIO_PIN_MAP(0, 15) // UART From IMCU to target
115+
#define UART_RX_PIN NRF_GPIO_PIN_MAP(0, 11) // UART From target to IMCU
116+
99117
#else
100118

101119
#define GPIO_LED_ACTIVE_STATE 0

source/hic_hal/nordic/nrf52840/daplink_addr.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,30 @@
3030

3131
/* ROM sizes */
3232

33+
#if defined(THINGY91)
34+
35+
#define DAPLINK_ROM_BL_START 0x00000000
36+
#define DAPLINK_ROM_BL_SIZE 0x00013000
37+
38+
#define DAPLINK_ROM_IF_START 0x00013000
39+
#define DAPLINK_ROM_IF_SIZE 0x0002D000
40+
41+
#define DAPLINK_ROM_CONFIG_USER_START 0x000FE000
42+
#define DAPLINK_ROM_CONFIG_USER_SIZE 0x00002000
43+
44+
#elif defined(NRF52840DONGLE)
45+
46+
#define DAPLINK_ROM_BL_START 0x00000000
47+
#define DAPLINK_ROM_BL_SIZE 0x00001000
48+
49+
#define DAPLINK_ROM_IF_START 0x00001000
50+
#define DAPLINK_ROM_IF_SIZE 0x0003E000
51+
52+
#define DAPLINK_ROM_CONFIG_USER_START 0x0003F000
53+
#define DAPLINK_ROM_CONFIG_USER_SIZE 0x00001000
54+
55+
#else
56+
3357
#define DAPLINK_ROM_BL_START 0x00000000
3458
#define DAPLINK_ROM_BL_SIZE 0x00010000 // 64 KiB bootloader
3559

@@ -39,6 +63,8 @@
3963
#define DAPLINK_ROM_CONFIG_USER_START 0x0003F000
4064
#define DAPLINK_ROM_CONFIG_USER_SIZE 0x00001000
4165

66+
#endif
67+
4268
/* RAM sizes */
4369

4470
#define DAPLINK_RAM_APP_START 0x20000000

source/target/target_family.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ typedef enum _family_id {
100100
kNXP_KinetisV_FamilyID = CREATE_FAMILY_ID(kNXP_VendorID, 7),
101101
kNordic_Nrf51_FamilyID = CREATE_FAMILY_ID(kNordic_VendorID, 1),
102102
kNordic_Nrf52_FamilyID = CREATE_FAMILY_ID(kNordic_VendorID, 2),
103+
kNordic_Nrf53_FamilyID = CREATE_FAMILY_ID(kNordic_VendorID, 3),
104+
kNordic_Nrf91_FamilyID = CREATE_FAMILY_ID(kNordic_VendorID, 4),
103105
kRealtek_Rtl8195am_FamilyID = CREATE_FAMILY_ID(kRealtek_VendorID, 1),
104106
kTI_Cc3220sf_FamilyID = CREATE_FAMILY_ID(kTI_VendorID, 1),
105107
kToshiba_Tz_FamilyID = CREATE_FAMILY_ID(kToshiba_VendorID, 1),

test/info.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@
113113
('max32620_if', False, 0x0000, "bin" ),
114114
('max32625_if', False, 0x0000, "bin" ),
115115
('nrf52820_if', False, 0x0000, "bin" ),
116-
('nrf52840_if', False, 0x0000, "bin" ),
116+
('nrf52840_if', False, 0x10000, "bin" ),
117+
('nrf52840_dongle_if', False, 0x1000, "hex" ),
117118
('sam3u2c_if', False, 0x0000, "bin" ),
118119
('stm32f103xb_if', False, 0x0000, "bin" ),
119120
('lpc11u35_pitaya_link_if', False, 0x0000, "bin" ),
@@ -258,6 +259,8 @@ def VENDOR_TO_FAMILY(x, y) : return (VENDOR_ID[x] <<8) | y
258259
( 0x0000, VENDOR_TO_FAMILY('Stub', 1), 'max32625_if', None, None ),
259260
( 0x0000, VENDOR_TO_FAMILY('Stub', 1), 'nrf52820_if', None, None ),
260261
( 0x0000, VENDOR_TO_FAMILY('Stub', 1), 'nrf52840_if', None, None ),
262+
( 0x0000, VENDOR_TO_FAMILY('Stub', 1), 'nrf52840dongle_if', None, None ),
263+
( 0x0000, VENDOR_TO_FAMILY('Nordic', 4), 'nrf52840_thingy91_if', None, None ),
261264
( 0x0000, VENDOR_TO_FAMILY('Stub', 1), 'sam3u2c_if', None, None ),
262265
( 0x0000, VENDOR_TO_FAMILY('Stub', 1), 'stm32f103xb_if', None, None ),
263266

0 commit comments

Comments
 (0)