Skip to content

Commit

Permalink
nrf52840: Add nrf52840_dongle_if and thingy91_nrf52840_if projects
Browse files Browse the repository at this point in the history
Signed-off-by: Maximilian Deubel <[email protected]>
  • Loading branch information
maxd-nordic authored and mbrossard committed Aug 17, 2023
1 parent 64d06e2 commit 6b526ca
Show file tree
Hide file tree
Showing 10 changed files with 119 additions and 1 deletion.
8 changes: 8 additions & 0 deletions projects.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,14 @@ projects:
- *module_if
- *module_hic_nrf52820
- records/board/microbitv2_nrf52820.yaml
nrf52840_dongle_if:
- *module_if
- *module_hic_nrf52840
- records/board/nrf52840_dongle.yaml
nrf52840_thingy91_if:
- *module_if
- *module_hic_nrf52840
- records/board/thingy91.yaml
sam3u2c_mkit_dk_dongle_nrf5x_if:
- *module_if
- *module_hic_sam3u2c
Expand Down
3 changes: 3 additions & 0 deletions records/board/nrf52840_dongle.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
common:
macros:
- NRF52840DONGLE
6 changes: 6 additions & 0 deletions records/board/thingy91.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
common:
macros:
- THINGY91
sources:
board:
- source/board/thingy91.c
38 changes: 38 additions & 0 deletions source/board/thingy91.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* @file thingy91.c
* @brief board ID for the BBC Microbit board
*
* DAPLink Interface Firmware
* Copyright (c) 2009-2019, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include "IO_Config.h"
#include "DAP.h"
#include "target_family.h"
#include "target_board.h"
#include "nrf_nvmc.h"

extern target_cfg_t target_device_nrf51822_16;

const board_info_t g_board_info = {
.info_version = kBoardInfoVersion,
.family_id = kNordic_Nrf91_FamilyID,
.daplink_url_name = "THINGY91HTM",
.daplink_drive_name = "THINGY91 ",
.daplink_target_url = "https://nordicsemi.com/thingy91",
.board_vendor = "Nordic Semiconductor ASA",
.board_name = "Thingy:91",
};
3 changes: 3 additions & 0 deletions source/daplink/daplink.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ extern "C" {

// ROM check
COMPILER_ASSERT(DAPLINK_ROM_BL_START == DAPLINK_ROM_START);

#if !defined(THINGY91)
COMPILER_ASSERT(DAPLINK_ROM_IF_START + DAPLINK_ROM_IF_SIZE == DAPLINK_ROM_CONFIG_USER_START);
COMPILER_ASSERT(DAPLINK_ROM_CONFIG_USER_START + DAPLINK_ROM_CONFIG_USER_SIZE == DAPLINK_ROM_START + DAPLINK_ROM_SIZE);
#endif

// RAM check
COMPILER_ASSERT(DAPLINK_RAM_APP_START == DAPLINK_RAM_START);
Expand Down
11 changes: 11 additions & 0 deletions source/hic_hal/nordic/nrf52840/DAP_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,12 @@ __STATIC_INLINE void PORT_SWD_SETUP (void) {
NRF_GPIO_PIN_DIR_OUTPUT, NRF_GPIO_PIN_INPUT_CONNECT,
NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_S0S1, NRF_GPIO_PIN_NOSENSE);
gpio_set(GPIO_REG(PIN_SWDIO), GPIO_IDX(PIN_SWDIO));
#ifdef PIN_SWD_CTRL
gpio_cfg(GPIO_REG(PIN_SWD_CTRL), GPIO_IDX(PIN_SWD_CTRL),
NRF_GPIO_PIN_DIR_OUTPUT, NRF_GPIO_PIN_INPUT_DISCONNECT,
NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_S0S1, NRF_GPIO_PIN_NOSENSE);
gpio_set(GPIO_REG(PIN_SWD_CTRL), GPIO_IDX(PIN_SWD_CTRL));
#endif
}

/** Disable JTAG/SWD I/O Pins.
Expand All @@ -228,6 +234,11 @@ __STATIC_INLINE void PORT_OFF (void) {
gpio_cfg(GPIO_REG(PIN_SWCLK), GPIO_IDX(PIN_SWCLK),
NRF_GPIO_PIN_DIR_INPUT, NRF_GPIO_PIN_INPUT_DISCONNECT,
NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_S0S1, NRF_GPIO_PIN_NOSENSE);
#ifdef PIN_SWD_CTRL
gpio_cfg(GPIO_REG(PIN_SWD_CTRL), GPIO_IDX(PIN_SWD_CTRL),
NRF_GPIO_PIN_DIR_INPUT, NRF_GPIO_PIN_INPUT_DISCONNECT,
NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_S0S1, NRF_GPIO_PIN_NOSENSE);
#endif
}


Expand Down
18 changes: 18 additions & 0 deletions source/hic_hal/nordic/nrf52840/IO_Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,24 @@ COMPILER_ASSERT(DAPLINK_HIC_ID == DAPLINK_HIC_ID_NRF52840);
#define I2C_SCL_PIN NRF_GPIO_PIN_MAP(0, 20) // I2C
#define I2C_SDA_PIN NRF_GPIO_PIN_MAP(0, 22) // I2C

#elif defined(THINGY91)

#define GPIO_LED_ACTIVE_STATE 0
#define RESET_BUTTON_PULL NRF_GPIO_PIN_PULLUP
#define PIN_SWD_CTRL NRF_GPIO_PIN_MAP(0, 17)
#define PIN_SWCLK NRF_GPIO_PIN_MAP(1, 05) // SWDCLK (Output)
#define PIN_SWDIO NRF_GPIO_PIN_MAP(0, 14) // SWDIO (Input/Output)
#undef PIN_nRESET
#undef LED_RUNNING
#undef LED_CONNECTED
#define LED_HID NRF_GPIO_PIN_MAP(0, 6)
#define LED_MSC LED_HID
#define LED_CDC LED_HID
#undef LED_PWR
#define RESET_BUTTON NRF_GPIO_PIN_MAP(1, 13) // SW1
#define UART_TX_PIN NRF_GPIO_PIN_MAP(0, 15) // UART From IMCU to target
#define UART_RX_PIN NRF_GPIO_PIN_MAP(0, 11) // UART From target to IMCU

#else

#define GPIO_LED_ACTIVE_STATE 0
Expand Down
26 changes: 26 additions & 0 deletions source/hic_hal/nordic/nrf52840/daplink_addr.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,30 @@

/* ROM sizes */

