Skip to content

Commit e75aa4f

Browse files
authored
Merge pull request #267 from PontusO/master
Adds support for the Challenger 840 BLE board
2 parents 150a8a5 + 787de9b commit e75aa4f

File tree

6 files changed

+111
-5
lines changed

6 files changed

+111
-5
lines changed

.github/workflows/githubci.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
- 'bast_ble'
3535
- 'bluemicro_nrf52833'
3636
- 'bluemicro_nrf52840'
37+
- 'challenger_840_ble'
3738
- 'ebyte_e104_bt5032a'
3839
- 'ebyte_e73_tbb'
3940
- 'electronut_labs_papyr'
@@ -60,7 +61,7 @@ jobs:
6061
steps:
6162
- name: Setup Python
6263
uses: actions/setup-python@v3
63-
64+
6465
- name: Checkout Code
6566
uses: actions/checkout@v3
6667
with:
@@ -97,15 +98,15 @@ jobs:
9798
run: |
9899
pip3 install adafruit-nrfutil uritemplate requests intelhex
99100
pip3 install linkermap/
100-
101+
101102
- name: Build
102103
run: |
103104
make BOARD=${{ matrix.board }} all
104105
make BOARD=${{ matrix.board }} copy-artifact
105106
106107
- name: Linker Map
107108
run: make BOARD=${{ matrix.board }} linkermap
108-
109+
109110
- uses: actions/upload-artifact@v3
110111
with:
111112
name: ${{ matrix.board }}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ This is a CDC/DFU/UF2 bootloader for nRF52 boards.
1414
- Adafruit Metro nRF52840 Express
1515
- [Akizukidenshi AE-BL652-BO](https://akizukidenshi.com/catalog/g/gK-15567/)
1616
- [Electronut Labs Papyr](https://docs.electronut.in/papyr/)
17+
- [iLabs Challenger 840 BLE](https://ilabs.se/challenger-840-ble-datasheet/)
1718
- [MakerDiary MDK nRF52840 USB Dongle](https://makerdiary.com/products/nrf52840-mdk-usb-dongle)
1819
- [MakerDiary nRF52840 M.2 Module](https://makerdiary.com/products/nrf52840-m2-module)
1920
- [Nordic nRF52840DK PCA10056](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK)
@@ -79,7 +80,7 @@ For other boards, please check the board definition for details.
7980
8081
### Making your own UF2
8182
82-
To create your own UF2 DFU update image, simply use the [Python conversion script](https://github.com/Microsoft/uf2/blob/master/utils/uf2conv.py) on a .bin file or .hex file, specifying the family as **0xADA52840** (nRF52840) or **0x621E937A** (nRF52833).
83+
To create your own UF2 DFU update image, simply use the [Python conversion script](https://github.com/Microsoft/uf2/blob/master/utils/uf2conv.py) on a .bin file or .hex file, specifying the family as **0xADA52840** (nRF52840) or **0x621E937A** (nRF52833).
8384
8485
```
8586
nRF52840
@@ -202,4 +203,3 @@ pip install intelhex
202203

203204
Make sure that `nrfjprog` is available from the command-line. This binary is
204205
part of Nordic's nRF5x Command Line Tools.
205-

src/boards/boards.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ bool button_pressed(uint32_t pin)
6262
return nrf_gpio_pin_read(pin) == active_state;
6363
}
6464

65+
// This is declared so that a board specific init can be called from here.
66+
void __attribute__((weak)) board_init_extra(void) { }
6567
void board_init(void)
6668
{
6769
// stop LF clock just in case we jump from application without reset
@@ -93,6 +95,8 @@ void board_init(void)
9395
#if ENABLE_DCDC_1 == 1
9496
NRF_POWER->DCDCEN = 1;
9597
#endif
98+
// Make sure any custom inits are performed
99+
board_init_extra();
96100

97101
// When board is supplied on VDDH (and not VDD), this specifies what voltage the GPIO should run at
98102
// and what voltage is output at VDD. The default (0xffffffff) is 1.8V; typically you'll want

src/boards/challenger_840_ble/board.h

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2018 Ha Thach for Adafruit Industries, 2022 Invector Labs
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in
14+
* all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
* THE SOFTWARE.
23+
*/
24+
25+
#ifndef _CHALLENGER_840_BLE_H
26+
#define _CHALLENGER_840_BLE_H
27+
28+
#define _PINNUM(port, pin) ((port)*32 + (pin))
29+
30+
/*------------------------------------------------------------------*/
31+
/* LED
32+
*------------------------------------------------------------------*/
33+
#define LEDS_NUMBER 1
34+
#define LED_PRIMARY_PIN _PINNUM(0, 12)
35+
#define LED_STATE_ON 1
36+
37+
#define LED_NEOPIXEL _PINNUM(1, 8)
38+
#define NEOPIXELS_NUMBER 1
39+
#define BOARD_RGB_BRIGHTNESS 0x040404
40+
41+
/*------------------------------------------------------------------*/
42+
/* BUTTON
43+
*------------------------------------------------------------------*/
44+
#define BUTTONS_NUMBER 2
45+
#define BUTTON_1 _PINNUM(0, 19)
46+
#define BUTTON_2 _PINNUM(0, 8) // Pulls flash cs high
47+
#define BUTTON_PULL NRF_GPIO_PIN_PULLUP
48+
49+
/*------------------------------------------------------------------*/
50+
/* On board LDO control
51+
*------------------------------------------------------------------*/
52+
#define LDO_CONTROL_PIN _PINNUM(1, 9) // Enables external pwr
53+
54+
//--------------------------------------------------------------------+
55+
// BLE OTA
56+
//--------------------------------------------------------------------+
57+
#define BLEDIS_MANUFACTURER "Invector Labs"
58+
#define BLEDIS_MODEL "Challenger 840 BLE"
59+
60+
//--------------------------------------------------------------------+
61+
// USB
62+
//--------------------------------------------------------------------+
63+
#define USB_DESC_VID 0x1209
64+
#define USB_DESC_UF2_PID 0x7380
65+
#define USB_DESC_CDC_ONLY_PID 0x7381
66+
67+
//------------- UF2 -------------//
68+
#define UF2_PRODUCT_NAME "ILabs Challenger 840"
69+
#define UF2_VOLUME_LABEL "CH840BOOT"
70+
#define UF2_BOARD_ID "nRF52840-Challenger-840"
71+
#define UF2_INDEX_URL "https://www.ilabs.se"
72+
73+
#endif // _CHALLENGER_840_BLE_H
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
MCU_SUB_VARIANT = nrf52840
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include "boards.h"
2+
#include "board.h"
3+
#include "uf2/configkeys.h"
4+
5+
__attribute__((used, section(".bootloaderConfig")))
6+
const uint32_t bootloaderConfig[] =
7+
{
8+
/* CF2 START */
9+
CFG_MAGIC0, CFG_MAGIC1, // magic
10+
5, 100, // used entries, total entries
11+
12+
204, 0x100000, // FLASH_BYTES = 0x100000
13+
205, 0x40000, // RAM_BYTES = 0x40000
14+
208, (USB_DESC_VID << 16) | USB_DESC_UF2_PID, // BOOTLOADER_BOARD_ID = USB VID+PID, used for verification when updating bootloader via uf2
15+
209, 0xada52840, // UF2_FAMILY = 0xada52840
16+
210, 0x20, // PINS_PORT_SIZE = PA_32
17+
18+
0, 0, 0, 0, 0, 0, 0, 0
19+
/* CF2 END */
20+
};
21+
22+
void board_init_extra(void)
23+
{
24+
// Turn LDO on
25+
nrf_gpio_cfg_output(LDO_CONTROL_PIN);
26+
nrf_gpio_pin_write(LDO_CONTROL_PIN, 1);
27+
}

0 commit comments

Comments
 (0)