User Tools

Site Tools


s340:arduino_ide_integration_for_the_nrf52840_feather_express_with_s340

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
s340:arduino_ide_integration_for_the_nrf52840_feather_express_with_s340 [2020/03/15 22:51]
orrmany [Third major step: add S340 to the BSP]
s340:arduino_ide_integration_for_the_nrf52840_feather_express_with_s340 [2020/03/29 20:07]
orrmany [Introduction]
Line 18: Line 18:
   - the Core bundles the S340 SD with the sketch instead of the original S140 SD    - the Core bundles the S340 SD with the sketch instead of the original S140 SD 
   - and that the memory-layout settings are adapted to the different softdevice   - and that the memory-layout settings are adapted to the different softdevice
 +===== Credits ===== 
 +This work is based on [[https://​github.com/​rtgree01|rtgree01]]'​s PlatformIO adaptation. See also the [[http://​orrmany.hu/​wiki/​doku.php?​id=arduino:​s340_softdevice_adafruit_nrf52840_feather_express#​credits|Credits]] section with the page [[arduino:​s340_softdevice_adafruit_nrf52840_feather_express|S340 SoftDevice & Adafruit nRF52840 Express Feather]]
 ===== Prerequisites ===== ===== Prerequisites =====
 This HOWTO assumes that This HOWTO assumes that
   - You are familiar with [[https://​www.arduino.cc/​en/​Guide/​Introduction|Arduino]],​ with [[https://​www.arduino.cc/​en/​Guide/​HomePage|Arduino based SW development]] and with the [[https://​www.arduino.cc/​en/​main/​software|Arduino desktop IDE]], which latter you have downloaded and installed already.   - You are familiar with [[https://​www.arduino.cc/​en/​Guide/​Introduction|Arduino]],​ with [[https://​www.arduino.cc/​en/​Guide/​HomePage|Arduino based SW development]] and with the [[https://​www.arduino.cc/​en/​main/​software|Arduino desktop IDE]], which latter you have downloaded and installed already.
-  - You have an [[https://​www.adafruit.com/​product/​4062|Adafruit Feather nRF52840 Express]] which [[:​s340_softdevice_adafruit_nrf52840_feather_express|you have made ANT protocol capable]]+  - You have an [[https://​www.adafruit.com/​product/​4062|Adafruit Feather nRF52840 Express]] which [[arduino:​s340_softdevice_adafruit_nrf52840_feather_express|you have made ANT protocol capable]]
  
 ===== Integration step-by-step ===== ===== Integration step-by-step =====
 Adafruit has described [[https://​learn.adafruit.com/​introducing-the-adafruit-nrf52840-feather/​arduino-bsp-setup|how to install their BSP]] either via the Arduino IDE board manager, or directly from GitHub. The latter method is said to be intended if //"you wish to do any development against the core codebase [..] you can also optionally install the Adafruit nRF52 BSP manually using '​git'"//​. We will do exactly like that --- except that we are going to install the alternative,​ S340 SD equipped bootloader that we have [[:​s340_softdevice_adafruit_nrf52840_feather_express|recently made]]! :) Adafruit has described [[https://​learn.adafruit.com/​introducing-the-adafruit-nrf52840-feather/​arduino-bsp-setup|how to install their BSP]] either via the Arduino IDE board manager, or directly from GitHub. The latter method is said to be intended if //"you wish to do any development against the core codebase [..] you can also optionally install the Adafruit nRF52 BSP manually using '​git'"//​. We will do exactly like that --- except that we are going to install the alternative,​ S340 SD equipped bootloader that we have [[:​s340_softdevice_adafruit_nrf52840_feather_express|recently made]]! :)
  
-In order to make this lazy self-contained,​ I have copied the text of the [[https://​learn.adafruit.com/​introducing-the-adafruit-nrf52840-feather/​arduino-bsp-setup|Adafruit Arduino Support Setup]] here, the copied text is denoted ​with with a gray quotation-bar ​+In order to make this lazy self-contained,​ I have copied the text of the [[https://​learn.adafruit.com/​introducing-the-adafruit-nrf52840-feather/​arduino-bsp-setup|Adafruit Arduino Support Setup]] here, the verbatim ​copied text is denoted with a gray quotation-bar ​
 ==== First step: install regular BSP as described by Adafruit ==== ==== First step: install regular BSP as described by Adafruit ====
 === 1. Install the nRF52 Core by Adafruit via the board manager ===  === 1. Install the nRF52 Core by Adafruit via the board manager === 
Line 72: Line 73:
 >  4. Create a folder named hardware/​Adafruit,​ if it does not exist, and change directories into it. >  4. Create a folder named hardware/​Adafruit,​ if it does not exist, and change directories into it.
 >  5. Clone the Adafruit_nRF52_Arduino repo in the folder described in step 2: >  5. Clone the Adafruit_nRF52_Arduino repo in the folder described in step 2:
->> ​ <del>''​git clone git@github.com:​adafruit/​Adafruit_nRF52_Arduino.git''​</del+>> ​ <code>git clone git@github.com:​adafruit/​Adafruit_nRF52_Arduino.git 
-Instead of cloning the the original Adafruit bootloader, if you are lazy you cal clone my modified one: +cd Adafruit_nRF52_Arduino 
 +git submodule update --init --recursive 
 +</code
 +Instead of cloning the the original Adafruit bootloader, if you are lazy you can clone my modified one: 
 <code bash> <code bash>
 git clone -b adding-S340-to-nrf52840-Feather --single-branch https://​github.com/​orrmany/​Adafruit_nRF52_Arduino.git git clone -b adding-S340-to-nrf52840-Feather --single-branch https://​github.com/​orrmany/​Adafruit_nRF52_Arduino.git
 +cd Adafruit_nRF52_Arduino
 +git submodule update --init --recursive
 </​code>​ </​code>​
 If you **//do use my repo//**, the do **not** forget that you will still need to download the [[https://​www.thisisant.com/​developer/​components/​nrf52832#​tab_protocol_stacks_tab|S340 softdevice from thisisant.com]] and install it into the proper place, as redistribution of the said SoftDevice by individuals is not permited. You //must// sign the ANT license and respect its conditions. The way you can get the S340 is described at the [[https://​www.nordicsemi.com/​Software-and-tools/​Software/​S340-ANT|Nordic Semiconductor page]]. If you **//do use my repo//**, the do **not** forget that you will still need to download the [[https://​www.thisisant.com/​developer/​components/​nrf52832#​tab_protocol_stacks_tab|S340 softdevice from thisisant.com]] and install it into the proper place, as redistribution of the said SoftDevice by individuals is not permited. You //must// sign the ANT license and respect its conditions. The way you can get the S340 is described at the [[https://​www.nordicsemi.com/​Software-and-tools/​Software/​S340-ANT|Nordic Semiconductor page]].
Line 225: Line 231:
      ​└── nrf_svc.h      ​└── nrf_svc.h
 </​code>​ </​code>​
-  - Go to ''​bootloader/​feather_nrf52840_express''​. You will find ''​feather_nrf52840_express_bootloader-0.3.0_s**1**40_6.1.1.zip''​ and  ''​feather_nrf52840_express_bootloader-0.3.0_s**1**40_6.1.1.hex''​ here. Now copy the files ''​feather_nrf52840_express_bootloader-0.3.0_s**3**40_6.1.1.hex''​ and ''​feather_nrf52840_express_bootloader-0.3.0_s**3**40_6.1.1.zip''​ from where you have built the modified bootloader with S340 (see page [[arduino:​s340_softdevice_adafruit_nrf52840_feather_express|S340 SoftDevice & Adafruit nRF52840 Express Feather]] about how to build it). That is, the directory ''​bootloader/​feather_nrf52840_express''​ should look like this<​code txt>+  - Go to ''​bootloader/​feather_nrf52840_express''​. You will find ''​feather_nrf52840_express_bootloader-0.3.0_s**1**40_6.1.1.zip''​ and  ''​feather_nrf52840_express_bootloader-0.3.0_s**1**40_6.1.1.hex''​ here. Now copy the corresponding ​files or s340 as ''​feather_nrf52840_express_bootloader-0.3.0_s**3**40_6.1.1.hex''​ and ''​feather_nrf52840_express_bootloader-0.3.0_s**3**40_6.1.1.zip''​ from where you have built the modified bootloader with S340 (see page [[arduino:​s340_softdevice_adafruit_nrf52840_feather_express|S340 SoftDevice & Adafruit nRF52840 Express Feather]] about how to build it). That is, the directory ''​bootloader/​feather_nrf52840_express''​ should look like this<​code txt>
 .../​feather_nrf52840_express .../​feather_nrf52840_express
        ​├── feather_nrf52840_express_bootloader-0.3.0_s140_6.1.1.zip        ​├── feather_nrf52840_express_bootloader-0.3.0_s140_6.1.1.zip
Line 232: Line 238:
        ​└── feather_nrf52840_express_bootloader-0.3.0_s340_6.1.1.zip        ​└── feather_nrf52840_express_bootloader-0.3.0_s340_6.1.1.zip
 </​code>​ </​code>​
 +  - //(Already done in my modified repo on Github.)// Go to ''​libraries/​Bluefruit52Lib/​src/''​ and modify ''​bluefruit.cpp''​ as follows: <code diff>​diff --git a/​libraries/​Bluefruit52Lib/​src/​bluefruit.cpp b/​libraries/​Bluefruit52Lib/​src/​bluefruit.cpp
 +index d17f66e4..1fe53626 100644
 +--- a/​libraries/​Bluefruit52Lib/​src/​bluefruit.cpp
 ++++ b/​libraries/​Bluefruit52Lib/​src/​bluefruit.cpp
 +@@ -318,7 +318,11 @@ bool AdafruitBluefruit::​begin(uint8_t prph_count, uint8_t central_count)
 +   #​error Clock Source is not configured, define USE_LFXO or USE_LFRC according to your board in variant.h
 + #​endif
 +
 ++#ifdef ANT_LICENSE_KEY
 ++  VERIFY_STATUS( sd_softdevice_enable(&​clock_cfg,​ nrf_error_cb,​ ANT_LICENSE_KEY),​ false );
 ++#else
 +   ​VERIFY_STATUS( sd_softdevice_enable(&​clock_cfg,​ nrf_error_cb),​ false );
 ++#endif
 +
 + #​ifdef USE_TINYUSB
 +   ​usb_softdevice_post_enable();​
 +(
 +</​code>​
 +    * **Do not forget** that you shall obtain the [[https://​www.thisisant.com/​developer/​ant-plus/​ant-plus-basics/​network-keys|ANT License Key]] from ThisIsAnt.com and ''#​define''​ said ANT_LICENSE_KEY in your sketch!
   - Start the Arduino IDE   - Start the Arduino IDE
  
 Now you can build and upload sketches from the Arduino IDE by using ''​Adafruit Bluefruit Feather nRF52840 Express w.ANT''​ as board type Now you can build and upload sketches from the Arduino IDE by using ''​Adafruit Bluefruit Feather nRF52840 Express w.ANT''​ as board type
 +===== Caveats =====
 +  * Please note, that the above changes just mean that you have replaced the bootloader and the softdevice with  an ANT+ capable one. //​Developing ANT+ application needs additional software, which you need to develop yourself, or obtain and adapt from thisisant.org,​ for example//
 +  * All the regular Arduino sketches and all the Bluefruit52 SW is supposed to run as-is with the modified bootloader
 +  * **NOTE** that CircuitPython compatibility will be lost with this modification. The CircuitPython interpreter is distributed as UF2 binary firmware-update and that is bundled with the S140 BLE softdevice. Trying to "​update"​ an S340 equipped nRF52804 Feather with the CircuitPython interpreter formware will most likely "​brick"​ your Feather and you will need a Segger J-Link firmware-updater to "​unbrick"​ your Feather
 +
s340/arduino_ide_integration_for_the_nrf52840_feather_express_with_s340.txt · Last modified: 2020/05/05 20:11 by orrmany