From 051e46125333c963cef7ffd835b9a57873fd3e58 Mon Sep 17 00:00:00 2001 From: microbuilder Date: Thu, 26 Jan 2017 18:00:02 +0100 Subject: [PATCH 1/6] Changed name to Bluefruit nRF52 Feather --- boards.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/boards.txt b/boards.txt index bcb0de7f..13420cb6 100644 --- a/boards.txt +++ b/boards.txt @@ -21,7 +21,7 @@ menu.chip=Chip menu.lfclk=Low Frequency Clock menu.board_variant=Board Variant -feather52.name=Adafruit Bluefruit Feather52 +feather52.name=Adafruit Bluefruit nRF52 Feather feather52.vid.0=0x10C4 feather52.pid.0=0xEA60 @@ -68,4 +68,3 @@ feather52.menu.lfclk.lfsynt.build.lfclk_flags=-DUSE_LFSYNT #feather52.menu.softdevice.s132.upload.maximum_size=409600 #feather52.menu.softdevice.s132.build.extra_flags=-DNRF52 -DS132 -DNRF51_S132 #feather52.menu.softdevice.s132.build.ldscript=armgcc_s132_nrf52832_xxaa.ld - From 957f6c90e748fdb06c85bdfcbf2c27f2e47e51cd Mon Sep 17 00:00:00 2001 From: microbuilder Date: Wed, 8 Feb 2017 00:16:41 +0100 Subject: [PATCH 2/6] Reads Basic HW Info --- .../Hardware/hwinfo/hwinfo.ino | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 libraries/AdafruitFeather52Examples/Hardware/hwinfo/hwinfo.ino diff --git a/libraries/AdafruitFeather52Examples/Hardware/hwinfo/hwinfo.ino b/libraries/AdafruitFeather52Examples/Hardware/hwinfo/hwinfo.ino new file mode 100644 index 00000000..575bbbf7 --- /dev/null +++ b/libraries/AdafruitFeather52Examples/Hardware/hwinfo/hwinfo.ino @@ -0,0 +1,37 @@ +#include + +typedef volatile uint32_t REG32; +#define pREG32 (REG32 *) + +#define DEVICE_ID_HIGH (*(pREG32 (0x10000060))) +#define DEVICE_ID_LOW (*(pREG32 (0x10000064))) +#define MAC_ADDRESS_HIGH (*(pREG32 (0x100000a8))) +#define MAC_ADDRESS_LOW (*(pREG32 (0x100000a4))) + +void setup() { + Serial.begin(115200); + + Serial.println("Bluefruit Feather 52 HW Info"); + Serial.println(""); + + // MAC Address + uint32_t addr_high = ((MAC_ADDRESS_HIGH) & 0x0000ffff) | 0x0000c000; + uint32_t addr_low = MAC_ADDRESS_LOW; + Serial.print("MAC Address: "); + Serial.print((addr_high >> 8) & 0xFF, HEX); Serial.print(":"); + Serial.print((addr_high) & 0xFF, HEX); Serial.print(":"); + Serial.print((addr_low >> 24) & 0xFF, HEX); Serial.print(":"); + Serial.print((addr_low >> 16) & 0xFF, HEX); Serial.print(":"); + Serial.print((addr_low >> 8) & 0xFF, HEX); Serial.print(":"); + Serial.print((addr_low) & 0xFF, HEX); Serial.println(""); + + // Unique Device ID + Serial.print("Device ID: "); + Serial.print(DEVICE_ID_HIGH, HEX); + Serial.println(DEVICE_ID_LOW, HEX); +} + +void loop() { + // put your main code here, to run repeatedly: + +} From a9e05081405d820c307af0b1821fbcb10ecc4bda Mon Sep 17 00:00:00 2001 From: microbuilder Date: Wed, 8 Feb 2017 19:47:36 +0100 Subject: [PATCH 3/6] Set ADC defaults to internal (0.6V) ref and 1/6 gain (GND..3.6V) --- cores/nRF5/wiring_analog_nRF52.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/cores/nRF5/wiring_analog_nRF52.c b/cores/nRF5/wiring_analog_nRF52.c index bf975f48..a799cb7e 100644 --- a/cores/nRF5/wiring_analog_nRF52.c +++ b/cores/nRF5/wiring_analog_nRF52.c @@ -76,8 +76,13 @@ static inline uint32_t mapResolution( uint32_t value, uint32_t from, uint32_t to } /* - * Internal Reference is at 1.0v - * External Reference should be between 1v and VDDANA-0.6v=2.7v + * Internal Reference is +/-0.6V, with an adjustable gain of 1/6, 1/5, 1/4, + * 1/3, 1/2 or 1, meaning 3.6, 3.0, 2.4, 1.8, 1.2 or 0.6V for the ADC levels. + * + * External Reference is VDD/4, with an adjustable gain of 1, 2 or 4, meaning + * VDD/4, VDD/2 or VDD for the ADC levels. + * + * Default settings are internal reference with 1/6 gain (GND..3.6V ADC range) * * Warning : On Arduino Zero board the input/output voltage for SAMD21G18 is 3.3 volts maximum */ @@ -167,9 +172,9 @@ uint32_t analogRead( uint32_t ulPin ) NRF_SAADC->CH[i].PSELN = SAADC_CH_PSELP_PSELP_NC; NRF_SAADC->CH[i].PSELP = SAADC_CH_PSELP_PSELP_NC; } - NRF_SAADC->CH[0].CONFIG = ((SAADC_CH_CONFIG_RESP_Bypass << SAADC_CH_CONFIG_RESP_Pos) & SAADC_CH_CONFIG_RESP_Msk) + NRF_SAADC->CH[0].CONFIG = ((SAADC_CH_CONFIG_RESP_Bypass << SAADC_CH_CONFIG_RESP_Pos) & SAADC_CH_CONFIG_RESP_Msk) | ((SAADC_CH_CONFIG_RESP_Bypass << SAADC_CH_CONFIG_RESN_Pos) & SAADC_CH_CONFIG_RESN_Msk) - | ((SAADC_CH_CONFIG_GAIN_Gain1 << SAADC_CH_CONFIG_GAIN_Pos) & SAADC_CH_CONFIG_GAIN_Msk) + | ((SAADC_CH_CONFIG_GAIN_Gain1_6 << SAADC_CH_CONFIG_GAIN_Pos) & SAADC_CH_CONFIG_GAIN_Msk) | ((saadcReference << SAADC_CH_CONFIG_REFSEL_Pos) & SAADC_CH_CONFIG_REFSEL_Msk) | ((SAADC_CH_CONFIG_TACQ_3us << SAADC_CH_CONFIG_TACQ_Pos) & SAADC_CH_CONFIG_TACQ_Msk) | ((SAADC_CH_CONFIG_MODE_SE << SAADC_CH_CONFIG_MODE_Pos) & SAADC_CH_CONFIG_MODE_Msk); From 167070f3dce8a53ef4f8064e1d5dc64d21a05563 Mon Sep 17 00:00:00 2001 From: microbuilder Date: Thu, 9 Feb 2017 17:05:33 +0100 Subject: [PATCH 4/6] Fixed WIN32 check error --- tools/bootutil/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/bootutil/main.c b/tools/bootutil/main.c index 96300e58..245c019f 100644 --- a/tools/bootutil/main.c +++ b/tools/bootutil/main.c @@ -50,7 +50,7 @@ bootutil_help(int rc) BOOTUTIL_VER_MINOR, BOOTUTIL_VER_REVISION); printf("\n"); -#ifndef _WIN32 +#ifdef _WIN32 printf("Usage: bootutil.exe -d [-c ] [-ghrv]\n"); #else printf("Usage: bootutil -d [-c ] [-hrv]\n"); From a6e828ed00a5ce3ecfe510d29e2b437b9c2da9f5 Mon Sep 17 00:00:00 2001 From: microbuilder Date: Thu, 9 Feb 2017 21:28:07 +0100 Subject: [PATCH 5/6] Added blinky --- .../examples/bleuart/bleuart.ino | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/libraries/Bluefruit52Lib/examples/bleuart/bleuart.ino b/libraries/Bluefruit52Lib/examples/bleuart/bleuart.ino index 25e7c532..8e73e212 100644 --- a/libraries/Bluefruit52Lib/examples/bleuart/bleuart.ino +++ b/libraries/Bluefruit52Lib/examples/bleuart/bleuart.ino @@ -17,12 +17,22 @@ BLEDis bledis; BLEUart bleuart; BLEBas blebas; -void setup() +#define STATUS_LED (17) +#define BLE_LED (19) + +int blinkyms; + +void setup() { Serial.begin(115200); Serial.println("Bluefruit52 BLEUART Example"); + // Setup LED pins and reset blinky counter + pinMode(STATUS_LED, OUTPUT); + pinMode(BLE_LED, OUTPUT); + blinkyms = millis(); + Bluefruit.begin(); Bluefruit.setName("Bluefruit52"); @@ -48,11 +58,11 @@ void setup() } void setupAdv(void) -{ +{ //Bluefruit.addAdvTxPower(); Bluefruit.addAdvFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE); Bluefruit.addAdvTxPower(); - + // Include bleuart 128-bit uuid Bluefruit.addAdvService(bleuart); @@ -61,8 +71,15 @@ void setupAdv(void) Bluefruit.addScanName(); } -void loop() +void loop() { + // Blinky! + if (blinkyms+500 < millis()) { + blinkyms = millis(); + digitalWrite(STATUS_LED, !digitalRead(STATUS_LED)); + digitalWrite(BLE_LED, !digitalRead(STATUS_LED)); + } + // forward from Serial to BLEUART if (Serial.available()) { @@ -82,4 +99,3 @@ void loop() Serial.write(ch); } } - From ba08514fb92de1838296717beb9d6792eea83028 Mon Sep 17 00:00:00 2001 From: ladyada Date: Thu, 9 Feb 2017 22:32:59 -0500 Subject: [PATCH 6/6] extra named pins --- variants/feather52/variant.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/variants/feather52/variant.h b/variants/feather52/variant.h index 6ffc05af..a06fca93 100644 --- a/variants/feather52/variant.h +++ b/variants/feather52/variant.h @@ -77,6 +77,10 @@ static const uint8_t A7 = PIN_A7 ; // Other pins #define PIN_AREF (24) +#define PIN_DFU (20) +#define PIN_NFC1 (9) +#define PIN_NFC2 (10) + static const uint8_t AREF = PIN_AREF; /*