Giter VIP home page Giter VIP logo

nrf's Introduction

project: natersoz/nrf

Copyright (c) 2018, natersoz. Distributed under the Apache 2.0 license.

Quick Start

See:

LICENSING

  • File which contain a Nordic Semiconductor License in the comments header are covered under the terms found in NORDIC_LICENSE.txt.
  • Files in the segger/ directory are covered under the terms of SEGGER's licencing found in the source files and in the license file segger_rtt/license/license.txt.
  • All other files are covered under the Apache 2.0 LICENSE file.

Documentation

This README.md will be limited. More detailed descriptions are in the directory docs.

Goals:

  • Provide a generic BLE implementation using C++ class structures which can be adapted to any vendor specific hardware. The first instance will be the Nordic nrf52 development board.
    • The implementation will not use an OS, but should be easily adapted to an OS.
    • It is intended that nearly all processing occur within an ISR. Given the ARM Nested Vector Interrupt Controller (NVIC) this should be easy to do and yeild the best performance.
  • Peripheral device drivers should access the CMSIS mapped registers and rely minimally on the SDK. Progress will be indicated by the lack of file and module coupling between device drivers.

Progress:

  • Peripherals on master in the directory peripherals have been tested. Faults have been logged as issues.
  • Peripheral tests can be found in the directory nordic/tests. Each test is given its own directory and Makefile: spi_test, rtc_test, etc.
  • Code which can be tested without hardware dependencies is found under unit_tests.
  • The project ble_peripheral_class is a BLE peripheral example using the BLE class based implementation of this code base. It is a GATT server only peripheral (at this time). It is working as expected on Nordic hardware.

nrf's People

Contributors

natersoz avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

nrf's Issues

Use of bost:intrusive::list is inconsistent, perhaps remove completely.

  • Evaluate whether boost::intrusive::list<> is the proper class to use in the first place. Is this class causing massive template code bloat?
  • Consider that the boost::intrusive::list_member_hook<> cannot be made volatile. This disqualifies its use within the timer observer/observable class structure.

If it is to be used within the BLE landscape:

  • Use the boost::intrusive::constant_time_size<false> flag in the boost::intrusive::list<> template arguments. This will allow for boost::intrusive::list_member_hook<>::unlink() usage.
  • Remove boost::intrusive::list::remove() from usage. This requires O(n) to perform. Use boost::intrusive::list_member_hook<>::unlink() instead for immediate results.
  • Remove operator == from classes which include boost::intrusive::list_member_hook<> in their class body.

GATT MTU size needs reconciled

GATT MTU size is specified several places:
nrf/ble/nordic_ble_stack_observer.cc
nrf/ble/nordic_ble_stack.h
nrf/ble/att.h: static constexpr length_t const mtu_length_maximum = 251u

Get to the bottom of the actual GATT MTU maximum and provide one source of truth.

Evaluate boost::intrusive list applicability

Either hack/fix boost::intrusive::list to allow for a volatile hook or write a replacement.
Within the timer structure usage, this is not acceptable.
hooks are routinely linked/unlinked across interrupt boundaries.

BLE Central Noridc specific behaviors

  • ble_gap_connection::disconnect(), Line 63 It would be expected that scanning would need to be restarted on Central disconnect. However, calling start() results in Nordic error 8: invalid state.

make checks rule does not work on linux

This only works on OSX.

  • The cross compiler options for intrinsics is not working. Example: __REV() is not defined.
  • The -isystem include rule does not work properly for gcc. It requires -I

Clean up nordic peripherals

A bunch of things:

  • Use consistency in completion event types and use size_t where possible.
  • In spim completion callback, provide address and length params - similar to the others.
  • Check buffer lengths on std::equal() comparisions.

nordic/peripherals interface - refactor to generic interfaces

  1. Consider using CMSIS peripheral interfaces when possible.
  2. Move generic interface header files into a separate directory.
  3. Timer & RTC interfaces contain Nordic specific instance information.

Example: The classes timer_observer_generic and timer_observable_generic are nearly generic in that they contain no external dependencies. Nope, false: They have the number 6 scattered about for the cc_index_limit which is Nordic specific.

