GithubHelp home page GithubHelp logo

zaza89 / adafruit_nrf51822_flasher Goto Github PK

View Code? Open in Web Editor NEW

This project forked from adafruit/adafruit_nrf51822_flasher

0.0 1.0 0.0 9.9 MB

Wrapper for the Segger J-Link or STLink/V2 (via OpenOCD) to flash nRF51822 MCUs

Python 5.61% Tcl 94.39%

adafruit_nrf51822_flasher's Introduction

Adafruit nRF51822 Flasher

Table of Contents

The flasher utility is a wrapper for various debuggers to flash nRF51822 MCUs with the official Adafruit firmware images. Currently supported debuggers are:

This tool hides the implementation details of the different debuggers, and provides a means to flash Bluefruit LE modules with the specified softdevice, bootloader, and firmware via the SWD pins on the nRF51822 (SWDIO and SWCLK).

This is useful if you need to de-brick a board that failed a DFU update, or some other unfortunate event.

The Adafruit_BluefruitLE_Firmware folder is setup as a git submodule, linked to an external repo. you will need to clone this with --recursive flag

git clone --recursive [email protected]:adafruit/Adafruit_nRF51822_Flasher.git

If the folder is empty, you will need to run the following commands to fill it:

git submodule init
git submodule update

If you aren't operating from a git repo, you can fill the Adafruit_BluefruitLE_Firmware folder from the command-line with the following command:

git clone [email protected]:adafruit/Adafruit_BluefruitLE_Firmware.git

Requirements

General Requirements

  • One of the following SWD debuggers connected to the module via the SWD pins:
  • Adalink installed on your system (A Python JLinkExe wrapper used to flash the device)
    • git clone adalink
    • install and setup adalink
  • click Python library:
    • sudo apt-get install python-pip or sudo easy_install pip then
    • sudo pip install click

Jlink Requirements

Download and install jlink driver

STLink/V2 Requirements

Install openOCD following the instruction in Adalink doc

On Linux or Raspberry Pi the following steps are required:

Install libusb:

sudo apt-get install libusb-dev libusb-1.0-0-dev

Configure UDEV permissions:

sudo cp openocd-0.9.0/contrib/99-openocd.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules

Then reboot.

STLink/V2 to Bluefruit LE Pinout

The following pins on the STLink/V2 need to be connected to the Bluefruit LE module:

STLink/V2 Bluefruit LE
RST RST
SWCLK SWCLK
SWDIO SWDIO
GND GND
3.3V VIN

RPi GPIO Requirements

You can also use the RPi's raw GPIO to bit-bang JTAG/SWD signals, turning your RPi into a native debugger. A pre-built alpha version of openOCD binary is included in the openocd-x.x.x/rpi_gpio/openocd folder, since the current stable 0.9.0 does not support RPi GPIO with SWD interface yet. To sum up, you don't need install anything else except the libusb as follows

sudo apt-get install libusb-dev libusb-1.0-0-dev

Since accessing RPi's GPIO requires root access, sudo is required when executing the flash.py script:

RPi 1 wiring

rpi_openocd_swd

RPi 2 wiring

rpi2_swd.png

NOTE: Don't forget to connect GND, remember that there are 4 wires in total.

Usage

Usage: flash.py [OPTIONS]

  Flash Bluefruit module Softdevice + Bootloader + Firmware

Options:
  --jtag TEXT           debugger must be "jlink" or "stlink" or "rpigpio",
                        default is "jlink"
  --softdevice TEXT     Softdevice version e.g "8.0.0"
  --bootloader INTEGER  Bootloader version e.g "1" or "2".
  --board TEXT          must be "blefriend32" or "blespifriend".
  --firmware TEXT       Firmware version e.g "0.6.5".
  --help                Show this message and exit.

--firmware and --board options are mandatory.

To flash the blefriend32 module using an STLink/V2 with SD 8.0.0, bootloader ver 2, firmware 0.6.5:

python flash.py --jtag=stlink --board=blefriend32 --softdevice=8.0.0 --bootloader=2 --firmware=0.6.5

To flash the above module with the same firmware using RPi GPIO

sudo python flash.py --jtag=rpigpio --board=blefriend32 --softdevice=8.0.0 --bootloader=2 --firmware=0.6.5

adafruit_nrf51822_flasher's People

Contributors

hathach avatar microbuilder avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.