descriptionStarting point and shared code for Nordic nRF5x BLE platforms.
ownermilesdig@mail.com
last changeThu, 13 May 2021 13:52:15 +0000 (13 06:52 -0700)
content tags
add:
README.md

Nordic nRF5x Support Files

This repository is a starting point and shared code for Nordic nRF5x BLE platforms. This repo is a collection of libraries, SDKs, Softdevices, and Makefiles to be included within other projects using the Nordic platfroms. Pull requests welcome.

The currently supported SDK versions are: 9.0.0, 10.0.0, 11.0.0, 12.2.0.

The currently supported Softdevice versions are: s110_7.3.0, s110_8.0.0, s120_2.1.0, s130_1.0.0, s130_2.0.0, s130_2.0.1.

Usage

First, add this project as a submodule inside of your repo with your nRF5x code.

git submodule add https://github.com/lab11/nrf5x-base

Then write an application for the nRF5x SoC you are using and include a Makefile that looks like this:

PROJECT_NAME = $(shell basename "$(realpath ./)")

APPLICATION_SRCS = $(notdir $(wildcard ./*.c))
# Various C libraries that need to be included
APPLICATION_SRCS += softdevice_handler.c
APPLICATION_SRCS += ble_advdata.c
APPLICATION_SRCS += ble_conn_params.c
APPLICATION_SRCS += app_timer.c
APPLICATION_SRCS += ble_srv_common.c
APPLICATION_SRCS += app_util_platform.c
APPLICATION_SRCS += nrf_drv_common.c
APPLICATION_SRCS += nrf_delay.c
APPLICATION_SRCS += led.c
APPLICATION_SRCS += simple_ble.c
APPLICATION_SRCS += simple_adv.c
# Add other libraries here!

# platform-level headers and source files
LIBRARY_PATHS += ../../include
SOURCE_PATHS += ../../src

# Set the softdevice needed for the application
SOFTDEVICE_MODEL = s110

# Include the main Makefile
NRF_BASE_PATH ?= ../../nrf5x-base
include $(NRF_BASE_PATH)/make/Makefile

An example Makefile is included in this repo as Makefile.example. Copy to your own application directory and modify as desired.

Generally, the expected directory structure for your project is:

    /apps
        /<application 1>
        /<application 2>
        ...
    /src
        various platform-level code (e.g. functions shared between applications)
    /include
        various platform-level headers (e.g. platform pin mappings)
    /nrf5x-base (submodule)

Example Applications

This repo has several example and test applications. See the apps folder.

Supported Features

There are libraries for many common BLE functions in this repo:

Program a nRF51822

To flash an application to a nRF51822 BLE chip, there is some setup you must do.

  1. Install the arm-none-eabi-gcc compiler.

    On Ubuntu:

    sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
    sudo apt-get update
    sudo apt-get install gcc-arm-embedded
    
  2. Install the JLink software for your platform. You want the "Software and documentation pack".

  3. Acquire a JLink JTAG programmer. The "EDU" edition works fine.

  4. Program an app! With the JLink box attached to the target board:

    make flash
    

    will write the app and softdevice to the nRF51822. You can erase a chip with:

    make erase-all
    

    See the make folder for a complete list of commands.

    Most of our boards use a TagConnect header instead of the way-too-large ARM JTAG header. We use our own adapter, but Segger also makes one.

  5. Upon inital programming, the nRF will enter debug mode, which will prevent the nRF from sleeping and prevent the reset line from working. To fix this, either perform a powerdown/powerup or download nrfjprog from (https://www.nordicsemi.com/eng/Products/Bluetooth-low-energy/nRF51822) and run nrfjprog --pinreset

Git Submodules

If you're using submodules in your project, you may want to use this to make git automatically update them: https://gist.github.com/brghena/fc4483a2df83c47660a5

BLE Tools for Other Platforms

When developing a BLE application, several tools exist to make your life easier. The easiest option, if you have access to an android phone, is nRF Master Control Panel. On iOS, LightBlue Explorer has similar or better functionality. Alternatively, noble is a NodeJS library for interacting with BLE that can run from a Linux or Mac computer.

Example Platforms Using nRF5x-base

License

The files in this repository are licensed under the MIT License unless otherwise noted by the local directory's README and license files.

shortlog
2021-05-13 Antonio CalatravaFixed "Error: SVC is not permitted on this architecture... master
2021-05-10 Antonio CalatravaBLE_UUID_VS_COUNT_DEFAULT does not work on nRF51 platform
2021-05-09 Antonio Calatravamodify full_adv example to make it compatible with...
2021-05-09 Antonio Calatravacompiling support for nrf52832
2017-11-14 Neal JacksonAdd gitignore
2017-11-03 Neal JacksonFix erroneous return
2017-10-06 Neal JacksonFix simple_ble_stach_char_get
2017-06-06 Andrew Kohlsmithtiny trick to get Windows builds from within msys/mingw...
2017-06-01 Andrew Kohlsmithadd preliminary support for linking in the gzll and...
2017-06-01 Branden GhenaFix to make serialization build
2017-05-25 Branden GhenaMerge pull request #27 from akohlsmith/s210_support
2017-05-25 Andrew Kohlsmithfix up for s210 softdevice
2017-03-30 Branden GhenaMerge pull request #26 from lab11/fix_weak_refs
2017-03-30 Pat Pannutoremove __attribute__((weak)) from headers
2017-03-27 Pat Pannutoadd missing `const` qualifiers for strings
2017-02-18 William HuangUpdate README.md
...
heads
2 years ago master