#if defined(THINGY91)

#define DAPLINK_ROM_BL_START 0x00000000
#define DAPLINK_ROM_BL_SIZE 0x00013000

#define DAPLINK_ROM_IF_START 0x00013000
#define DAPLINK_ROM_IF_SIZE 0x0002D000

#define DAPLINK_ROM_CONFIG_USER_START 0x000FE000
#define DAPLINK_ROM_CONFIG_USER_SIZE 0x00002000

#elif defined(NRF52840DONGLE)

#define DAPLINK_ROM_BL_START 0x00000000
#define DAPLINK_ROM_BL_SIZE 0x00001000

#define DAPLINK_ROM_IF_START 0x00001000
#define DAPLINK_ROM_IF_SIZE 0x0003E000

#define DAPLINK_ROM_CONFIG_USER_START 0x0003F000
#define DAPLINK_ROM_CONFIG_USER_SIZE 0x00001000

#else

#define DAPLINK_ROM_BL_START 0x00000000
#define DAPLINK_ROM_BL_SIZE 0x00010000 // 64 KiB bootloader

Expand All @@ -39,6 +63,8 @@
#define DAPLINK_ROM_CONFIG_USER_START 0x0003F000
#define DAPLINK_ROM_CONFIG_USER_SIZE 0x00001000

#endif

/* RAM sizes */

#define DAPLINK_RAM_APP_START 0x20000000
Expand Down
2 changes: 2 additions & 0 deletions source/target/target_family.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ typedef enum _family_id {
kNXP_KinetisV_FamilyID = CREATE_FAMILY_ID(kNXP_VendorID, 7),
kNordic_Nrf51_FamilyID = CREATE_FAMILY_ID(kNordic_VendorID, 1),
kNordic_Nrf52_FamilyID = CREATE_FAMILY_ID(kNordic_VendorID, 2),
kNordic_Nrf53_FamilyID = CREATE_FAMILY_ID(kNordic_VendorID, 3),
kNordic_Nrf91_FamilyID = CREATE_FAMILY_ID(kNordic_VendorID, 4),
kRealtek_Rtl8195am_FamilyID = CREATE_FAMILY_ID(kRealtek_VendorID, 1),
kTI_Cc3220sf_FamilyID = CREATE_FAMILY_ID(kTI_VendorID, 1),
kToshiba_Tz_FamilyID = CREATE_FAMILY_ID(kToshiba_VendorID, 1),
Expand Down
5 changes: 4 additions & 1 deletion test/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@
('max32620_if', False, 0x0000, "bin" ),
('max32625_if', False, 0x0000, "bin" ),
('nrf52820_if', False, 0x0000, "bin" ),
('nrf52840_if', False, 0x0000, "bin" ),
('nrf52840_if', False, 0x10000, "bin" ),
('nrf52840_dongle_if', False, 0x1000, "hex" ),
('sam3u2c_if', False, 0x0000, "bin" ),
('stm32f103xb_if', False, 0x0000, "bin" ),
('lpc11u35_pitaya_link_if', False, 0x0000, "bin" ),
Expand Down Expand Up @@ -249,6 +250,8 @@ def VENDOR_TO_FAMILY(x, y) : return (VENDOR_ID[x] <<8) | y
( 0x0000, VENDOR_TO_FAMILY('Stub', 1), 'max32625_if', None, None ),
( 0x0000, VENDOR_TO_FAMILY('Stub', 1), 'nrf52820_if', None, None ),
( 0x0000, VENDOR_TO_FAMILY('Stub', 1), 'nrf52840_if', None, None ),
( 0x0000, VENDOR_TO_FAMILY('Stub', 1), 'nrf52840dongle_if', None, None ),
( 0x0000, VENDOR_TO_FAMILY('Nordic', 4), 'nrf52840_thingy91_if', None, None ),
( 0x0000, VENDOR_TO_FAMILY('Stub', 1), 'sam3u2c_if', None, None ),
( 0x0000, VENDOR_TO_FAMILY('Stub', 1), 'stm32f103xb_if', None, None ),

Expand Down

0 comments on commit 6b526ca

Please sign in to comment.