Skip to content

Adafruit code for the Nordic nRF52 BLE SoC on Arduino

License

Notifications You must be signed in to change notification settings

smartmeio/arancino-core-nrf52

 
 

Repository files navigation

Arduino Core for Arancino nRF52 Boards

Release

This core is a fork of the Adafruit nRF52 Arduino core modified to support the functionality of the Arancino architecture.

Supported Boards

  • Arancino Volante

Installation on Arduino IDE

This core is available as a package in the Arduino IDE cores manager. If you want to install it:

  1. Open the Preferences of the Arduino IDE.
  2. Add this URL https://raw.githubusercontent.com/smartmeio/arancino-boards/master/package_smartmeio_index.json in the Additional Boards Manager URLs field, and click OK.
  3. Open the Boards Manager (menu Tools -> Board -> Board Manager...)
  4. Install Arancino nRF52 Boards
  5. Select one of the boards under Arancino nRF52 Boards in Tools -> Board menu

Adafruit's nrfutil tools

adafruit-nrfutil (derived from Nordic pc-nrfutil) is needed to upload sketch via serial port.

  • For Windows and macOS, pre-built executable binaries are included in the BSP at tools/adafruit-nrfutil/. It should work out of the box.
  • Linux user need to run follow command to install it from PyPi
$ pip3 install adafruit-nrfutil --user

Installation on PlatformIO and Visual Studio Code

To create a project with Visual Studio Code and PlatformIO it is necessary to initially create a project for Nordic nRF52-DK and then modify the platformio.ini file in order to point to the Arancino packages. The platformio.ini file must be modififed in order to contains this configuration:

[env:arancino_volante]
platform = https://github.com/smartmeio/platform-nordicnrf52.git#9.4.0-arancino
board = arancino_volante
framework = arduino
platform_packages = smartme-io/framework-arduinoarancinonrf52@https://github.com/smartmeio/arancino-core-nrf52.git
lib_deps = https://github.com/smartmeio/arancino-library
upload_port = ...

Any other used library must be included as dependency through lib_deps (as for the Arancino library) or saved under the lib folder; in the latter case the project structure should look like:

include
lib
+-- your_library
     +-- examples
     +-- include
     +-- keywords.txt
     +-- library.json
     +-- src
src
+-- main.cpp
test

Alternatively, you can set an extra directory in which to search for libraries. For example, if you want to include all the libraries installed in the Arduino IDE, you can specify it adding this lines to the platformio.ini configuration file:

lib_extra_dirs = ~/Arduino/libraries

Enabling FreeRTOS support

In nRF52-based boards FreeRTOS is enabled by default and cannot be disabled.

Bootloader

Bootloader can be updated via UF2 file or DFU if already existed. Or flash on new blank chip using following guide

Update Bootloader with UF2

This require existing bootloader version is at least 0.4.0:

  • Quickly double tap reset button to put your board into bootloader mode. A mass storage device i.e NRF52BOOT will appear
  • Download latest UF2 for your board i.e arancino_volante_bootloader_s140_6.1.1.uf2
  • Drap and drop the UF2 file into NRF52BOOT drive to perform update then wait until the board reset.x

Update Bootloader with DFU

To upgrade to the latest Bootloader + Softdevice using the serial port within Arduino IDE.

  • Select Tools -> Board -> Arancino nRF52 Board -> Arancino Volante
  • Select Tools -> Programmer -> Bootloader DFU for Arancino nRF52
  • Select Tools -> Burn Bootloader
  • WAIT until the process complete ~30 seconds

Note: close the Serial Monitor before you click "Burn Bootloader". Afterwards, you shouldn't close the Arduino IDE, unplug the Feather, launch Serial Monitor etc ... to abort the process. There is a high chance it will brick your device! Do this with care and caution.

Burning new Bootloader

To burn the bootloader from within the Arduino IDE, you will need the following tools installed on your system and available in the system path:

Check to make sure you can run nrfjprog from your terminal/command prompt

macOS Note At present, you will need to create a symlink in /usr/local/bin to the nrfjprog tool wherever you have added it. You can run the following command, for example:

$ ln -s $HOME/prog/nordic/nrfjprog/nrfjprog /usr/local/bin/nrfjprog

Manually Burning the Bootloader via nrfjprog

The bootloader hex file can be found at bin/bootloader run the command as follows:

$ nrfjprog -e -f nrf52
$ nrfjprog --program arancino_volante_bootloader_s140_6.1.1.hex -f nrf52
$ nrfjprog --reset -f nrf52

Notes

Important: Since the introduction of FreeRTOS in the core, the code in the loop() function may not work properly, so we suggest implementing your code as a task.

Credits

This core is based on Arduino-nRF5 by Sandeep Mistry, which in turn is based on the Arduino SAMD Core.

The following libraries are used:

About

Adafruit code for the Nordic nRF52 BLE SoC on Arduino

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 88.2%
  • C++ 11.2%
  • Assembly 0.3%
  • Python 0.2%
  • JavaScript 0.1%
  • CSS 0.0%