Skip to content

Commit

Permalink
Merge branch 'main' of github.com:dakhnod/NRF51-IO-module into i2c
Browse files Browse the repository at this point in the history
  • Loading branch information
dakhnod committed Jan 12, 2025
2 parents 9f55928 + 60a461c commit 3261243
Show file tree
Hide file tree
Showing 9 changed files with 1,598 additions and 14 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/firmware-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
run: |
make BLE_ROOT=../../../../ FAMILY=NRF51
- name: store firmware
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: firmware-file
path: _build/nrf51822_xxac.hex
Expand All @@ -33,13 +33,13 @@ jobs:

steps:
- name: download firmware
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: firmware-file
path: /tmp/nrf51_firmware
- name: flash firmware
working-directory: /home/home/Projects/BLEnky/openocd
run: src/openocd -s tcl -f raspi-bcm2385.tcl -f nrf51.cfg -c "program /tmp/nrf51_firmware/nrf51822_xxac.hex verify reset exit"
run: src/openocd -s tcl -f raspi-bcm2385.tcl -f target/nrf51.cfg -c "program /tmp/nrf51_firmware/nrf51822_xxac.hex verify reset exit"

test:
runs-on: [self-hosted, firmware-flasher]
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/jinja.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Jinja build

on: [workflow_dispatch, push]

jobs:
parse:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: parse feature template
uses: rondefreitas/[email protected]
with:
template: src/config/feature_config.template.h.jinja
output_file: src/config/feature_config.template.h
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Auto-parse Jinja template
status_options: '--untracked-files=all'

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
Want to make a device smart and super low power withing minutes? Here you go!

You can see this Project in action [here](https://youtu.be/jnUlXBZHBno), [here](https://youtu.be/GZ5C588gBdo) and [here](https://youtu.be/10ko1Ppw78A).
An exhaustive list of Projects can be found [here](https://daniel.nullco.de/) under `Projects/Software/Automation/BLEnky`.

Firmware for cheap, nRF51 or nRF52-based IO-modules to control LEDs, relays, servos, motors (and more) and read from buttons, sensors (etc.), build Cycling sensors and HID controlelrs via Bluetooth low energy.
An IO module can have inputs and outputs that can be read from and written to.
Expand Down
28 changes: 22 additions & 6 deletions docs/FLASHING.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,32 @@
# Flashing

## Flashing via bootloader
## Flashing the nRF51 via bootloader

This is the recommended way to flash the firmware since it allows for
updates over the air (over BLE).

### Flashing the bootloader
### Flashing using an ESP32

If you don't already have abootloader installed, you can download it [here](https://github.com/dakhnod/nRF51-GPIO-BLE-Bridge/releases/v0.1.0)
This is a good chance to try out https://github.com/atc1441/ESP32_nRF52_SWD.

I have no experience with this. Feel free to open an issue and contribute some documentation.

### Flashing the bootloader using a Raspberry Pi

Firstly, get openocd to run. I (cannot remember why) compiled the source from https://github.com/openocd-org/openocd myself on the RasPi.
Feel free to try out https://github.com/raspberrypi/openocd aswell. Not sure what the difference is.

Then download `bootloader_with_softdevice_delay.hex` [here](https://github.com/dakhnod/nRF51-GPIO-BLE-Bridge/releases/v0.1.0)

You can use this command to flash the hex (mind the references to the nrf51.cfg, change to nrf52.cfg if needed):
```
openocd -s ${OPENOCD_INSTALL_DIR}/tcl -f openocd/raspi-bcm2385.tcl -f target/nrf51.cfg -c "program bootloader_with_softdevice_delay.hex verify reset exit"
```
with `openocd/raspi-bcm2385.tcl` using [pins](https://pinout.xyz/) 11 for `swd` and 25 for `swio`, but feel free to change those.

### Flashing the bootloader using JLink

Get the bootloader [here](https://github.com/dakhnod/nRF51-GPIO-BLE-Bridge/releases/v0.1.0)
and flash the hex via nrfjprog, or any other program capable of swd.
Here's how to do it using nrfjprog
```
Expand All @@ -16,9 +35,6 @@ nrfjprog --program path_to_bootloader.hex
nrfjprog --reset
```

After that, your device should discoverable under the name "DfuTarg".
The device will always boot into bootloader first for a few seconds.

### Rebooting into bootloader

If you just installed the bootloader after a wipe, the device is already in bootloader mode.
Expand Down
12 changes: 12 additions & 0 deletions openocd/raspi-bcm2385.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
set WORKAREASIZE 0

adapter driver bcm2835gpio

bcm2835gpio peripheral_base 0xFE000000

bcm2835gpio speed_coeffs 236181 60

adapter gpio swclk 11
adapter gpio swdio 25

transport select swd
Loading

0 comments on commit 3261243

Please sign in to comment.