From 1e6b74f427728e31bad985c7316dee75a70865fe Mon Sep 17 00:00:00 2001 From: ddB Date: Thu, 3 Jun 2021 20:58:58 +0100 Subject: [PATCH 1/5] added nrf52840-BBoard --- .github/workflows/githubci.yml | 1 + src/boards/nrf52840_bboard/board.h | 68 ++++++++++++++++++++++++++ src/boards/nrf52840_bboard/board.mk | 1 + src/boards/nrf52840_bboard/pinconfig.c | 19 +++++++ 4 files changed, 89 insertions(+) create mode 100644 src/boards/nrf52840_bboard/board.h create mode 100644 src/boards/nrf52840_bboard/board.mk create mode 100644 src/boards/nrf52840_bboard/pinconfig.c diff --git a/.github/workflows/githubci.yml b/.github/workflows/githubci.yml index 8e1df3a..841fe22 100644 --- a/.github/workflows/githubci.yml +++ b/.github/workflows/githubci.yml @@ -39,6 +39,7 @@ jobs: - 'mdk_nrf52840_dongle' - 'nice_nano' - 'nrf52840_m2' + - 'nrf52840_bboard' - 'ohs2020_badge' - 'particle_argon' - 'particle_boron' diff --git a/src/boards/nrf52840_bboard/board.h b/src/boards/nrf52840_bboard/board.h new file mode 100644 index 0000000..6cbf5f4 --- /dev/null +++ b/src/boards/nrf52840_bboard/board.h @@ -0,0 +1,68 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2021 ddB0515(Dario Budimir) + * + * 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. + */ + +#ifndef _NRF52840_BBOARD_H +#define _NRF52840_BBOARD_H + +#define _PINNUM(port, pin) ((port)*32 + (pin)) + +/*------------------------------------------------------------------*/ +/* LED + *------------------------------------------------------------------*/ +#define LEDS_NUMBER 1 +#define LED_PRIMARY_PIN _PINNUM(0, 7) +#define LED_STATE_ON 1 + +/*------------------------------------------------------------------*/ +/* BUTTON + *------------------------------------------------------------------*/ +// NOTE: USB UF2 bootloader can be triggered by double pressing RESET +// App can trigger OTA bootloader by writing DFU_MAGIC_OTA_APPJUM to +// GPREGRET register if softdevice is not initialized; or by +// writing DFU_MAGIC_OTA_RESET in case softdevice is initialized. +#define BUTTONS_NUMBER 2 +#define BUTTON_1 18 // RESET also by default +#define BUTTON_2 1 // P0.1 not exposed anywhere, FRST n/a +#define BUTTON_PULL NRF_GPIO_PIN_PULLUP + +//--------------------------------------------------------------------+ +// BLE OTA +//--------------------------------------------------------------------+ +#define BLEDIS_MANUFACTURER "ddB0515" +#define BLEDIS_MODEL "nRF52840 BBoard" + +//--------------------------------------------------------------------+ +// USB +//--------------------------------------------------------------------+ +#define USB_DESC_VID 0x239A +#define USB_DESC_UF2_PID 0x0515 +#define USB_DESC_CDC_ONLY_PID 0x0516 + +//------------- UF2 -------------// +#define UF2_PRODUCT_NAME "nRF52840 BBoard" +#define UF2_VOLUME_LABEL "BBOARDBOOT" +#define UF2_BOARD_ID "nRF52840-BBoard-rev2" +#define UF2_INDEX_URL "https://github.com/ddB0515/nRF52840-BBoard" + +#endif // _NRF52840_BBOARD_H diff --git a/src/boards/nrf52840_bboard/board.mk b/src/boards/nrf52840_bboard/board.mk new file mode 100644 index 0000000..9d29ac6 --- /dev/null +++ b/src/boards/nrf52840_bboard/board.mk @@ -0,0 +1 @@ +MCU_SUB_VARIANT = nrf52840 diff --git a/src/boards/nrf52840_bboard/pinconfig.c b/src/boards/nrf52840_bboard/pinconfig.c new file mode 100644 index 0000000..2a592df --- /dev/null +++ b/src/boards/nrf52840_bboard/pinconfig.c @@ -0,0 +1,19 @@ +#include "boards.h" +#include "uf2/configkeys.h" + +__attribute__((used, section(".bootloaderConfig"))) +const uint32_t bootloaderConfig[] = +{ + /* CF2 START */ + CFG_MAGIC0, CFG_MAGIC1, // magic + 5, 100, // used entries, total entries + + 204, 0x100000, // FLASH_BYTES = 0x100000 + 205, 0x40000, // RAM_BYTES = 0x40000 + 208, (USB_DESC_VID << 16) | USB_DESC_UF2_PID, // BOOTLOADER_BOARD_ID = USB VID+PID, used for verification when updating bootloader via uf2 + 209, 0xada52840, // UF2_FAMILY = 0xada52840 + 210, 0x20, // PINS_PORT_SIZE = PA_32 + + 0, 0, 0, 0, 0, 0, 0, 0 + /* CF2 END */ +}; \ No newline at end of file From 082a0f20641d28da8942ed7cb0fcb84511e7d4cc Mon Sep 17 00:00:00 2001 From: ddB Date: Fri, 4 Jun 2021 10:08:48 +0100 Subject: [PATCH 2/5] added openmoko VID --- src/boards/nrf52840_bboard/board.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/boards/nrf52840_bboard/board.h b/src/boards/nrf52840_bboard/board.h index 6cbf5f4..50e1f71 100644 --- a/src/boards/nrf52840_bboard/board.h +++ b/src/boards/nrf52840_bboard/board.h @@ -55,7 +55,7 @@ //--------------------------------------------------------------------+ // USB //--------------------------------------------------------------------+ -#define USB_DESC_VID 0x239A +#define USB_DESC_VID 0x1d50 #define USB_DESC_UF2_PID 0x0515 #define USB_DESC_CDC_ONLY_PID 0x0516 From 2e59aa3a6bac6c31e963c15beb5e1814ab387b77 Mon Sep 17 00:00:00 2001 From: ddB Date: Fri, 4 Jun 2021 14:46:43 +0100 Subject: [PATCH 3/5] changed PID as suggested on openmoko PR --- src/boards/nrf52840_bboard/board.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/boards/nrf52840_bboard/board.h b/src/boards/nrf52840_bboard/board.h index 50e1f71..2c23575 100644 --- a/src/boards/nrf52840_bboard/board.h +++ b/src/boards/nrf52840_bboard/board.h @@ -56,8 +56,8 @@ // USB //--------------------------------------------------------------------+ #define USB_DESC_VID 0x1d50 -#define USB_DESC_UF2_PID 0x0515 -#define USB_DESC_CDC_ONLY_PID 0x0516 +#define USB_DESC_UF2_PID 0x6158 +#define USB_DESC_CDC_ONLY_PID 0x6157 //------------- UF2 -------------// #define UF2_PRODUCT_NAME "nRF52840 BBoard" From 166db6d56152032ae16b8cfa923676d086b9cb9f Mon Sep 17 00:00:00 2001 From: ddB0515 Date: Thu, 30 Dec 2021 14:06:47 +0000 Subject: [PATCH 4/5] fixed board order --- .github/workflows/githubci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/githubci.yml b/.github/workflows/githubci.yml index 6d6d076..8135bd5 100644 --- a/.github/workflows/githubci.yml +++ b/.github/workflows/githubci.yml @@ -42,8 +42,8 @@ jobs: - 'mdk_nrf52840_dongle' - 'mikoto' - 'nice_nano' - - 'nrf52840_m2' - 'nrf52840_bboard' + - 'nrf52840_m2' - 'ohs2020_badge' - 'particle_argon' - 'particle_boron' From 8021308f2aacfa7f464a9b612ca64d6eda19198a Mon Sep 17 00:00:00 2001 From: ddB0515 Date: Thu, 30 Dec 2021 14:19:16 +0000 Subject: [PATCH 5/5] changed PID as suggested in PR comment --- src/boards/nrf52840_bboard/board.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/boards/nrf52840_bboard/board.h b/src/boards/nrf52840_bboard/board.h index 2c23575..515201d 100644 --- a/src/boards/nrf52840_bboard/board.h +++ b/src/boards/nrf52840_bboard/board.h @@ -56,7 +56,7 @@ // USB //--------------------------------------------------------------------+ #define USB_DESC_VID 0x1d50 -#define USB_DESC_UF2_PID 0x6158 +#define USB_DESC_UF2_PID 0x6157 #define USB_DESC_CDC_ONLY_PID 0x6157 //------------- UF2 -------------//