Skip to content
Snippets Groups Projects
Select Git revision
  • master default
  • test
  • rahix/hw-lock-new-mutex
  • dx/somewhat-more-dynamic-config
  • schneider/sdk-0.2.1-7
  • schneider/bsec
  • dx/meh-bdf-to-stm
  • dx/flatten-config-module
  • genofire/ble-follow-py
  • schneider/ble-stability
  • schneider/ble-stability-new-phy
  • add_menu_vibration
  • plaetzchen/ios-workaround
  • blinkisync-as-preload
  • schneider/max30001-pycardium
  • schneider/max30001-epicaridum
  • schneider/max30001
  • schneider/stream-locks
  • schneider/fundamental-test
  • schneider/ble-buffers
  • v1.12
  • v1.11
  • v1.10
  • v1.9
  • v1.8
  • v1.7
  • v1.6
  • v1.5
  • v1.4
  • v1.3
  • v1.2
  • v1.1
  • v1.0
  • release-1
  • bootloader-v1
  • v0.0
36 results

nimble.rst

Blame
  • Forked from card10 / firmware
    626 commits behind the upstream repository.
    nimble.rst 3.15 KiB

    NimBLE

    On the card10 the ARM Cordio-B50 stack is used, which is in a very early experimental state and has some incompatibilities with some smartphones. Therefore some alternative stacks are evaluated, which meight be used as a replacement in the long term.

    Here a stack called NimBLE is presented, which claims to be feature complete. Originally it has been developed for Mynewt, an open source embedded operating system by Apache (https://mynewt.apache.org/).

    There is a working port for the ESP32 espressif ESP-IDF framework. Like Epicardium, ESP-IDF is based on FreeRTOS. Therefore it can be used for evaluation purposes.

    Getting NimBLE run on the ESP32

    Install required packages:

    Ubuntu:

    sudo apt install git virtualenv python2.7 cmake

    Arch:

    sudo pacman -S git python2 python2-virtualenv cmake

    Download and extract xtensa ESP32 compiler:

    wget https://dl.espressif.com/dl/xtensa-esp32-elf-gcc8_2_0-esp32-2018r1-linux-amd64.tar.xz
    tar -xf xtensa-esp32-elf-gcc8_2_0-esp32-2018r1-linux-amd64.tar.xz

    Clone esp-idf:

    git clone https://github.com/espressif/esp-idf.git

    Add xtensa and ESP-IDF path to $PATH:

    bash shell:

    export IDF_PATH=$PWD/esp-idf
    export PATH=${PATH}:$PWD/xtensa-esp32-elf/bin:$PWD/esp-idf/tools

    fish shell:

    set -gx IDF_PATH $PWD/esp-idf
    set -gx PATH $PWD/xtensa-esp32-elf/bin/ $PWD/esp-idf/tools $PATH

    Create a python2.7 virtualenv:

    cd esp-idf
    virtualenv -p /usr/bin/python2.7 venv

    Enter the virtualenv:

    bash shell:

    . venv/bin/activate

    fish shell:

    . venv/bin/activate.fish

    Init git submodules and install all required Python packages:

    git submodule update --init --recursive
    pip install -r requirements.txt

    Now you are ready to build!

    The following steps assume that your ESP32 is connected via USB and is accessible via /dev/ttyUSB0. This meight be different on your system.

    There are a few NimbLE examples which can be used for playing around:

    Build a BLE server example (host mode):

    cd examples/bluetooth/nimble/bleprph
    idf.py -p /dev/ttyUSB0 flash monitor

    This will build and flash the example to the ESP32 and instantly listens on /dev/ttyUSB0 serial port. After the flashing process the ESP32 will anounce itself as nimble-bleprph device via BLE.

    Build a BLE client example (central mode):

    cd examples/bluetooth/nimble/blecent
    idf.py -p /dev/ttyUSB0 flash monitor

    This will build and flash the example to the ESP32 and instantly listens on /dev/ttyUSB0 serial port. After the flashing process the ESP32 creates a GATT client and performs passive scan, it then connects to peripheral device if the device advertises connectability and the device advertises support for the Alert Notification service (0x1811) as primary service UUID.