diff --git a/README.md b/README.md index f7cce020..a9244be6 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,12 @@ For 64-bit Linux users, ```libc6:i386```, ```libstdc++6:i386```, ```libncurses5 __NOTE__: To roll back to the original driver go to: Device Manager -> Right click on device -> Check box for "Delete the driver software for this device" and click Uninstall +### Selecting a SoftDevice +SoftDevices contain the BLE stack and housekeeping, and must be downloaded once before a sketch using BLE can be loaded. +The SD consumes ~5k of Ram + some extra based on actual BLE configuration. +* SoftDevice S110 v8.0.0 supports [Revision](http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf51%2Fdita%2Fnrf51%2Fcompatibility_matrix%2FnRF51822_ic_revision_overview.html&cp=3_0_1) 2 and 3 of nRF51 in peripheral role. It is 96k in size. +* SoftDevice S130 v2.0.1 supports Revision 3 of nRF51 in peripheral and central role. It is 108k in size. +* SoftDevice S132 v2.0.1 supports nRF52 in peripheral and central role. It is 112k in size. ### Flashing a SoftDevice @@ -117,7 +123,7 @@ This Arduino Core does **not** contain any Arduino style API's for BLE functiona If the selected board has an external 32 kHz crystal connected, it will be used as the source for the low frequency clock. Otherwise the internal 32 kHz RC oscillator will be used. The low frequency clock is used by the `delay(ms)` and `millis()` Arduino API's. -The Generic nRF51 and nRF52 board options have an additional menu item under `Tools -> Low Frequency Clock` that allows you to select the low frequency clock source. +The Generic nRF51 and nRF52 board options have an additional menu item under `Tools -> Low Frequency Clock` that allows you to select the low frequency clock source. However, Nordic does not recommend the Synthesized clock, which also has a significant power impact. ## Credits diff --git a/cores/nRF5/wiring_analog_nRF51.c b/cores/nRF5/wiring_analog_nRF51.c index e918eb42..e43b4e6b 100644 --- a/cores/nRF5/wiring_analog_nRF51.c +++ b/cores/nRF5/wiring_analog_nRF51.c @@ -47,7 +47,7 @@ static struct PWMContext pwmContext[PWM_COUNT] = { static int timerEnabled = 0; -static uint32_t adcReference = ADC_CONFIG_REFSEL_VBG; +static uint32_t adcReference = ADC_CONFIG_REFSEL_SupplyOneThirdPrescaling; static uint32_t adcPrescaling = ADC_CONFIG_INPSEL_AnalogInputOneThirdPrescaling; static uint32_t readResolution = 10; @@ -89,10 +89,8 @@ static inline uint32_t mapResolution( uint32_t value, uint32_t from, uint32_t to */ void analogReference( eAnalogReference ulMode ) { - switch ( ulMode ) { - case AR_DEFAULT: + switch ( ulMode ) { case AR_VBG: - default: // 1.2 Reference, 1/3 prescaler = 0 V - 3.6 V range // Minimum VDD for full range in safe operation = 3.3V adcReference = ADC_CONFIG_REFSEL_VBG; @@ -105,12 +103,6 @@ void analogReference( eAnalogReference ulMode ) adcPrescaling = ADC_CONFIG_INPSEL_AnalogInputTwoThirdsPrescaling; break; - case AR_SUPPLY_ONE_THIRD: - // 1/3 VDD Reference, 1/3 prescaler = 0 V - VDD range - adcReference = ADC_CONFIG_REFSEL_SupplyOneThirdPrescaling; - adcPrescaling = ADC_CONFIG_INPSEL_AnalogInputOneThirdPrescaling; - break; - case AR_EXT0: // ARF0 reference, 2/3 prescaler = 0 V - 1.5 ARF0 adcReference = ADC_CONFIG_REFSEL_External | (ADC_CONFIG_EXTREFSEL_AnalogReference0 << ADC_CONFIG_EXTREFSEL_Pos); @@ -122,6 +114,14 @@ void analogReference( eAnalogReference ulMode ) adcReference = (ADC_CONFIG_REFSEL_External | ADC_CONFIG_EXTREFSEL_AnalogReference1 << ADC_CONFIG_EXTREFSEL_Pos); adcPrescaling = ADC_CONFIG_INPSEL_AnalogInputTwoThirdsPrescaling; break; + + case AR_SUPPLY_ONE_THIRD: + case AR_DEFAULT: + default: + // 1/3 VDD Reference, 1/3 prescaler = 0 V - VDD range + adcReference = ADC_CONFIG_REFSEL_SupplyOneThirdPrescaling; + adcPrescaling = ADC_CONFIG_INPSEL_AnalogInputOneThirdPrescaling; + break; } }