Update NRF52 build to work again

This commit is contained in:
geeksville 2020-07-09 19:57:55 -07:00
parent 62c9bad183
commit ed589727d6
13 changed files with 82 additions and 24 deletions

View File

@ -8,7 +8,7 @@
"extra_flags": "-DARDUINO_NRF52840_PCA10056 -DNRF52840_XXAA",
"f_cpu": "64000000L",
"hwids": [["0x239A", "0x4404"]],
"usb_product": "SimPPR",
"usb_product": "nrf52840dk",
"mcu": "nrf52840",
"variant": "pca10056-rc-clock",
"variants_dir": "variants",

14
docs/software/ant.md Normal file
View File

@ -0,0 +1,14 @@
# ANT protocol notes
SD340 terms are reasonable for NRF52
https://www.thisisant.com/developer/components/nrf52832#tab_protocol_stacks_tab
Profiles to implement:
tracker
https://www.thisisant.com/developer/ant-plus/device-profiles/#4365_tab
ebike
https://www.thisisant.com/developer/ant-plus/device-profiles/#527_tab
no profile for messaging?

View File

@ -5,8 +5,11 @@
RAM investigation.
nRF52832-QFAA 64KB ram, 512KB flash vs
nrf52832-QFAB 32KB ram, 512kb flash
nrf52833 128KB RAM
nrf52840 256KB RAM, 1MB flash
Manual hacks needed to build (for now):
platform.json
"framework-arduinoadafruitnrf52": {
@ -15,6 +18,8 @@ platform.json
"version": "https://github.com/meshtastic/Adafruit_nRF52_Arduino.git"
},
kevinh@kevin-server:~/.platformio/packages/framework-arduinoadafruitnrf52/variants$ ln -s ~/development/meshtastic/meshtastic-esp32/variants/* .
## Initial work items
Minimum items needed to make sure hardware is good.

6
docs/software/rak815.md Normal file
View File

@ -0,0 +1,6 @@
# RAK815
Notes on trying to get the RAK815 working with meshtastic.
good tutorial: https://www.hackster.io/naresh-krish/getting-started-with-rak815-tracker-module-and-arduino-1c7bc9
(includes software serial link - possibly useful for GPS)

View File

@ -9,7 +9,7 @@
; https://docs.platformio.org/page/projectconf.html
[platformio]
default_envs = tbeam ; Note: the github actions CI test build can't yet build NRF52 targets
default_envs = nrf52dk ; Note: the github actions CI test build can't yet build NRF52 targets
[common]
; common is not currently used
@ -74,7 +74,7 @@ lib_deps =
Wire ; explicitly needed here because the AXP202 library forgets to add it
https://github.com/meshtastic/arduino-fsm.git
https://github.com/meshtastic/SparkFun_Ublox_Arduino_Library.git
https://github.com/meshtastic/RadioLib.git#6aa38a85856012c99c4e9b4e7cee35e37671a4bc
https://github.com/meshtastic/RadioLib.git#d6b12f7eb0a06bd2414c79b437b25d377e3f603f
https://github.com/meshtastic/TinyGPSPlus.git
; Common settings for ESP targes, mixin with extends = esp32_base

8
src/BluetoothCommon.h Normal file
View File

@ -0,0 +1,8 @@
#pragma once
/**
* Common lib functions for all platforms that have bluetooth
*/
/// Given a level between 0-100, update the BLE attribute
void updateBatteryLevel(uint8_t level);

View File