This needs to be removed so that the interface is truly generic.

TWI power consumptions may be high

See this link:
https://devzone.nordicsemi.com/f/nordic-q-a/15908/nrf52-twi-excess-current-consumption/60684#60684

Errata 89 tells that this is an anomaly inside the chip. And the work around is given.
Just add below code when you want to disable TWI

For TWI0 for number 89 anomaly on nRF52

*(uint32_t *)(0x40003000 + 0xFFC ) = 0;
*(uint32_t *)(0x40003000 + 0xFFC ) = 1;

For TWI1 for number 89 anomaly on nRF52

*(uint32_t *)(0x40004000 + 0xFFC ) = 0;
*(uint32_t *)(0x40004000 + 0xFFC ) = 1;

Decouple BLE observers from nordic

The BLE observers for GAP, GATTC, and GATTS all must be wrapped in a Nordic wrapper in order to register. This is not necessary.
Move the intrusive list hook inside the GAP, GATTC, GATTS event observer interface.
The wrapping in Nordic will no longer be necessary.

Nordic peripherals deinit() code cleanup and testing

Most (all?) of the Nordic peripherals' deinit() methods are poorly written and likely do not work.

  • Evaluate and determine the proper methods for deinit(); should these be blocking calls unit clean up is complete or async with notifications.
  • Write tests against these methods.

overloaded non-const member functions should call const members

So that functionality is only implemented in once place, the service container, service and characteristic descriptor_list find() methods, which are non-const, should not duplicate the implementations of their const partners; but call the const version.

This has led to bugs which I do not yet understand.
Understand them, fix them and resolve this.

BLE_GATTS_EVT_SYS_ATTR_MISSING event in ble_peripheral_class when client is iPhone

See https://devzone.nordicsemi.com/f/nordic-q-a/1948/strange-error-code-13313-0x3401-returned-by-sd_ble_gatts_hvx/8365#8365

As the error suggests, it means that the softdevice doesn't yet have a set of system attributes. :-)

I'd recommend you to read this document to better understand the concept of bonding with regard to our softdevice, since it also applies to the system attributes.

As you can see, bonding data is split between encryption keys and the system attributes. System attributes includes for example values for CCCDs, and the softdevice therefore needs to get those before sending any notification. Hence, when you try to send a notification, if the peer device have not yet written to the CCCDs, the softdevice will ask the application whether it has any previous bonding data to be used, by giving a BLE_GATTS_EVT_SYS_ATTR_MISSING. If the device does use bonding, the bond manager will normally handle this event, and pass back whatever data has previously been written.

However, the system attributes are requested with the same event no matter if the device use bonding or not (the softdevice doesn't really know that). If a device does not use bonding, but in this case, you can just reply like this:

nordic::gattc_uuid128_acquire() will not work for multiple GATTC connections

The implementation for discovering 128-bit UUIDs using the Nordic softdevice will work find
for single connection GATT clients. However, for multiple GATTC clients the stored struct uuid128_read_pending_t instance will conflict.

The struct uuid128_read_pending_t instance needs to be included somewhere in the ble::gattc::connectable hierarchy so that there is one instance per connection.

See ble/nordic_ble_gattc_event_observable.cc gattc_uuid128_acquire() comments.

PORT interrupt handling, reading LATCH persists previous value

This is probably related to the Nordic errata:

     * Errata nRF52832 Rev2, v1.0 3.44 [173]
     * GPIO: Writes to LATCH register take several CPU cycles to take effect
     * Conditions:   Reading the LATCH register right after writing to it.
     * Consequences: Old value of the LATCH register is read.
     * Workaround:   Have at least 3 CPU cycles of delay between the write
     *               and the subsequent read to the LATCH register.
     *               This can be achieved by having 3 dummy reads to the
     *               LATCH register.

The LATCH set of bits contains the bit from the previous interrupt.

gcc C++17 charconv support

The ARM GCC compiler v 7.1 does not support charconv.

Until the switch is made to 8.x we are faking out charconv in nrf/utilities/charconv.h.
Convert to GCC ARM 8.x when appropriate and remove the charconv.h fakery.

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.