Removes custom board lnker scripts
For now let's use adafruit_feather_nrf52832.
This commit is contained in:
parent
ea4bd872bc
commit
850df22f1a
7 changed files with 52 additions and 46 deletions
|
|
@ -2,19 +2,20 @@
|
|||
A low power soil moisture sensor based on the nRF52840.
|
||||
|
||||
# TODO
|
||||
* Implement ADC; check out air/water range (using protoboard)
|
||||
* Implement BLE advertising with moisture, battery level
|
||||
* Figure out how to calibrate the ADC when running from different voltages, as the battery discharges
|
||||
* Implement deep sleep
|
||||
* Implement BLE advertising with moisture, battery level
|
||||
* Measure current in deep sleep
|
||||
* Measure current in operation (ADC + BLE adversiting)
|
||||
* Test with a range of 2-5V input. Disconnect from USB and monitor using a serial post. Use the bench power supply to power Vcc with variable voltage. *DO NOT CONNECT VCC FROM THE USB-TO-SERIAL BOARD!**
|
||||
* Test with a coin cell
|
||||
* Implement ADC for battery monitoring
|
||||
* Figure out a way for people to configure the device with a custom name. Idea: BLE service (this is what my [hacked xiaomi temp sensor](https://github.com/atc1441/ATC_MiThermometer) does)
|
||||
* Figure out how OTA works (if at all) over BLE
|
||||
* Design new board using the nrf52 instead of esp32
|
||||
|
||||
# Done
|
||||
* Implement ADC for the parasitic capacitor; check out air/water range (using protoboard)
|
||||
* Simple PWM square wave generator
|
||||
* Hook square wave generator to the protoboard sensor circuit
|
||||
* Make the protoboard sensor work
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
/* Linker script to configure memory regions. */
|
||||
/* Source: https://raw.githubusercontent.com/adafruit/Adafruit_nRF52_Arduino/master/cores/nRF5/linker/nrf52832_s132_v6.ld */
|
||||
|
||||
SEARCH_DIR(.)
|
||||
GROUP(-lgcc -lc -lnosys)
|
||||
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x26000, LENGTH = 0x6D000 - 0x26000
|
||||
|
||||
/* SRAM required by S132 depend on
|
||||
* - Attribute Table Size
|
||||
* - Vendor UUID count
|
||||
* - Max ATT MTU
|
||||
* - Concurrent connection peripheral + central + secure links
|
||||
* - Event Len, HVN queue, Write CMD queue
|
||||
*/
|
||||
RAM (rwx) : ORIGIN = 0x20003600, LENGTH = 0x20010000 - 0x20003600
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
. = ALIGN(4);
|
||||
.svc_data :
|
||||
{
|
||||
PROVIDE(__start_svc_data = .);
|
||||
KEEP(*(.svc_data))
|
||||
PROVIDE(__stop_svc_data = .);
|
||||
} > RAM
|
||||
|
||||
.fs_data :
|
||||
{
|
||||
PROVIDE(__start_fs_data = .);
|
||||
KEEP(*(.fs_data))
|
||||
PROVIDE(__stop_fs_data = .);
|
||||
} > RAM
|
||||
} INSERT AFTER .data;
|
||||
|
||||
/* TODO(rbaron): This should be failing but it's not. Maybe it's loading it from somewhere else? */
|
||||
INCLUDE "nrf52_common.ld"
|
||||
5
code/parasite/lib/parasite/ble.cpp
Normal file
5
code/parasite/lib/parasite/ble.cpp
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#include "ble.h"
|
||||
|
||||
#include "ble_advdata.h"
|
||||
#include "nrf_sdh.h"
|
||||
#include "nrf_sdh_ble.h"
|
||||
14
code/parasite/lib/parasite/ble.h
Normal file
14
code/parasite/lib/parasite/ble.h
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#ifndef _PARASITE_BLE_H_
|
||||
#define _PARASITE_BLE_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace parasite {
|
||||
|
||||
class BLEAdvertiser {
|
||||
public:
|
||||
void Advertise(std::string name, double moisture) {}
|
||||
}
|
||||
|
||||
} // namespace parasite
|
||||
#endif // _PARASITE_BLE_H_
|
||||
|
|
@ -9,13 +9,14 @@
|
|||
; https://docs.platformio.org/page/projectconf.html
|
||||
|
||||
[common]
|
||||
check_tool = clangtidy
|
||||
lib_deps = sandeepmistry/BLEPeripheral@^0.4.0
|
||||
|
||||
[env:e73-tbb]
|
||||
platform = nordicnrf52
|
||||
board = adafruit_feather_nrf52832
|
||||
; Additionally, I had to force use_adafruit = True in platforms/nordicnrf52/builder/main.py
|
||||
; board = e73-tbb
|
||||
framework = arduino
|
||||
build_flags = -DNRF52 -DS132 -DNRF51_S132
|
||||
board_build.ldscript = ./ldscripts/nrf52832_s132_v6.ld
|
||||
|
||||
; Let's keep it simple for now and just use adafruit_feather_nrf52832.
|
||||
; board = e73-tbb
|
||||
; board_build.ldscript = ./ldscripts/nrf52832_s132_v6.ld
|
||||
|
|
@ -1,7 +1,10 @@
|
|||
#include <Arduino.h>
|
||||
|
||||
// #include "ble.h"
|
||||
#include "pwm.h"
|
||||
|
||||
#include "nrf_sdh_ble.h"
|
||||
|
||||
constexpr int kLED1Pin = 17;
|
||||
constexpr int kLED2Pin = 18;
|
||||
constexpr int kPWMPin = 19;
|
||||
|
|
@ -9,6 +12,23 @@ constexpr int kSensAnalogPin = 4; // AIN2
|
|||
constexpr int kDischargeEnablePin = 16;
|
||||
constexpr double kPWMFrequency = 500000;
|
||||
|
||||
// static void ble_stack_init(void) {
|
||||
// ret_code_t err_code;
|
||||
|
||||
// err_code = nrf_sdh_enable_request();
|
||||
// APP_ERROR_CHECK(err_code);
|
||||
|
||||
// // Configure the BLE stack using the default settings.
|
||||
// // Fetch the start address of the application RAM.
|
||||
// uint32_t ram_start = 0;
|
||||
// err_code = nrf_sdh_ble_default_cfg_set(APP_BLE_CONN_CFG_TAG, &ram_start);
|
||||
// APP_ERROR_CHECK(err_code);
|
||||
|
||||
// // Enable BLE stack.
|
||||
// err_code = nrf_sdh_ble_enable(&ram_start);
|
||||
// APP_ERROR_CHECK(err_code);
|
||||
// }
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
pinMode(kLED1Pin, OUTPUT);
|
||||
|
|
|
|||
|
|
@ -140,4 +140,9 @@ I'm getting ~680 when in the air; ~65 while holding the sensor. The default reso
|
|||
# Battery monitoring
|
||||
* Good post on how to measure lipo batteries: [link](https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/measuring-lithium-battery-voltage-with-nrf52#:~:text=To%20reduce%20the%20leakage%20current,of%2040%20us%2C%20see%20here.)
|
||||
|
||||
# BLE
|
||||
* BLE examples for platformio with nordicnrf52 platform: [link](https://github.com/platformio/platform-nordicnrf52/tree/master/examples)
|
||||
* [BLEPeripheral](https://github.com/sandeepmistry/arduino-BLEPeripheral) seems to be a popular library choice
|
||||
* [nrf5 BLE examples](https://devzone.nordicsemi.com/nordic/short-range-guides/b/bluetooth-low-energy/posts/ble-advertising-a-beginners-tutorial) are way more complicated than I need for now
|
||||
|
||||
# OTA
|
||||
Loading…
Add table
Reference in a new issue