@ -1,7 +1,13 @@
#include "Thread.h"
#include "timing.h"
#include <assert.h>
namespace concurrency {
#ifdef ARDUINO_ARCH_ESP32
#include "esp_task_wdt.h"
#endif
namespace concurrency
{
void Thread::start(const char *name, size_t stackSize, uint32_t priority)
{
@ -14,4 +20,27 @@ void Thread::callRun(void *_this)
((Thread *)_this)->doRun();
}
void Thread::serviceWatchdog()
{
#ifdef ARDUINO_ARCH_ESP32
esp_task_wdt_reset();
#endif
}
void Thread::startWatchdog()
{
#ifdef ARDUINO_ARCH_ESP32
auto r = esp_task_wdt_add(taskHandle);
assert(r == ESP_OK);
#endif
}
void Thread::stopWatchdog()
{
#ifdef ARDUINO_ARCH_ESP32
auto r = esp_task_wdt_delete(taskHandle);
assert(r == ESP_OK);
#endif
}
} // namespace concurrency

View File

@ -1,7 +1,6 @@
#pragma once
#include "freertosinc.h"
#include "esp_task_wdt.h"
namespace concurrency {
@ -36,17 +35,9 @@ class Thread
*
* this only applies after startWatchdog() has been called. If you need to sleep for a long time call stopWatchdog()
*/
void serviceWatchdog() { esp_task_wdt_reset(); }
void startWatchdog()
{
auto r = esp_task_wdt_add(taskHandle);
assert(r == ESP_OK);
}
void stopWatchdog()
{
auto r = esp_task_wdt_delete(taskHandle);
assert(r == ESP_OK);
}
void serviceWatchdog();
void startWatchdog();
void stopWatchdog();
private:
static void callRun(void *_this);

View File

@ -62,6 +62,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// Standard definitions for NRF52 targets
//
// Nop definition for these attributes - not used on NRF52
#define EXT_RAM_ATTR
#define IRAM_ATTR
#define NO_ESP32 // Don't use ESP32 libs (mainly bluetooth)
// We bind to the GPS using variant.h instead for this platform (Serial1)

View File

@ -35,8 +35,5 @@ BLECharacteristic *addBLECharacteristic(BLECharacteristic *c);
/// Add a characteristic that we will delete when we restart
BLEDescriptor *addBLEDescriptor(BLEDescriptor *c);
/// Given a level between 0-100, update the BLE attribute
void updateBatteryLevel(uint8_t level);
/// Any bluetooth objects you allocate _must_ come from this pool if you want to be able to call deinitBLE()
extern SimpleAllocator btPool;

View File

@ -33,7 +33,7 @@
#include "power.h"
// #include "rom/rtc.h"
#include "DSRRouter.h"
#include "debug.h"
// #include "debug.h"
#include "graphics/Screen.h"
#include "main.h"
#include "sleep.h"

View File

@ -5,14 +5,14 @@
#include "GPS.h"
//#include "MeshBluetoothService.h"
#include "../concurrency/Periodic.h"
#include "BluetoothCommon.h" // needed for updateBatteryLevel, FIXME, eventually when we pull mesh out into a lib we shouldn't be whacking bluetooth from here
#include "MeshService.h"
#include "NodeDB.h"
#include "../concurrency/Periodic.h"
#include "PowerFSM.h"
#include "main.h"
#include "mesh-pb-constants.h"
#include "power.h"
#include "BluetoothUtil.h" // needed for updateBatteryLevel, FIXME, eventually when we pull mesh out into a lib we shouldn't be whacking bluetooth from here
#include "timing.h"
/*
@ -283,8 +283,6 @@ void MeshService::sendOurPosition(NodeNum dest, bool wantReplies)
sendToMesh(p);
}
int MeshService::onGPSChanged(void *unused)
{
// DEBUG_MSG("got gps notify\n");

View File

@ -1,6 +1,7 @@
#include "NRF52Bluetooth.h"
#include "configuration.h"
#include "main.h"
#include "BluetoothCommon.h"
#include <bluefruit.h>
/* HRM Service Definitions
@ -192,6 +193,11 @@ void NRF52Bluetooth::setup()
}
}
/// Given a level between 0-100, update the BLE attribute
void updateBatteryLevel(uint8_t level) {
// FIXME - implement
}
/*
void loop()
{