Compare commits
43 Commits
Author | SHA1 | Date |
---|---|---|
ml server | dd7f0d2772 | |
ml server | d6c45a3ded | |
ml server | b5b5dde8a3 | |
ml server | 0b385d7efa | |
ml server | e4b64b0814 | |
Daniel Thompson | 1d128f1311 | |
Daniel Thompson | 477d2e07db | |
Daniel Thompson | 91fad65a8a | |
Daniel Thompson | efa4942659 | |
Daniel Thompson | 89ba9a874f | |
Daniel Thompson | 85a9b76d84 | |
SteveAmor | 9148e76c41 | |
Daniel Thompson | 71f37dd5b2 | |
Daniel Thompson | 21bcf675a4 | |
Daniel Thompson | d8d7d76b17 | |
Daniel Thompson | 7786926950 | |
Daniel Thompson | 6e5c33824e | |
Daniel Thompson | b89f9d43b9 | |
Daniel Thompson | 1e7d8c327d | |
Daniel Thompson | 0125b3e49b | |
Daniel Thompson | 660aa3247c | |
Daniel Thompson | a56548132e | |
Daniel Thompson | 9734651778 | |
Daniel Thompson | 0d74a6efca | |
Daniel Thompson | 20f5764f64 | |
Daniel Thompson | fb03ef1dda | |
Daniel Thompson | cfe6b69534 | |
Daniel Thompson | be3f01a002 | |
Daniel Thompson | 27207cba4d | |
fanoush | b6857b85f0 | |
Daniel Thompson | 4d0e439229 | |
Daniel Thompson | 9806b15d5c | |
Daniel Thompson | 04ee6a92a7 | |
Daniel Thompson | 561d8ff427 | |
Daniel Thompson | 3e490f882f | |
Daniel Thompson | bb7841bec8 | |
fanoush | 18e7f3eeb3 | |
Daniel Thompson | 1d2dfa955d | |
fanoush | 282fd12bba | |
Limor "Ladyada" Fried | 6c2867bc00 | |
Michael Welling | 9c6c0d3031 | |
Ha Thach | db63651473 | |
Benny Meisels | 32bfb2adae |
|
@ -56,3 +56,4 @@ _build-*/
|
|||
bin/
|
||||
*.emSession
|
||||
*.jlink
|
||||
.*.swp
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[submodule "tinyusb"]
|
||||
[submodule "lib/tinyusb"]
|
||||
path = lib/tinyusb
|
||||
url = https://github.com/hathach/tinyusb.git
|
||||
url = https://mirrors.spacecruft.org/hathach/tinyusb
|
||||
[submodule "lib/nrfx"]
|
||||
path = lib/nrfx
|
||||
url = https://github.com/NordicSemiconductor/nrfx.git
|
||||
url = https://mirrors.spacecruft.org/NordicSemiconductor/nrfx
|
||||
|
|
2
Makefile
2
Makefile
|
@ -244,7 +244,7 @@ CFLAGS += -DBLE_STACK_SUPPORT_REQD
|
|||
CFLAGS += -DSWI_DISABLE0
|
||||
CFLAGS += -DSOFTDEVICE_PRESENT
|
||||
CFLAGS += -DFLOAT_ABI_HARD
|
||||
CFLAGS += -DDFU_APP_DATA_RESERVED=7*4096
|
||||
CFLAGS += -DDFU_APP_DATA_RESERVED=0
|
||||
CFLAGS += $(MCU_FLAGS)
|
||||
|
||||
CFLAGS += -DUF2_VERSION='"$(GIT_VERSION) $(GIT_SUBMODULE_VERSIONS) $(SD_NAME) $(SD_VERSION)"'
|
||||
|
|
|
@ -0,0 +1,218 @@
|
|||
# WASP bootloader
|
||||
|
||||
The WASP bootloader is a fork of the Adafruit nRF52 Bootloader modified to robustly
|
||||
support form factor devices without a reset button and, in some cases, also no serial
|
||||
port. If supports OTA application updates and to support development using form-factor
|
||||
devices the WASP bootloader co-operates with the application payload to implement a,
|
||||
watchdog enforced, a long press reset using regular (not-reset) buttons.
|
||||
|
||||
The additional boards supported by the WASP bootloader are:
|
||||
|
||||
* [Pine64 PineTime](https://www.pine64.org/pinetime/)
|
||||
* [Desay DS-D6](https://github.com/fanoush/ds-d6)
|
||||
* [96Boards Nitrogen](https://www.96boards.org/product/nitrogen/)
|
||||
|
||||
Note: *The Nitrogen is not a form-factor board. It is a test target used to test for regressions before spending time pushing the bootloader to the form-factor devices.*
|
||||
|
||||
# Adafruit nRF52 Bootloader
|
||||
|
||||
[![Build Status](https://github.com/adafruit/Adafruit_nRF52_Bootloader/workflows/Build/badge.svg)](https://github.com/adafruit/Adafruit_nRF52_Bootloader/actions)
|
||||
|
||||
This is a CDC/DFU/UF2 bootloader for nRF52 boards.
|
||||
|
||||
- [Adafruit Feather nRF52832](https://www.adafruit.com/product/3406)
|
||||
- [Adafruit Feather nRF52840 Express](https://www.adafruit.com/product/4062)
|
||||
- [Adafruit Circuit Playground Bluefruit](https://www.adafruit.com/product/4333)
|
||||
- Adafruit Metro nRF52840 Express
|
||||
- [Electronut Labs Papyr](https://docs.electronut.in/papyr/)
|
||||
- MakerDiary MDK nRF52840 USB Dongle
|
||||
- [Nordic nRF52840DK PCA10056](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK)
|
||||
- [Nordic nRF52840DK PCA10059 ("Dongle")](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-Dongle)
|
||||
- Particle Argon
|
||||
- Particle Boron
|
||||
- Particle Xenon
|
||||
|
||||
UF2 is an easy-to-use bootloader that appears as a flash drive. You can just copy `.uf2`-format
|
||||
application images to the flash drive to load new firmware.
|
||||
See https://github.com/Microsoft/uf2 and https://github.com/adafruit/uf2-samdx1
|
||||
for more information.
|
||||
|
||||
[adafruit-nrfutil](https://github.com/adafruit/Adafruit_nRF52_nrfutil),
|
||||
a modified version of [Nordic nrfutil](https://github.com/NordicSemiconductor/pc-nrfutil),
|
||||
is required to perform DFU.
|
||||
Install `python3` if it is not installed already and run this command to install adafruit-nrfutil from PyPi:
|
||||
|
||||
```
|
||||
$ pip3 install --user adafruit-nrfutil
|
||||
```
|
||||
|
||||
This repository depends on the following submodules:
|
||||
|
||||
- [tinyusb](https://github.com/hathach/tinyusb)
|
||||
- [nrfx](https://github.com/NordicSemiconductor/nrfx)
|
||||
|
||||
Note that `tinyusb` also includes `nrfx` as a submodule, so you need
|
||||
to initialize and update submodules with the `--recursive`` flag.
|
||||
|
||||
Clone this repo with following commands, or fork it for your own development
|
||||
|
||||
```
|
||||
git clone https://github.com/adafruit/Adafruit_nRF52_Bootloader
|
||||
cd Adafruit_nRF52_Bootloader
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
- DFU over Serial and OTA ( application, Bootloader+SD )
|
||||
- Self-upgradable via Serial and OTA
|
||||
- DFU using UF2 (https://github.com/Microsoft/uf2) (application only)
|
||||
- Auto-enter DFU briefly on startup for DTR auto-reset trick (832 only)
|
||||
|
||||
## How to use
|
||||
|
||||
There are two pins, `DFU` and `FRST` that bootloader will check upon reset/power:
|
||||
|
||||
- `Double Reset` Reset twice within 500 ms will enter DFU with UF2 and CDC support (only works with nRF52840)
|
||||
- `DFU = LOW` and `FRST = HIGH`: Enter bootloader with UF2 and CDC support
|
||||
- `DFU = LOW` and `FRST = LOW`: Enter bootloader with OTA, to upgrade with a mobile application such as Nordic nrfConnect/Toolbox
|
||||
- `DFU = HIGH` and `FRST = LOW`: Factory Reset mode: erase firmware application and its data
|
||||
- `DFU = HIGH` and `FRST = HIGH`: Go to application code if it is present, otherwise enter DFU with UF2
|
||||
- The `GPREGRET` register can also be set to force the bootloader can enter any of above modes (plus a CDC-only mode for Arduino).
|
||||
`GPREGRET` is set by the application before performing a soft reset.
|
||||
|
||||
On the Nordic PCA10056 DK board, `DFU` is connected to **Button1**, and `FRST` is connected to **Button2**.
|
||||
So holding down **Button1** while clicking **RESET** will put the board into USB bootloader mode, with UF2 and CDC support.
|
||||
Holding down **Button2** while clicking **RESET** will put the board into OTA (over-the-air) bootloader mode.
|
||||
|
||||
On the Nordic PCA10059 Dongle board, `DFU` is connected to the white button.
|
||||
`FRST` is connected to pin 1.10. Ground it to pull `FRST` low, as if you had pushed an `FRST` button.
|
||||
There is an adjacent ground pad.
|
||||
|
||||
For other boards, please check the board definition for details.
|
||||
|
||||
### Making your own UF2
|
||||
|
||||
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**. If using a .bin file with the conversion script you must specify application address with the -b switch, this address depend on the SoftDevice size/version e.g S140 v6 is 0x26000
|
||||
|
||||
To create a UF2 image from a .bin file:
|
||||
```
|
||||
uf2conv.py firmware.bin -c -b 0x26000 -f 0xADA52840
|
||||
```
|
||||
|
||||
To create a UF2 image from a .hex file:
|
||||
```
|
||||
uf2conv.py firmware.hex -c -f 0xADA52840
|
||||
```
|
||||
|
||||
## Burn & Upgrade with pre-built binaries
|
||||
|
||||
You can burn and/or upgrade the bootloader with either a J-link or DFU (serial) to a specific pre-built binary version
|
||||
without the hassle of installing a toolchain and compiling the code.
|
||||
This is preferred if you are not developing/customizing the bootloader.
|
||||
Pre-builtin binaries are available on GitHub [releases](https://github.com/adafruit/Adafruit_nRF52_Bootloader/releases)
|
||||
|
||||
Note: The bootloader can be downgraded. Since the binary release is a merged version of
|
||||
both bootloader and the Nordic SoftDevice, you can freely upgrade/downgrade to any version you like.
|
||||
|
||||
## How to compile and build
|
||||
|
||||
You should only continue if you are looking to develop bootloader for your own.
|
||||
You must have have a J-Link available to "unbrick" your device.
|
||||
|
||||
### Option 1: Build with Makefile
|
||||
|
||||
Prerequisites
|
||||
|
||||
- ARM GCC
|
||||
- Nordic's [nRF5x Command Line Tools](https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Command-Line-Tools)
|
||||
|
||||
To build:
|
||||
|
||||
```
|
||||
make BOARD=feather_nrf52840_express all combinehex
|
||||
```
|
||||
|
||||
To flash the bootloader with JLink:
|
||||
|
||||
```
|
||||
make BOARD=feather_nrf52840_express flash
|
||||
```
|
||||
|
||||
To upgrade the bootloader using DFU Serial via port /dev/ttyACM0
|
||||
|
||||
```
|
||||
make BOARD=feather_nrf52840_express SERIAL=/dev/ttyACM0 dfu-flash
|
||||
```
|
||||
|
||||
To flash SoftDevice (and chip erase):
|
||||
|
||||
```
|
||||
make BOARD=feather_nrf52840_express sd
|
||||
```
|
||||
|
||||
To erase all of flash:
|
||||
|
||||
```
|
||||
make BOARD=feather_nrf52840_express erase
|
||||
```
|
||||
|
||||
For the list of supported boards, run `make` without `BOARD=` :
|
||||
|
||||
```
|
||||
$ make
|
||||
You must provide a BOARD parameter with 'BOARD='
|
||||
Supported boards are: feather_nrf52840_express feather_nrf52840_express pca10056
|
||||
Makefile:90: *** BOARD not defined. Stop
|
||||
```
|
||||
|
||||
### Common makefile problems
|
||||
|
||||
#### 1. `arm-none-eabi-gcc`: No such file or directory
|
||||
|
||||
If you get the following error ...
|
||||
|
||||
```
|
||||
$ make BOARD=feather_nrf52840_express all
|
||||
Compiling file: main.c
|
||||
/bin/sh: /usr/bin/arm-none-eabi-gcc: No such file or directory
|
||||
make: *** [_build/main.o] Error 127
|
||||
```
|
||||
|
||||
... you may need to pass the location of the GCC ARM toolchain binaries to `make` using
|
||||
the variable `GNU_INSTALL_ROOT` as below:
|
||||
```
|
||||
$ make GNU_INSTALL_ROOT=/opt/gcc-arm-none-eabi-9-2019-q4-major/bin/ BOARD=feather_nrf52832 all
|
||||
```
|
||||
|
||||
_Please note that the path needs a trailing path separator (a `/`)_
|
||||
|
||||
#### 2. `mergehex: No such file or directory`
|
||||
|
||||
Make sure that `mergehex` is available from the command-line. This binary is
|
||||
part of Nordic's nRF5x Command Line Tools.
|
||||
|
||||
#### 3. `make: nrfjprog: No such file or directory`
|
||||
|
||||
Make sure that `nrfjprog` is available from the command-line. This binary is
|
||||
part of Nordic's nRF5x Command Line Tools.
|
||||
|
||||
On POSIX-type systems you can temporarily add the path to `nrfjprog` via a
|
||||
variation on the following command:
|
||||
|
||||
```
|
||||
$ export PATH=$PATH:/location/of/nRF5x-Command-Line-Tools_9_7_2_OSX/nrfjprog
|
||||
```
|
||||
|
||||
### Option 2: Build using Segger Embedded Studio
|
||||
|
||||
For easier debugging you can also use [SES](https://www.segger.com/products/development-tools/embedded-studio/).
|
||||
The project file is located at `src/segger/Adafruit_nRF52_Bootloader.emProject`.
|
||||
|
||||
> **Note**: SES only flashes the bootloader when you click download, not the SoftDevice.
|
||||
You need to flash the SoftDevice beforehand if you haven't already done so.
|
||||
As mentioned above do something like:
|
||||
|
||||
```
|
||||
make BOARD=feather_nrf52840_express sd
|
||||
```
|
203
README.md
203
README.md
|
@ -1,202 +1,3 @@
|
|||
# Adafruit nRF52 Bootloader
|
||||
# jebbatime-bootloader
|
||||
Lesser fork of Daniel Thompson's wasp-os bootloader.
|
||||
|
||||
[![Build Status](https://github.com/adafruit/Adafruit_nRF52_Bootloader/workflows/Build/badge.svg)](https://github.com/adafruit/Adafruit_nRF52_Bootloader/actions)
|
||||
|
||||
This is a CDC/DFU/UF2 bootloader for nRF52 boards.
|
||||
|
||||
- [Adafruit Feather nRF52832](https://www.adafruit.com/product/3406)
|
||||
- [Adafruit Feather nRF52840 Express](https://www.adafruit.com/product/4062)
|
||||
- [Adafruit Circuit Playground Bluefruit](https://www.adafruit.com/product/4333)
|
||||
- Adafruit Metro nRF52840 Express
|
||||
- [Electronut Labs Papyr](https://docs.electronut.in/papyr/)
|
||||
- MakerDiary MDK nRF52840 USB Dongle
|
||||
- [Nordic nRF52840DK PCA10056](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK)
|
||||
- [Nordic nRF52840DK PCA10059 ("Dongle")](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-Dongle)
|
||||
- Particle Argon
|
||||
- Particle Boron
|
||||
- Particle Xenon
|
||||
|
||||
UF2 is an easy-to-use bootloader that appears as a flash drive. You can just copy `.uf2`-format
|
||||
application images to the flash drive to load new firmware.
|
||||
See https://github.com/Microsoft/uf2 and https://github.com/adafruit/uf2-samdx1
|
||||
for more information.
|
||||
|
||||
[adafruit-nrfutil](https://github.com/adafruit/Adafruit_nRF52_nrfutil),
|
||||
a modified version of [Nordic nrfutil](https://github.com/NordicSemiconductor/pc-nrfutil),
|
||||
is required to perform DFU.
|
||||
Install `python3` if it is not installed already and run this command to install adafruit-nrfutil from PyPi:
|
||||
|
||||
```
|
||||
$ pip3 install --user adafruit-nrfutil
|
||||
```
|
||||
|
||||
This repository depends on the following submodules:
|
||||
|
||||
- [tinyusb](https://github.com/hathach/tinyusb)
|
||||
- [nrfx](https://github.com/NordicSemiconductor/nrfx)
|
||||
|
||||
Note that `tinyusb` also includes `nrfx` as a submodule, so you need
|
||||
to initialize and update submodules with the `--recursive`` flag.
|
||||
|
||||
Clone this repo with following commands, or fork it for your own development
|
||||
|
||||
```
|
||||
git clone https://github.com/adafruit/Adafruit_nRF52_Bootloader
|
||||
cd Adafruit_nRF52_Bootloader
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
- DFU over Serial and OTA ( application, Bootloader+SD )
|
||||
- Self-upgradable via Serial and OTA
|
||||
- DFU using UF2 (https://github.com/Microsoft/uf2) (application only)
|
||||
- Auto-enter DFU briefly on startup for DTR auto-reset trick (832 only)
|
||||
|
||||
## How to use
|
||||
|
||||
There are two pins, `DFU` and `FRST` that bootloader will check upon reset/power:
|
||||
|
||||
- `Double Reset` Reset twice within 500 ms will enter DFU with UF2 and CDC support (only works with nRF52840)
|
||||
- `DFU = LOW` and `FRST = HIGH`: Enter bootloader with UF2 and CDC support
|
||||
- `DFU = LOW` and `FRST = LOW`: Enter bootloader with OTA, to upgrade with a mobile application such as Nordic nrfConnect/Toolbox
|
||||
- `DFU = HIGH` and `FRST = LOW`: Factory Reset mode: erase firmware application and its data
|
||||
- `DFU = HIGH` and `FRST = HIGH`: Go to application code if it is present, otherwise enter DFU with UF2
|
||||
- The `GPREGRET` register can also be set to force the bootloader can enter any of above modes (plus a CDC-only mode for Arduino).
|
||||
`GPREGRET` is set by the application before performing a soft reset.
|
||||
|
||||
On the Nordic PCA10056 DK board, `DFU` is connected to **Button1**, and `FRST` is connected to **Button2**.
|
||||
So holding down **Button1** while clicking **RESET** will put the board into USB bootloader mode, with UF2 and CDC support.
|
||||
Holding down **Button2** while clicking **RESET** will put the board into OTA (over-the-air) bootloader mode.
|
||||
|
||||
On the Nordic PCA10059 Dongle board, `DFU` is connected to the white button.
|
||||
`FRST` is connected to pin 1.10. Ground it to pull `FRST` low, as if you had pushed an `FRST` button.
|
||||
There is an adjacent ground pad.
|
||||
|
||||
For other boards, please check the board definition for details.
|
||||
|
||||
### Making your own UF2
|
||||
|
||||
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**. If using a .bin file with the conversion script you must specify application address with the -b switch, this address depend on the SoftDevice size/version e.g S140 v6 is 0x26000
|
||||
|
||||
To create a UF2 image from a .bin file:
|
||||
```
|
||||
uf2conv.py firmware.bin -c -b 0x26000 -f 0xADA52840
|
||||
```
|
||||
|
||||
To create a UF2 image from a .hex file:
|
||||
```
|
||||
uf2conv.py firmware.hex -c -f 0xADA52840
|
||||
```
|
||||
|
||||
## Burn & Upgrade with pre-built binaries
|
||||
|
||||
You can burn and/or upgrade the bootloader with either a J-link or DFU (serial) to a specific pre-built binary version
|
||||
without the hassle of installing a toolchain and compiling the code.
|
||||
This is preferred if you are not developing/customizing the bootloader.
|
||||
Pre-builtin binaries are available on GitHub [releases](https://github.com/adafruit/Adafruit_nRF52_Bootloader/releases)
|
||||
|
||||
Note: The bootloader can be downgraded. Since the binary release is a merged version of
|
||||
both bootloader and the Nordic SoftDevice, you can freely upgrade/downgrade to any version you like.
|
||||
|
||||
## How to compile and build
|
||||
|
||||
You should only continue if you are looking to develop bootloader for your own.
|
||||
You must have have a J-Link available to "unbrick" your device.
|
||||
|
||||
### Option 1: Build with Makefile
|
||||
|
||||
Prerequisites
|
||||
|
||||
- ARM GCC
|
||||
- Nordic's [nRF5x Command Line Tools](https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Command-Line-Tools)
|
||||
|
||||
To build:
|
||||
|
||||
```
|
||||
make BOARD=feather_nrf52840_express all combinehex
|
||||
```
|
||||
|
||||
To flash the bootloader with JLink:
|
||||
|
||||
```
|
||||
make BOARD=feather_nrf52840_express flash
|
||||
```
|
||||
|
||||
To upgrade the bootloader using DFU Serial via port /dev/ttyACM0
|
||||
|
||||
```
|
||||
make BOARD=feather_nrf52840_express SERIAL=/dev/ttyACM0 dfu-flash
|
||||
```
|
||||
|
||||
To flash SoftDevice (and chip erase):
|
||||
|
||||
```
|
||||
make BOARD=feather_nrf52840_express sd
|
||||
```
|
||||
|
||||
To erase all of flash:
|
||||
|
||||
```
|
||||
make BOARD=feather_nrf52840_express erase
|
||||
```
|
||||
|
||||
For the list of supported boards, run `make` without `BOARD=` :
|
||||
|
||||
```
|
||||
$ make
|
||||
You must provide a BOARD parameter with 'BOARD='
|
||||
Supported boards are: feather_nrf52840_express feather_nrf52840_express pca10056
|
||||
Makefile:90: *** BOARD not defined. Stop
|
||||
```
|
||||
|
||||
### Common makefile problems
|
||||
|
||||
#### 1. `arm-none-eabi-gcc`: No such file or directory
|
||||
|
||||
If you get the following error ...
|
||||
|
||||
```
|
||||
$ make BOARD=feather_nrf52840_express all
|
||||
Compiling file: main.c
|
||||
/bin/sh: /usr/bin/arm-none-eabi-gcc: No such file or directory
|
||||
make: *** [_build/main.o] Error 127
|
||||
```
|
||||
|
||||
... you may need to pass the location of the GCC ARM toolchain binaries to `make` using
|
||||
the variable `GNU_INSTALL_ROOT` as below:
|
||||
```
|
||||
$ make GNU_INSTALL_ROOT=/opt/gcc-arm-none-eabi-9-2019-q4-major/bin/ BOARD=feather_nrf52832 all
|
||||
```
|
||||
|
||||
_Please note that the path needs a trailing path separator (a `/`)_
|
||||
|
||||
#### 2. `mergehex: No such file or directory`
|
||||
|
||||
Make sure that `mergehex` is available from the command-line. This binary is
|
||||
part of Nordic's nRF5x Command Line Tools.
|
||||
|
||||
#### 3. `make: nrfjprog: No such file or directory`
|
||||
|
||||
Make sure that `nrfjprog` is available from the command-line. This binary is
|
||||
part of Nordic's nRF5x Command Line Tools.
|
||||
|
||||
On POSIX-type systems you can temporarily add the path to `nrfjprog` via a
|
||||
variation on the following command:
|
||||
|
||||
```
|
||||
$ export PATH=$PATH:/location/of/nRF5x-Command-Line-Tools_9_7_2_OSX/nrfjprog
|
||||
```
|
||||
|
||||
### Option 2: Build using Segger Embedded Studio
|
||||
|
||||
For easier debugging you can also use [SES](https://www.segger.com/products/development-tools/embedded-studio/).
|
||||
The project file is located at `src/segger/Adafruit_nRF52_Bootloader.emProject`.
|
||||
|
||||
> **Note**: SES only flashes the bootloader when you click download, not the SoftDevice.
|
||||
You need to flash the SoftDevice beforehand if you haven't already done so.
|
||||
As mentioned above do something like:
|
||||
|
||||
```
|
||||
make BOARD=feather_nrf52840_express sd
|
||||
```
|
||||
|
|
2
lib/nrfx
2
lib/nrfx
|
@ -1 +1 @@
|
|||
Subproject commit 7a4c9d946cf1801771fc180acdbf7b878f270093
|
||||
Subproject commit b5399066bd7f3dc32ee15510d06ef7137bcacf36
|
|
@ -47,7 +47,10 @@ enum { BLE_CONN_CFG_HIGH_BANDWIDTH = 1 };
|
|||
#define BLE_HANDLE_MAX 0xFFFF /**< Max handle value is BLE. */
|
||||
|
||||
// limit of 8 chars
|
||||
#define DEVICE_NAME "AdaDFU" /**< Name of device. Will be included in the advertising data. */
|
||||
#ifndef BLEDIS_DEVICE_NAME
|
||||
#define BLEDIS_DEVICE_NAME "AdaDFU"
|
||||
#endif
|
||||
#define DEVICE_NAME BLEDIS_DEVICE_NAME /**< Name of device. Will be included in the advertising data. */
|
||||
|
||||
#define MIN_CONN_INTERVAL (uint16_t)(MSEC_TO_UNITS(10, UNIT_1_25_MS)) /**< Minimum acceptable connection interval (11.25 milliseconds). */
|
||||
#define MAX_CONN_INTERVAL (uint16_t)(MSEC_TO_UNITS(30, UNIT_1_25_MS)) /**< Maximum acceptable connection interval (15 milliseconds). */
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
// Flash = 512 KB
|
||||
#if defined(NRF52832_XXAA) || defined(NRF52833_XXAA)
|
||||
|
||||
#define BOOTLOADER_REGION_START 0x00074000 /**< This field should correspond to start address of the bootloader, found in UICR.RESERVED, 0x10001014, register. This value is used for sanity check, so the bootloader will fail immediately if this value differs from runtime value. The value is used to determine max application size for updating. */
|
||||
#define BOOTLOADER_REGION_START 0x00078000 /**< This field should correspond to start address of the bootloader, found in UICR.RESERVED, 0x10001014, register. This value is used for sanity check, so the bootloader will fail immediately if this value differs from runtime value. The value is used to determine max application size for updating. */
|
||||
#define BOOTLOADER_SETTINGS_ADDRESS 0x0007F000 /**< The field specifies the page location of the bootloader settings address. */
|
||||
#define BOOTLOADER_MBR_PARAMS_PAGE_ADDRESS 0x0007E000 /**< The field specifies the page location of the mbr params page address. */
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 23df777b301af128d3543e286cd865212214b44d
|
||||
Subproject commit 2b5bad7362f96ed376d0cc6e68c5ea1fc00dd4a4
|
577
src/boards.c
577
src/boards.c
|
@ -23,9 +23,12 @@
|
|||
*/
|
||||
|
||||
#include "boards.h"
|
||||
#include "nrf_spi.h"
|
||||
#include "nrf_pwm.h"
|
||||
#include "nrf_wdt.h"
|
||||
#include "app_scheduler.h"
|
||||
#include "app_timer.h"
|
||||
#include "pnvram.h"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// MACRO TYPEDEF CONSTANT ENUM DECLARATION
|
||||
|
@ -39,27 +42,41 @@
|
|||
void neopixel_teardown(void);
|
||||
#endif
|
||||
|
||||
#ifdef ST7789_SPI_DISPLAY
|
||||
void st7789_init(void);
|
||||
void st7789_state(int state);
|
||||
void st7789_teardown(void);
|
||||
#endif
|
||||
|
||||
//------------- IMPLEMENTATION -------------//
|
||||
#if BUTTONS_NUMBER > 0
|
||||
void button_init(uint32_t pin)
|
||||
{
|
||||
if ( BUTTON_PULL == NRF_GPIO_PIN_PULLDOWN )
|
||||
{
|
||||
nrf_gpio_cfg_sense_input(pin, BUTTON_PULL, NRF_GPIO_PIN_SENSE_HIGH);
|
||||
}
|
||||
else
|
||||
{
|
||||
nrf_gpio_cfg_sense_input(pin, BUTTON_PULL, NRF_GPIO_PIN_SENSE_LOW);
|
||||
}
|
||||
nrf_gpio_cfg_sense_input(pin, BUTTON_PULL, NRF_GPIO_PIN_NOSENSE);
|
||||
#ifdef BUTTON_ENABLE
|
||||
/*
|
||||
* BUTTON_ENABLE is used when a switch is connected to another GPIO pin
|
||||
* rather than the Vcc or ground. In the bootloader we'll just permanently
|
||||
* push the enable pin to whatever value the sense pin thinks is the
|
||||
* active one.
|
||||
*/
|
||||
nrf_gpio_cfg_output(BUTTON_ENABLE);
|
||||
nrf_gpio_pin_write(BUTTON_ENABLE, BUTTON_ACTIVE);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool button_pressed(uint32_t pin)
|
||||
{
|
||||
uint32_t const active_state = (BUTTON_PULL == NRF_GPIO_PIN_PULLDOWN ? 1 : 0);
|
||||
return nrf_gpio_pin_read(pin) == active_state;
|
||||
return (nrf_gpio_pin_read(pin) == BUTTON_ACTIVE) ? true : false;
|
||||
}
|
||||
#endif
|
||||
|
||||
void board_init(void)
|
||||
{
|
||||
// the watchdog has a long timeout and, when we are running in bootloader
|
||||
// mode, will be fed by the systick handler
|
||||
wdt_init();
|
||||
|
||||
// stop LF clock just in case we jump from application without reset
|
||||
NRF_CLOCK->TASKS_LFCLKSTOP = 1UL;
|
||||
|
||||
|
@ -67,15 +84,21 @@ void board_init(void)
|
|||
NRF_CLOCK->LFCLKSRC = CLOCK_LFCLKSRC_SRC_RC;
|
||||
NRF_CLOCK->TASKS_LFCLKSTART = 1UL;
|
||||
|
||||
#ifdef BUTTON_DFU
|
||||
button_init(BUTTON_DFU);
|
||||
#endif
|
||||
#ifdef BUTTON_FRESET
|
||||
button_init(BUTTON_FRESET);
|
||||
#endif
|
||||
NRFX_DELAY_US(100); // wait for the pin state is stable
|
||||
|
||||
// use PMW0 for LED RED
|
||||
#if LEDS_NUMBER > 0
|
||||
led_pwm_init(LED_PRIMARY, LED_PRIMARY_PIN);
|
||||
#if LEDS_NUMBER > 1
|
||||
#endif
|
||||
#if LEDS_NUMBER > 1
|
||||
led_pwm_init(LED_SECONDARY, LED_SECONDARY_PIN);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// use neopixel for use enumeration
|
||||
#if defined(LED_NEOPIXEL) || defined(LED_RGB_RED_PIN)
|
||||
|
@ -91,19 +114,30 @@ void board_init(void)
|
|||
// Configure Systick for led blinky
|
||||
NVIC_SetPriority(SysTick_IRQn, 7);
|
||||
SysTick_Config(SystemCoreClock/1000);
|
||||
|
||||
// Bring up the display (if there is one)
|
||||
#ifdef ST7789_SPI_DISPLAY
|
||||
st7789_init();
|
||||
#endif
|
||||
}
|
||||
|
||||
void board_teardown(void)
|
||||
{
|
||||
#ifdef ST7789_SPI_DISPLAY
|
||||
st7789_teardown();
|
||||
#endif
|
||||
|
||||
// Disable systick, turn off LEDs
|
||||
SysTick->CTRL = 0;
|
||||
|
||||
#if LEDS_NUMBER > 0
|
||||
// Disable and reset PWM for LEDs
|
||||
led_pwm_teardown();
|
||||
|
||||
#endif
|
||||
#if defined(LED_NEOPIXEL) || defined(LED_RGB_RED_PIN)
|
||||
neopixel_teardown();
|
||||
#endif
|
||||
|
||||
// Button
|
||||
|
||||
// Stop RTC1 used by app_timer
|
||||
|
@ -118,11 +152,49 @@ void board_teardown(void)
|
|||
}
|
||||
|
||||
static uint32_t _systick_count = 0;
|
||||
#ifdef BUTTON_DFU
|
||||
static uint32_t _long_press_count = 0;
|
||||
#endif
|
||||
void SysTick_Handler(void)
|
||||
{
|
||||
_systick_count++;
|
||||
|
||||
#ifdef NRF52832_XXAA
|
||||
pnvram_add_ms(pnvram, 1);
|
||||
#endif
|
||||
#if LEDS_NUMBER > 0
|
||||
led_tick();
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Feed the dog... this is a backstop. The *only* reason we are running
|
||||
* the watchdog is to help us recover if the bootloader crashes in some
|
||||
* way that makes it impossible for us to reboot using the button test
|
||||
* code below. This is OK to feed it from a periodic interrupt (even
|
||||
* if there is no button it's better to feed the dog than reboot in
|
||||
* the middle of flashing).
|
||||
*/
|
||||
#ifdef BUTTON_DFU
|
||||
if (!button_pressed(BUTTON_DFU))
|
||||
#endif
|
||||
nrf_wdt_reload_request_set(NRF_WDT, 0);
|
||||
|
||||
/*
|
||||
* Detect and (trivially) debounce a press of the DFU button. When
|
||||
* found try to launch the application regardless of the DFU button
|
||||
* state. We ignore the button press for our first few seconds of life
|
||||
* because makes it harder to accidentally start the application when
|
||||
* recovering from a flat battery.
|
||||
*/
|
||||
#ifdef BUTTON_DFU
|
||||
if (button_pressed(BUTTON_DFU)) {
|
||||
if (_systick_count > 2750 && _long_press_count++ > 50) {
|
||||
NRF_POWER->GPREGRET = BOARD_MAGIC_FORCE_APP_BOOT;
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
} else {
|
||||
_long_press_count = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -130,6 +202,7 @@ uint32_t tusb_hal_millis(void)
|
|||
{
|
||||
return ( ( ((uint64_t)app_timer_cnt_get())*1000*(APP_TIMER_CONFIG_RTC_FREQUENCY+1)) / APP_TIMER_CLOCK_FREQ );
|
||||
}
|
||||
#if LEDS_NUMBER > 0
|
||||
|
||||
void pwm_teardown(NRF_PWM_Type* pwm )
|
||||
{
|
||||
|
@ -259,18 +332,18 @@ void led_state(uint32_t state)
|
|||
case STATE_BLE_CONNECTED:
|
||||
new_rgb_color = 0x0000ff;
|
||||
#ifdef LED_SECONDARY_PIN
|
||||
secondary_cycle_length = 3000;
|
||||
secondary_cycle_length = 300;
|
||||
#else
|
||||
primary_cycle_length = 3000;
|
||||
primary_cycle_length = 300;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case STATE_BLE_DISCONNECTED:
|
||||
new_rgb_color = 0xff00ff;
|
||||
#ifdef LED_SECONDARY_PIN
|
||||
secondary_cycle_length = 300;
|
||||
secondary_cycle_length = 3000;
|
||||
#else
|
||||
primary_cycle_length = 300;
|
||||
primary_cycle_length = 3000;
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
@ -297,6 +370,14 @@ void led_state(uint32_t state)
|
|||
(void) final_color;
|
||||
#endif
|
||||
}
|
||||
#else // LEDS_NUMBER > 0
|
||||
void led_state(uint32_t state)
|
||||
{
|
||||
#ifdef ST7789_SPI_DISPLAY
|
||||
st7789_state(state);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LED_NEOPIXEL
|
||||
|
||||
|
@ -438,3 +519,463 @@ void neopixel_write (uint8_t *pixels)
|
|||
led_pwm_duty_cycle(LED_RGB_BLUE, pixels[0]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ST7789_SPI_DISPLAY
|
||||
|
||||
#ifndef BACKLIGHT_PIN_NUMBER
|
||||
#define BACKLIGHT_PIN_NUMBER 14 /* lowest level */
|
||||
#endif
|
||||
|
||||
#define SPIx NRF_SPI0
|
||||
#define SPI_MODE NRF_SPI_MODE_3
|
||||
#define SPI_SCK 2
|
||||
#define SPI_MOSI 3
|
||||
#define DISP_SS 25
|
||||
#define DISP_DC 18
|
||||
#define DISP_RESET 26
|
||||
#define BACKLIGHT BACKLIGHT_PIN_NUMBER
|
||||
|
||||
void spi_init(void)
|
||||
{
|
||||
nrf_gpio_pin_write(SPI_SCK, SPI_MODE >= 2);
|
||||
nrf_gpio_cfg(SPI_SCK, NRF_GPIO_PIN_DIR_OUTPUT, NRF_GPIO_PIN_INPUT_CONNECT,
|
||||
NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_S0S1, NRF_GPIO_PIN_NOSENSE);
|
||||
nrf_gpio_pin_clear(SPI_MOSI);
|
||||
nrf_gpio_cfg_output(SPI_MOSI);
|
||||
|
||||
|
||||
nrf_spi_pins_set(SPIx, SPI_SCK, SPI_MOSI, NRF_SPI_PIN_NOT_CONNECTED);
|
||||
nrf_spi_frequency_set(SPIx, NRF_SPI_FREQ_8M);
|
||||
nrf_spi_configure(SPIx, SPI_MODE, NRF_SPI_BIT_ORDER_MSB_FIRST);
|
||||
|
||||
nrf_spi_enable(SPIx);
|
||||
}
|
||||
|
||||
void spi_teardown(void)
|
||||
{
|
||||
/* no need to tear down SCK and MOSI - output pins can be left alone */
|
||||
nrf_spi_event_clear(SPIx, NRF_SPI_EVENT_READY);
|
||||
nrf_spi_disable(SPIx);
|
||||
nrf_gpio_cfg_default(SPI_MOSI);
|
||||
nrf_gpio_cfg_default(SPI_SCK);
|
||||
}
|
||||
|
||||
void spi_write(const uint8_t *data, unsigned len)
|
||||
{
|
||||
const uint8_t *endp = data + len;
|
||||
|
||||
/* paranoid... but worthwhile due to the havoc this could cause */
|
||||
nrf_spi_event_clear(SPIx, NRF_SPI_EVENT_READY);
|
||||
|
||||
/* send first character */
|
||||
nrf_spi_txd_set(SPIx, *data++);
|
||||
|
||||
/* TXD is double buffers so we can xmit and then poll for the event */
|
||||
while (data < endp) {
|
||||
nrf_spi_txd_set(SPIx, *data++);
|
||||
|
||||
while (!nrf_spi_event_check(SPIx, NRF_SPI_EVENT_READY)) {}
|
||||
nrf_spi_event_clear(SPIx, NRF_SPI_EVENT_READY);
|
||||
(void) nrf_spi_rxd_get(SPIx);
|
||||
}
|
||||
|
||||
/* wait for the final character */
|
||||
while (!nrf_spi_event_check(SPIx, NRF_SPI_EVENT_READY)) {}
|
||||
nrf_spi_event_clear(SPIx, NRF_SPI_EVENT_READY);
|
||||
(void) nrf_spi_rxd_get(SPIx);
|
||||
}
|
||||
|
||||
#define NOP 0x00
|
||||
#define SWRESET 0x01
|
||||
#define SLPOUT 0x11
|
||||
#define NORON 0x13
|
||||
#define INVOFF 0x20
|
||||
#define INVON 0x21
|
||||
#define DISPON 0x29
|
||||
#define CASET 0x2a
|
||||
#define RASET 0x2b
|
||||
#define RAMWR 0x2c
|
||||
#define COLMOD 0x3a
|
||||
#define MADCTL 0x36
|
||||
|
||||
struct st7789_cmd {
|
||||
uint8_t cmd;
|
||||
const uint8_t *data;
|
||||
uint8_t len;
|
||||
};
|
||||
|
||||
const static struct st7789_cmd st7789_init_data[] = {
|
||||
{ COLMOD, (uint8_t *) "\x05", 1 }, // MCU will send 16-bit RGB565
|
||||
{ MADCTL, (uint8_t *) "\x00", 1 }, // Left to right, top to bottom
|
||||
//{ INVOFF, NULL }, // Results in odd palette
|
||||
{ INVON, NULL },
|
||||
{ NORON, NULL },
|
||||
{ NOP, NULL },
|
||||
};
|
||||
|
||||
|
||||
static void st7789_send(uint8_t cmd, const uint8_t *data, unsigned len)
|
||||
{
|
||||
nrf_gpio_pin_clear(DISP_SS);
|
||||
|
||||
// this means nop cannot be sent... but helps with big RAMWR dumps
|
||||
if (cmd) {
|
||||
nrf_gpio_pin_clear(DISP_DC);
|
||||
spi_write(&cmd, 1);
|
||||
}
|
||||
|
||||
if (data) {
|
||||
nrf_gpio_pin_set(DISP_DC);
|
||||
spi_write(data, len);
|
||||
}
|
||||
|
||||
nrf_gpio_pin_set(DISP_SS);
|
||||
}
|
||||
|
||||
void st7789_state(int state)
|
||||
{
|
||||
bool topclip = true;
|
||||
bool bottomclip = true;
|
||||
|
||||
switch(state) {
|
||||
case STATE_BOOTLOADER_STARTED:
|
||||
break;
|
||||
case STATE_BLE_DISCONNECTED:
|
||||
topclip = false;
|
||||
/* fallthrough */
|
||||
case STATE_BLE_CONNECTED:
|
||||
bottomclip = false;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t linebuffer[2*240];
|
||||
|
||||
#if defined(_P8_NRF52832_H) || defined(_K9_NRF52832_H)
|
||||
// 1-bit RLE, generated from res/p8dfu.png, 1355 bytes
|
||||
static const uint8_t rle[] = {
|
||||
0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0,
|
||||
0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0,
|
||||
0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0x9c, 0x8, 0x8, 0x3,
|
||||
0x2b, 0x3, 0xac, 0xd, 0x6, 0x3, 0x2b, 0x3, 0xab, 0xe, 0x6, 0x3,
|
||||
0x2b, 0x3, 0xab, 0x4, 0x8, 0x2, 0x6, 0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 0x0, 0xff, 0x0, 0xff, 0x0,
|
||||
0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0x85,
|
||||
};
|
||||
#else
|
||||
// 1-bit RLE, generated from res/pinedfu.png, 1085 bytes
|
||||
const uint8_t rle[] = {
|
||||
0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0,
|
||||
0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0,
|
||||
0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0x14, 0x8, 0x8, 0x3,
|
||||
0x2b, 0x3, 0xac, 0xd, 0x6, 0x3, 0x2b, 0x3, 0xab, 0xe, 0x6, 0x3,
|
||||
0x2b, 0x3, 0xab, 0x4, 0x8, 0x2, 0x6, 0x3, 0x2b, 0x3, 0xaa, 0x4,
|
||||
0x11, 0x3, 0x2b, 0x3, 0xaa, 0x3, 0x10, 0xb, 0x6, 0x7, 0xb, 0x3,
|
||||
0x3, 0x4, 0x1, 0xb, 0xa4, 0x3, 0x10, 0xb, 0x4, 0xb, 0x9, 0x3,
|
||||
0x1, 0x6, 0x1, 0xb, 0xa4, 0x3, 0x10, 0xb, 0x4, 0xc, 0x8, 0xa,
|
||||
0x1, 0xb, 0xa4, 0x4, 0x11, 0x3, 0xa, 0x2, 0x7, 0x4, 0x7, 0x6,
|
||||
0x7, 0x3, 0xab, 0x5, 0xf, 0x3, 0x14, 0x3, 0x7, 0x4, 0x9, 0x3,
|
||||
0xac, 0x9, 0xa, 0x3, 0x15, 0x3, 0x6, 0x4, 0x9, 0x3, 0xad, 0xa,
|
||||
0x8, 0x3, 0x15, 0x3, 0x6, 0x3, 0xa, 0x3, 0xb0, 0x8, 0x7, 0x3,
|
||||
0xd, 0xb, 0x6, 0x3, 0xa, 0x3, 0xb4, 0x5, 0x6, 0x3, 0xb, 0xd,
|
||||
0x6, 0x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x0,
|
||||
0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0,
|
||||
0xff, 0x0, 0xff, 0x0, 0x85,
|
||||
};
|
||||
#endif
|
||||
|
||||
// draw 240 x 240
|
||||
st7789_send(CASET, (uint8_t *) "\x00\x00\x00\xef", 4);
|
||||
st7789_send(RASET, (uint8_t *) "\x00\x00\x00\xef", 4);
|
||||
st7789_send(RAMWR, NULL, 0);
|
||||
|
||||
int y = 0;
|
||||
uint16_t bp = 0;
|
||||
uint16_t fg = 0xffff;
|
||||
const uint16_t bg = 0;
|
||||
uint16_t color = bg;
|
||||
|
||||
for (int i=0; i<sizeof(rle); i++) {
|
||||
uint8_t rl = rle[i];
|
||||
while (rl) {
|
||||
linebuffer[bp] = color >> 8;
|
||||
linebuffer[bp+1] = color & 0xff;
|
||||
bp += 2;
|
||||
rl -= 1;
|
||||
|
||||
if (bp >= sizeof(linebuffer)) {
|
||||
/* currently we have a single image which we clip to show different modes */
|
||||
if (topclip) {
|
||||
if (y < 48) {
|
||||
memset(linebuffer, 0, sizeof(linebuffer));
|
||||
} else if (y < 76) {
|
||||
#ifdef BUTTON_ON_RIGHT
|
||||
memset(linebuffer+2*(240-54), 0, 54*2);
|
||||
#else
|
||||
memset(linebuffer, 0, 64*2);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if (bottomclip) {
|
||||
memset(linebuffer+2*(240-64), 0, 64*2);
|
||||
} else if (y == 179 && state == STATE_BLE_CONNECTED) {
|
||||
fg = 0x18ff;
|
||||
}
|
||||
|
||||
st7789_send(NOP, linebuffer, sizeof(linebuffer));
|
||||
bp = 0;
|
||||
y += 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (color == bg)
|
||||
color = fg;
|
||||
else
|
||||
color = bg;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void st7789_init(void)
|
||||
{
|
||||
nrf_gpio_pin_set(DISP_SS);
|
||||
nrf_gpio_cfg_output(DISP_SS);
|
||||
spi_init();
|
||||
|
||||
nrf_gpio_cfg_output(DISP_DC);
|
||||
|
||||
/* deliver a reset */
|
||||
nrf_gpio_pin_clear(DISP_RESET);
|
||||
nrf_gpio_cfg_output(DISP_RESET);
|
||||
NRFX_DELAY_MS(10);
|
||||
nrf_gpio_pin_set(DISP_RESET);
|
||||
NRFX_DELAY_MS(125);
|
||||
|
||||
/* initialize the display */
|
||||
st7789_send(SLPOUT, NULL, 0);
|
||||
NRFX_DELAY_MS(10);
|
||||
for (const struct st7789_cmd *i = st7789_init_data; i->cmd != NOP; i++)
|
||||
st7789_send(i->cmd, i->data, i->len);
|
||||
|
||||
/* draw the initial screen content. this will take ~116ms so, with the
|
||||
* delay after the SLPOUT we will have complete the SLPOUT/SLPIN lock
|
||||
* out period during the update.
|
||||
*/
|
||||
st7789_state(STATE_BOOTLOADER_STARTED);
|
||||
|
||||
|
||||
/* enable the display and light the backlight */
|
||||
st7789_send(DISPON, NULL, 0);
|
||||
nrf_gpio_pin_clear(BACKLIGHT);
|
||||
nrf_gpio_cfg_output(BACKLIGHT);
|
||||
}
|
||||
|
||||
void st7789_teardown(void)
|
||||
{
|
||||
nrf_gpio_cfg_default(DISP_DC);
|
||||
nrf_gpio_cfg_default(DISP_RESET);
|
||||
nrf_gpio_cfg_default(BACKLIGHT);
|
||||
|
||||
spi_teardown();
|
||||
nrf_gpio_cfg_default(DISP_SS);
|
||||
}
|
||||
#endif
|
||||
|
||||
void wdt_init(void)
|
||||
{
|
||||
// 1 => keep running during a sleep, stop during SWD debug
|
||||
// 9 => run during sleep and SWD debug (e.g. most robust but
|
||||
// makes debugger attachment difficult)
|
||||
nrf_wdt_behaviour_set(NRF_WDT, 9);
|
||||
|
||||
// timeout after 5 seconds
|
||||
nrf_wdt_reload_value_set(NRF_WDT, 5 * 32768);
|
||||
|
||||
// enable the 0th channel
|
||||
nrf_wdt_reload_request_enable(NRF_WDT, NRF_WDT_RR0);
|
||||
|
||||
// set it running
|
||||
nrf_wdt_task_trigger(NRF_WDT, NRF_WDT_TASK_START);
|
||||
}
|
||||
|
|
16
src/boards.h
16
src/boards.h
|
@ -32,13 +32,17 @@
|
|||
|
||||
#include "board.h"
|
||||
|
||||
#ifndef BUTTON_DFU
|
||||
#if !defined(BUTTON_DFU) && BUTTONS_NUMBER > 0
|
||||
#define BUTTON_DFU BUTTON_1
|
||||
#endif
|
||||
|
||||
#ifndef BUTTON_FRESET
|
||||
#if !defined(BUTTON_FRESET) && BUTTONS_NUMBER > 1
|
||||
#define BUTTON_FRESET BUTTON_2
|
||||
#endif
|
||||
#ifndef BUTTON_ACTIVE
|
||||
/* default to active-low signals */
|
||||
#define BUTTON_ACTIVE 0
|
||||
#endif
|
||||
|
||||
// The primary LED is usually Red but not in all cases.
|
||||
#define LED_PRIMARY 0
|
||||
|
@ -56,6 +60,8 @@
|
|||
#define BOARD_RGB_BRIGHTNESS 0x101010
|
||||
#endif
|
||||
|
||||
#define BOARD_MAGIC_FORCE_APP_BOOT 0x65
|
||||
|
||||
// Helper function
|
||||
#define memclr(buffer, size) memset(buffer, 0, size)
|
||||
#define varclr(_var) memclr(_var, sizeof(*(_var)))
|
||||
|
@ -91,16 +97,14 @@ void led_tick(void);
|
|||
//--------------------------------------------------------------------+
|
||||
// BUTTONS
|
||||
//--------------------------------------------------------------------+
|
||||
// Make sure we have at least two buttons (DFU + FRESET since DFU+FRST=OTA)
|
||||
#if BUTTONS_NUMBER < 2
|
||||
#error "At least two buttons required in the BSP (see 'BUTTONS_NUMBER')"
|
||||
#endif
|
||||
|
||||
void button_init(uint32_t pin);
|
||||
bool button_pressed(uint32_t pin);
|
||||
|
||||
bool is_ota(void);
|
||||
|
||||
void wdt_init(void);
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// DEBUG
|
||||
//--------------------------------------------------------------------+
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Uri Shaked
|
||||
* Copyright (c) 2019 Benjamin Meisels
|
||||
*
|
||||
* 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 _ARAMCON_BADGE_2019_H
|
||||
#define _ARAMCON_BADGE_2019_H
|
||||
|
||||
#define _PINNUM(port, pin) ((port)*32 + (pin))
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* LED
|
||||
*------------------------------------------------------------------*/
|
||||
#define LEDS_NUMBER 1
|
||||
#define LED_PRIMARY_PIN _PINNUM(1, 11) // Red
|
||||
|
||||
#define LED_NEOPIXEL _PINNUM(0, 8)
|
||||
#define NEOPIXELS_NUMBER 4
|
||||
#define BOARD_RGB_BRIGHTNESS 0x040404
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* BUTTON
|
||||
*------------------------------------------------------------------*/
|
||||
#define BUTTONS_NUMBER 2
|
||||
#define BUTTON_1 _PINNUM(0, 2) // left Button
|
||||
#define BUTTON_2 _PINNUM(0, 29) // middle button
|
||||
#define BUTTON_PULL NRF_GPIO_PIN_PULLUP
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* UART (only used by nRF52832)
|
||||
*------------------------------------------------------------------*/
|
||||
#define RX_PIN_NUMBER _PINNUM(0, 28) // SDA
|
||||
#define TX_PIN_NUMBER _PINNUM(0, 3) // SCL
|
||||
#define CTS_PIN_NUMBER 0
|
||||
#define RTS_PIN_NUMBER 0
|
||||
#define HWFC false
|
||||
|
||||
// Used as model string in OTA mode
|
||||
#define BLEDIS_MANUFACTURER "ARAMCON Badge Team"
|
||||
#define BLEDIS_MODEL "ARAMCON Badge 2019"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// USB
|
||||
//--------------------------------------------------------------------+
|
||||
#define USB_DESC_VID 0x239A
|
||||
#define USB_DESC_UF2_PID 0x0079
|
||||
#define USB_DESC_CDC_ONLY_PID 0x0079
|
||||
|
||||
//------------- UF2 -------------//
|
||||
#define UF2_PRODUCT_NAME "ARAMCON Badge 2019"
|
||||
#define UF2_VOLUME_LABEL "ARAMBOOT"
|
||||
#define UF2_BOARD_ID "nrf52840-ARAMCON-Badge-2019"
|
||||
#define UF2_INDEX_URL "https://github.com/aramcon-badge"
|
||||
|
||||
#endif // _ARAMCON_BADGE_2019_H
|
|
@ -0,0 +1 @@
|
|||
MCU_SUB_VARIANT = nrf52840
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 Ha Thach for Adafruit Industries
|
||||
*
|
||||
* 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 _DSD6_NRF52832_H
|
||||
#define _DSD6_NRF52832_H
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* LED
|
||||
*------------------------------------------------------------------*/
|
||||
#define LEDS_NUMBER 0
|
||||
//#define LED_PRIMARY_PIN 9 // Red
|
||||
//#define LED_SECONDARY_PIN 10 // Blue
|
||||
#define LED_STATE_ON 1
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* BUTTON
|
||||
*------------------------------------------------------------------*/
|
||||
#define BUTTONS_NUMBER 1
|
||||
#define BUTTON_1 30
|
||||
//#define BUTTON_2 31
|
||||
#define BUTTON_PULL NRF_GPIO_PIN_PULLUP
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* UART
|
||||
*------------------------------------------------------------------*/
|
||||
#define RX_PIN_NUMBER 22
|
||||
#define TX_PIN_NUMBER 23
|
||||
#define CTS_PIN_NUMBER 0
|
||||
#define RTS_PIN_NUMBER 0
|
||||
#define HWFC false
|
||||
|
||||
// Used as model string in OTA mode
|
||||
#define BLEDIS_MANUFACTURER "Desay"
|
||||
#define BLEDIS_MODEL "DS-D6"
|
||||
|
||||
#endif // _DSD6_NRF52832_H
|
|
@ -0,0 +1,2 @@
|
|||
# nrf52 is nrf52832
|
||||
MCU_SUB_VARIANT = nrf52
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 Ha Thach for Adafruit Industries
|
||||
*
|
||||
* 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 _K9_NRF52832_H
|
||||
#define _K9_NRF52832_H
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* LED
|
||||
*------------------------------------------------------------------*/
|
||||
#define LEDS_NUMBER 0
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* BUTTON
|
||||
*------------------------------------------------------------------*/
|
||||
#define BUTTONS_NUMBER 1
|
||||
#define BUTTON_1 9
|
||||
#define BUTTON_PULL NRF_GPIO_PIN_NOPULL
|
||||
#define BUTTON_ACTIVE 1
|
||||
//#define BUTTON_ENABLE 10
|
||||
#define BUTTON_ON_RIGHT
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* UART
|
||||
*------------------------------------------------------------------*/
|
||||
#define RX_PIN_NUMBER UART_PIN_DISCONNECTED
|
||||
#define TX_PIN_NUMBER UART_PIN_DISCONNECTED
|
||||
#define CTS_PIN_NUMBER UART_PIN_DISCONNECTED
|
||||
#define RTS_PIN_NUMBER UART_PIN_DISCONNECTED
|
||||
#define HWFC false
|
||||
|
||||
#define ST7789_SPI_DISPLAY
|
||||
#define BACKLIGHT_PIN_NUMBER 22
|
||||
|
||||
// Used as model string in OTA mode
|
||||
#define BLEDIS_MANUFACTURER "Senbono"
|
||||
#define BLEDIS_MODEL "K9"
|
||||
#define BLEDIS_DEVICE_NAME "K9DFU"
|
||||
|
||||
#endif // _K9_NRF52832_H
|
|
@ -0,0 +1,2 @@
|
|||
# nrf52 is nrf52832
|
||||
MCU_SUB_VARIANT = nrf52
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 Ha Thach for Adafruit Industries
|
||||
*
|
||||
* 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 _NITROGEN_NRF52832_H
|
||||
#define _NITROGEN_NRF52832_H
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* LED
|
||||
*------------------------------------------------------------------*/
|
||||
#define LEDS_NUMBER 2
|
||||
#define LED_PRIMARY_PIN 29 // Red
|
||||
#define LED_SECONDARY_PIN 28 // Blue
|
||||
#define LED_STATE_ON 1
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* BUTTON
|
||||
*------------------------------------------------------------------*/
|
||||
#define BUTTONS_NUMBER 1
|
||||
#define BUTTON_1 27
|
||||
//#define BUTTON_2 19 // GPIO-L
|
||||
#define BUTTON_PULL NRF_GPIO_PIN_PULLUP
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* UART
|
||||
*------------------------------------------------------------------*/
|
||||
#define RX_PIN_NUMBER 15
|
||||
#define TX_PIN_NUMBER 13
|
||||
#define CTS_PIN_NUMBER 0
|
||||
#define RTS_PIN_NUMBER 0
|
||||
#define HWFC false
|
||||
|
||||
// Used as model string in OTA mode
|
||||
#define BLEDIS_MANUFACTURER "96Boards"
|
||||
#define BLEDIS_MODEL "Nitrogen"
|
||||
#define BLEDIS_DEVICE_NAME "NitroDFU"
|
||||
|
||||
#endif // _NITROGEN_NRF52832_H
|
|
@ -0,0 +1,2 @@
|
|||
# nrf52 is nrf52832
|
||||
MCU_SUB_VARIANT = nrf52
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 Ha Thach for Adafruit Industries
|
||||
* Copyright (c) 2020 Michael Welling
|
||||
*
|
||||
* 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 _OHS2020_BADGE_H
|
||||
#define _OHS2020_BADGE_H
|
||||
|
||||
#define _PINNUM(port, pin) ((port)*32 + (pin))
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* LED
|
||||
*------------------------------------------------------------------*/
|
||||
#define LEDS_NUMBER 1
|
||||
#define LED_PRIMARY_PIN _PINNUM(0, 04) // fake LED since we have none
|
||||
#define LED_STATE_ON 1
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* BUTTON
|
||||
*------------------------------------------------------------------*/
|
||||
#define BUTTONS_NUMBER 2
|
||||
#define BUTTON_1 _PINNUM(0, 29) // SW2
|
||||
#define BUTTON_2 _PINNUM(0, 03) // SW1
|
||||
#define BUTTON_PULL NRF_GPIO_PIN_PULLUP
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* UART (only used by nRF52832)
|
||||
*------------------------------------------------------------------*/
|
||||
#define RX_PIN_NUMBER _PINNUM(0, 09)
|
||||
#define TX_PIN_NUMBER _PINNUM(0, 10)
|
||||
#define CTS_PIN_NUMBER 0
|
||||
#define RTS_PIN_NUMBER 0
|
||||
#define HWFC false
|
||||
|
||||
// Used as model string in OTA mode
|
||||
#define BLEDIS_MANUFACTURER "OSHWA"
|
||||
#define BLEDIS_MODEL "OHS2020 Badge"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// USB
|
||||
//--------------------------------------------------------------------+
|
||||
#define USB_DESC_VID 0x239A
|
||||
#define USB_DESC_UF2_PID 0x007F
|
||||
#define USB_DESC_CDC_ONLY_PID 0x007F
|
||||
|
||||
//------------- UF2 -------------//
|
||||
#define UF2_PRODUCT_NAME "OHS2020 Badge"
|
||||
#define UF2_VOLUME_LABEL "BADGEBOOT"
|
||||
#define UF2_BOARD_ID "OHS2020-Badge-revA"
|
||||
#define UF2_INDEX_URL "https://2020.oshwa.org/"
|
||||
|
||||
#endif // _OHS2020_BADGE_H
|
|
@ -0,0 +1 @@
|
|||
MCU_SUB_VARIANT = nrf52840
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 Ha Thach for Adafruit Industries
|
||||
*
|
||||
* 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 _P8_NRF52832_H
|
||||
#define _P8_NRF52832_H
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* LED
|
||||
*------------------------------------------------------------------*/
|
||||
#define LEDS_NUMBER 0
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* BUTTON
|
||||
*------------------------------------------------------------------*/
|
||||
#define BUTTONS_NUMBER 1
|
||||
#define BUTTON_1 17
|
||||
#define BUTTON_PULL NRF_GPIO_PIN_NOPULL
|
||||
#define BUTTON_ACTIVE 1
|
||||
#define BUTTON_ON_RIGHT
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* UART
|
||||
*------------------------------------------------------------------*/
|
||||
#define RX_PIN_NUMBER 15 /* not connected */
|
||||
#define TX_PIN_NUMBER 11
|
||||
#define CTS_PIN_NUMBER 0
|
||||
#define RTS_PIN_NUMBER 0
|
||||
#define HWFC false
|
||||
|
||||
#define ST7789_SPI_DISPLAY
|
||||
|
||||
// Used as model string in OTA mode
|
||||
#define BLEDIS_MANUFACTURER "COLMI P8"
|
||||
#define BLEDIS_MODEL "P8"
|
||||
#define BLEDIS_DEVICE_NAME "P8DFU"
|
||||
|
||||
#endif // _P8_NRF52832_H
|
|
@ -0,0 +1,2 @@
|
|||
# nrf52 is nrf52832
|
||||
MCU_SUB_VARIANT = nrf52
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 Ha Thach for Adafruit Industries
|
||||
*
|
||||
* 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 _PINETIME_NRF52832_H
|
||||
#define _PINETIME_NRF52832_H
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* LED
|
||||
*------------------------------------------------------------------*/
|
||||
#define LEDS_NUMBER 0
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* BUTTON
|
||||
*------------------------------------------------------------------*/
|
||||
#define BUTTONS_NUMBER 1
|
||||
#define BUTTON_1 13
|
||||
#define BUTTON_PULL NRF_GPIO_PIN_NOPULL
|
||||
#define BUTTON_ACTIVE 1
|
||||
#define BUTTON_ENABLE 15
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* UART
|
||||
*------------------------------------------------------------------*/
|
||||
#define RX_PIN_NUMBER 17 /* not connected */
|
||||
#define TX_PIN_NUMBER 11
|
||||
#define CTS_PIN_NUMBER 0
|
||||
#define RTS_PIN_NUMBER 0
|
||||
#define HWFC false
|
||||
|
||||
#define ST7789_SPI_DISPLAY
|
||||
|
||||
// Used as model string in OTA mode
|
||||
#define BLEDIS_MANUFACTURER "Pine64"
|
||||
#define BLEDIS_MODEL "PineTime"
|
||||
#define BLEDIS_DEVICE_NAME "PineDFU"
|
||||
|
||||
#endif // _PINETIME_NRF52832_H
|
|
@ -0,0 +1,2 @@
|
|||
# nrf52 is nrf52832
|
||||
MCU_SUB_VARIANT = nrf52
|
|
@ -11,7 +11,7 @@ MEMORY
|
|||
* those values do not match. The check is performed in main.c, see
|
||||
* APP_ERROR_CHECK_BOOL(*((uint32_t *)NRF_UICR_BOOT_START_ADDRESS) == BOOTLOADER_REGION_START);
|
||||
*/
|
||||
FLASH (rx) : ORIGIN = 0x74000, LENGTH = 0x7E000-0x74000 /* 40 KB */
|
||||
FLASH (rx) : ORIGIN = 0x78000, LENGTH = 0x7E000-0x78000 /* 40 KB */
|
||||
|
||||
/** Location of mbr params page in flash. */
|
||||
MBR_PARAMS_PAGE (rw) : ORIGIN = 0x7E000, LENGTH = 0x1000
|
||||
|
|
41
src/main.c
41
src/main.c
|
@ -103,13 +103,14 @@ void usb_teardown(void);
|
|||
#define DFU_MAGIC_OTA_RESET 0xA8
|
||||
#define DFU_MAGIC_SERIAL_ONLY_RESET 0x4e
|
||||
#define DFU_MAGIC_UF2_RESET 0x57
|
||||
#define DFU_MAGIC_FORCE_APP_BOOT BOARD_MAGIC_FORCE_APP_BOOT // 0x65
|
||||
|
||||
#define DFU_DBL_RESET_MAGIC 0x5A1AD5 // SALADS
|
||||
#define DFU_DBL_RESET_DELAY 500
|
||||
#define DFU_DBL_RESET_DELAY 2000
|
||||
#define DFU_DBL_RESET_MEM 0x20007F7C
|
||||
|
||||
#define BOOTLOADER_VERSION_REGISTER NRF_TIMER2->CC[0]
|
||||
#define DFU_SERIAL_STARTUP_INTERVAL 1000
|
||||
#define DFU_SERIAL_STARTUP_INTERVAL 2000
|
||||
|
||||
// These value must be the same with one in dfu_transport_ble.c
|
||||
#define BLEGAP_EVENT_LENGTH 6
|
||||
|
@ -121,11 +122,11 @@ enum { BLE_CONN_CFG_HIGH_BANDWIDTH = 1 };
|
|||
|
||||
#ifdef NRF52840_XXAA
|
||||
// Flash 1024 KB
|
||||
STATIC_ASSERT( APPDATA_ADDR_START == 0xED000);
|
||||
STATIC_ASSERT( APPDATA_ADDR_START == 0xF4000);
|
||||
|
||||
#else
|
||||
// Flash 512 KB
|
||||
STATIC_ASSERT( APPDATA_ADDR_START == 0x6D000);
|
||||
STATIC_ASSERT( APPDATA_ADDR_START == 0x78000);
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -155,7 +156,9 @@ int main(void)
|
|||
bool sd_inited = (NRF_POWER->GPREGRET == DFU_MAGIC_OTA_APPJUM);
|
||||
|
||||
// Start Bootloader in BLE OTA mode
|
||||
_ota_dfu = (NRF_POWER->GPREGRET == DFU_MAGIC_OTA_APPJUM) || (NRF_POWER->GPREGRET == DFU_MAGIC_OTA_RESET);
|
||||
_ota_dfu = (NRF_POWER->GPREGRET == DFU_MAGIC_OTA_APPJUM) ||
|
||||
(NRF_POWER->GPREGRET == DFU_MAGIC_OTA_RESET) ||
|
||||
(NRF_POWER->RESETREAS & NRF_POWER_RESETREAS_DOG_MASK);
|
||||
|
||||
// Serial only mode
|
||||
bool serial_only_dfu = (NRF_POWER->GPREGRET == DFU_MAGIC_SERIAL_ONLY_RESET);
|
||||
|
@ -164,8 +167,14 @@ int main(void)
|
|||
bool dfu_start = _ota_dfu || serial_only_dfu || (NRF_POWER->GPREGRET == DFU_MAGIC_UF2_RESET) ||
|
||||
(((*dbl_reset_mem) == DFU_DBL_RESET_MAGIC) && (NRF_POWER->RESETREAS & POWER_RESETREAS_RESETPIN_Msk));
|
||||
|
||||
// override the button status (but not GPREGREG or RESETREAS)
|
||||
bool force_app_boot = (NRF_POWER->GPREGRET == DFU_MAGIC_FORCE_APP_BOOT);
|
||||
|
||||
// Clear GPREGRET if it is our values
|
||||
if (dfu_start) NRF_POWER->GPREGRET = 0;
|
||||
if (dfu_start || force_app_boot) {
|
||||
NRF_POWER->GPREGRET = 0;
|
||||
nrf_power_resetreas_clear(NRF_POWER, NRF_POWER_RESETREAS_DOG_MASK);
|
||||
}
|
||||
|
||||
// Save bootloader version to pre-defined register, retrieved by application
|
||||
BOOTLOADER_VERSION_REGISTER = (MK_BOOTLOADER_VERSION);
|
||||
|
@ -191,10 +200,22 @@ int main(void)
|
|||
|
||||
/*------------- Determine DFU mode (Serial, OTA, FRESET or normal) -------------*/
|
||||
// DFU button pressed
|
||||
dfu_start = dfu_start || button_pressed(BUTTON_DFU);
|
||||
#ifdef BUTTON_DFU
|
||||
// DFU button is pressed -> request DFU mode (unless forced to avoid)
|
||||
dfu_start = dfu_start || (!force_app_boot && button_pressed(BUTTON_DFU));
|
||||
#else
|
||||
//
|
||||
// No DFU button so always request DFU mode!
|
||||
dfu_start = dfu_start || !force_app_boot;
|
||||
#endif
|
||||
|
||||
#ifdef BUTTON_FRESET
|
||||
// DFU + FRESET are pressed --> OTA
|
||||
_ota_dfu = _ota_dfu || ( button_pressed(BUTTON_DFU) && button_pressed(BUTTON_FRESET) ) ;
|
||||
#else
|
||||
// No FRESET button so set OTA mode unless a magic reset requested serial mode
|
||||
_ota_dfu = _ota_dfu || !serial_only_dfu;
|
||||
#endif
|
||||
|
||||
bool const valid_app = bootloader_app_is_valid(DFU_BANK_0_REGION_START);
|
||||
|
||||
|
@ -216,6 +237,9 @@ int main(void)
|
|||
// if RST is pressed during this delay --> if will enter dfu
|
||||
NRFX_DELAY_MS(DFU_DBL_RESET_DELAY);
|
||||
#endif
|
||||
} else {
|
||||
/* allow the splash screen to be seen ;-) */
|
||||
NRFX_DELAY_MS(DFU_DBL_RESET_DELAY);
|
||||
}
|
||||
|
||||
(*dbl_reset_mem) = 0;
|
||||
|
@ -246,12 +270,13 @@ int main(void)
|
|||
}
|
||||
}
|
||||
|
||||
#if BUTTONS_NUMBER > 1
|
||||
// Adafruit Factory reset
|
||||
if ( !button_pressed(BUTTON_DFU) && button_pressed(BUTTON_FRESET) )
|
||||
{
|
||||
adafruit_factory_reset();
|
||||
}
|
||||
|
||||
#endif
|
||||
// Reset Board
|
||||
board_teardown();
|
||||
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
* Copyright (C) 2020 Daniel Thompson
|
||||
*/
|
||||
|
||||
#ifndef NPVRAM_H_
|
||||
#define NPVRAM_H_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
/*! \brief Pseudo Non-Voltatile RAM
|
||||
*
|
||||
* This is a data structure that can be placed in the first available
|
||||
* RAM location. It survives reset but not power down. It can be used
|
||||
* to share information between the bootloader and the main
|
||||
* application.
|
||||
*/
|
||||
struct pnvram {
|
||||
uint32_t header; //!< Validation word - 0x1abe11ed
|
||||
uint32_t offset; //!< Number of seconds since the epoch
|
||||
uint32_t uptime; //!< Device uptime in milliseconds
|
||||
uint32_t reserved[4];
|
||||
uint32_t footer; //!< Validation word - 0x10adab1e
|
||||
};
|
||||
|
||||
#define PNVRAM_HEADER 0x1abe11ed
|
||||
#define PNVRAM_FOOTER 0x10adab1e
|
||||
|
||||
#ifdef NRF52832_XXAA
|
||||
static volatile struct pnvram * const pnvram = (void *) 0x200039c0;
|
||||
#endif
|
||||
|
||||
static inline void pnvram_init(struct pnvram *p)
|
||||
{
|
||||
memset(p, 1, sizeof(*p));
|
||||
|
||||
p->header = PNVRAM_HEADER;
|
||||
p->footer = PNVRAM_FOOTER;
|
||||
}
|
||||
|
||||
static inline bool pnvram_is_valid(volatile struct pnvram * const p)
|
||||
{
|
||||
return p->header == PNVRAM_HEADER && p->footer == PNVRAM_FOOTER;
|
||||
}
|
||||
|
||||
static inline void pnvram_add_ms(volatile struct pnvram * const p, uint32_t ms)
|
||||
{
|
||||
if (pnvram_is_valid(p))
|
||||
p->uptime += ms;
|
||||
}
|
||||
|
||||
#endif /* NPVRAM_H_ */
|
|
@ -66,7 +66,7 @@
|
|||
#define HCI_MEM_POOL_ENABLED 1
|
||||
#define HCI_TX_BUF_SIZE 600 // not used
|
||||
#define HCI_RX_BUF_SIZE 600
|
||||
#define HCI_RX_BUF_QUEUE_SIZE 8 // must be power of 2
|
||||
#define HCI_RX_BUF_QUEUE_SIZE 16 // must be power of 2
|
||||
|
||||
//==========================================================
|
||||
// <e> UART_ENABLED - nrf_drv_uart - UART/UARTE peripheral driver
|
||||
|
|
Loading…
Reference in New Issue