Merge pull request #788 from geeksville/rak

Add beginnings of RAK4600 and update to latest nrf52 arduino sources
This commit is contained in:
Kevin Hester 2021-04-15 12:31:25 +08:00 committed by GitHub
commit 0d5c5046ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 261 additions and 20 deletions

View File

@ -4,6 +4,19 @@ You probably don't care about this section - skip to the next one.
## before next release
* DONE @vfurman fixed android nrf52 problem
* probably fixed (stack overflow generating qr code) meshm reported a crash
* DONE @havealoha reported android overrides fixed positions
* @luxonn reports that after a while the android app stops showing new messages
* DONE android speed settings https://github.com/meshtastic/Meshtastic-Android/issues/271
* add cloudflare
* fix heltec battery scaling
* check android 1.2.20 usage, possibly release to general
* release android APK
* add rak4600 support (with rf95 radio and limited ram)
* Switch to use https://github.com/adafruit/Adafruit_nRF52_Arduino.git when available (see arduino code for examples)
* DONE remote admin busted?
* DONE check android code - @havealoha comments about odd sleep behavior
* ABANDONED test github actions locally on linux

View File

@ -29,20 +29,22 @@ Set IO2=0, 3V3_S is off.
* Fix android bug with detecting nrf52 BLE devices
* Make this doc into a nice HOWTO: what to order, how to connect (which device in which slots), how to install software
* Setup battery voltage sensing
* Setup battery voltage sensing, Vbatt seems direct connected to AIN0 on RAK4631 carrier which is apparently P0.5/AIN3 on the RAK4630 module, per this schematic. https://docs.rakwireless.com/Product-Categories/WisBlock/RAK4631/Datasheet/#description But no voltage divider to be found, so ask them.
* Set bluetooth PIN support
* Confirm low power draw
* Confirm that OLED works
* add purchash links
* send in PR to https://github.com/geeksville/WisBlock for boards define
## Docs
Quickstart
https://docs.rakwireless.com/Product-Categories/WisBlock/Quickstart/#wisblock-base-2
FIXME - list required, recommended and optional components
GPS module:
Supposedly "Install in slot A only" but I think installing on the back would fit better with the OLED. FIXME.
Must be installed in "Slot A"
https://docs.rakwireless.com/Product-Categories/WisBlock/RAK1910/Overview/#product-description
ST LPS22HB

View File

@ -9,7 +9,7 @@
; https://docs.platformio.org/page/projectconf.html
[platformio]
;default_envs = tbeam
default_envs = tbeam
;default_envs = tbeam0.7
;default_envs = heltec
;default_envs = tlora-v1
@ -19,7 +19,8 @@
;default_envs = eink
;default_envs = nrf52840dk-geeksville
;default_envs = native # lora-relay-v1 # nrf52840dk-geeksville # linux # or if you'd like to change the default to something like lora-relay-v1 put that here
default_envs = rak4631
;default_envs = rak4631
;default_envs = rak4630
[common]
; common is not currently used
@ -194,7 +195,7 @@ src_filter =
[nrf52_base]
; Instead of the standard nordicnrf52 platform, we use our fork which has our added variant files
; platform = nordicnrf52
platform = https://github.com/meshtastic/platform-nordicnrf52.git#1a2639a6b0f79b5df66bea3e3089f0d5285fdc63
platform = https://github.com/meshtastic/platform-nordicnrf52.git#merge
extends = arduino_base
build_type = debug ; I'm debugging with ICE a lot now
; note: liboberon provides the AES256 implementation for NRF52 (though not using the hardware acceleration of the NRF52840 - FIXME)
@ -241,6 +242,14 @@ debug_init_break =
;debug_init_break = tbreak loop
;debug_init_break = tbreak Reset_Handler
[nrf52840_base]
; Common base class for all nrf52840 based targets
extends = nrf52_base
lib_deps =
${arduino_base.lib_deps}
Adafruit nRFCrypto
# add Adafruit nRFCrypto platform IO automated scan is broken
[env:lora_isp4520]
extends = nrf52_base
board = lora_isp4520
@ -262,12 +271,12 @@ monitor_port = /dev/ttyUSB0
; The NRF52840-dk development board
; Note: By default no lora device is created for this build - it uses a simulated interface
[env:nrf52840dk]
extends = nrf52_base
extends = nrf52840_base
board = nrf52840_dk
; The NRF52840-dk development board, but @geeksville's board - which has a busted oscilliator
[env:nrf52840dk-geeksville]
extends = nrf52_base
extends = nrf52840_base
board = nrf52840_dk_modified
# add our variants files to the include and src paths
build_flags = ${nrf52_base.build_flags} -Ivariants/pca10056-rc-clock
@ -290,17 +299,28 @@ monitor_speed = 115200
# For experimenting with RAM sizes
# board_build.ldscript = linker/nrf52840_s140_sim832.ld
; The very slick RAK wireless RAK 4631 / 4630 board
[env:rak4631]
extends = nrf52_base
extends = nrf52840_base
board = wiscore_rak4631
# add our variants files to the include and src paths
# define build flags for the TFT_eSPI library
build_flags = ${nrf52_base.build_flags} -Ivariants/WisCore_RAK4631_Board
src_filter = ${nrf52_base.src_filter} +<../variants/eink>
src_filter = ${nrf52_base.src_filter} +<../variants/WisCore_RAK4631_Board>
debug_tool = jlink
; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm)
;upload_protocol = jlink
; THIS IS UNTESTED (I don't have this board), but other developers can use it as a starting point
[env:rak4600]
extends = nrf52_base
board = wiscore_rak4600
# add our variants files to the include and src paths
# define build flags for the TFT_eSPI library
build_flags = ${nrf52_base.build_flags} -Ivariants/WisCore_RAK4600_Board
src_filter = ${nrf52_base.src_filter} +<../variants/WisCore_RAK4600_Board>
lib_deps =
${arduino_base.lib_deps}
debug_tool = jlink
upload_protocol = jlink
; The PPR board
[env:ppr]
@ -321,7 +341,7 @@ lib_deps =
; First prototype eink/nrf52840/sx1262 device
[env:eink]
extends = nrf52_base
extends = nrf52840_base
board = eink
# add our variants files to the include and src paths
# define build flags for the TFT_eSPI library
@ -329,13 +349,13 @@ build_flags = ${nrf52_base.build_flags} -Ivariants/eink
-DBUSY_PIN=3 -DRST_PIN=2 -DDC_PIN=28 -DCS_PIN=30
src_filter = ${nrf52_base.src_filter} +<../variants/eink>
lib_deps =
${arduino_base.lib_deps}
${nrf52840_base.lib_deps}
https://github.com/geeksville/EPD_Libraries.git
TFT_eSPI
; First prototype eink/nrf52840/sx1262 device
[env:eink0.1]
extends = nrf52_base
extends = nrf52840_base
board = eink0.1
# add our variants files to the include and src paths
# define build flags for the TFT_eSPI library
@ -343,13 +363,13 @@ build_flags = ${nrf52_base.build_flags} -Ivariants/eink0.1
-DBUSY_PIN=3 -DRST_PIN=2 -DDC_PIN=28 -DCS_PIN=30
src_filter = ${nrf52_base.src_filter} +<../variants/eink0.1>
lib_deps =
${arduino_base.lib_deps}
${nrf52840_base.lib_deps}
https://github.com/geeksville/EPD_Libraries.git
TFT_eSPI
; The https://github.com/BigCorvus/SX1262-LoRa-BLE-Relay board by @BigCorvus
[env:lora-relay-v1]
extends = nrf52_base
extends = nrf52840_base
board = lora-relay-v1
# add our variants files to the include and src paths
# define build flags for the TFT_eSPI library
@ -365,13 +385,13 @@ build_flags = ${nrf52_base.build_flags} -Ivariants/lora_relay_v1
-DSPI_FREQUENCY=27000000
src_filter = ${nrf52_base.src_filter} +<../variants/lora_relay_v1>
lib_deps =
${arduino_base.lib_deps}
${nrf52840_base.lib_deps}
SparkFun BQ27441 LiPo Fuel Gauge Arduino Library
TFT_eSPI
; The https://github.com/BigCorvus/LoRa-BLE-Relay-v2 board by @BigCorvus
[env:lora-relay-v2]
extends = nrf52_base
extends = nrf52840_base
board = lora-relay-v2
# add our variants files to the include and src paths
# define build flags for the TFT_eSPI library
@ -389,7 +409,7 @@ build_flags = ${nrf52_base.build_flags} -Ivariants/lora_relay_v2
-DTFT_SCLK=ST7735_SCK
src_filter = ${nrf52_base.src_filter} +<../variants/lora_relay_v2>
lib_deps =
${arduino_base.lib_deps}
${nrf52840_base.lib_deps}
SparkFun BQ27441 LiPo Fuel Gauge Arduino Library
TFT_eSPI

View File

@ -0,0 +1,77 @@
/*
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
Copyright (c) 2016 Sandeep Mistry All right reserved.
Copyright (c) 2018, Adafruit Industries (adafruit.com)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "variant.h"
#include "wiring_constants.h"
#include "wiring_digital.h"
#include "nrf.h"
const uint32_t g_ADigitalPinMap[] = {
// D0 - D7
0, // xtal 1
1, // xtal 2
2, // a0
3, // a1
4, // a2
5, // a3
6, // TXD
7, // GPIO #7
// D8 - D13
8, // RXD
9, // NFC1
10, // NFC2
11, // GPIO11
12, // SCK
13, // MOSI
14, // MISO
15, // GPIO #15
16, // GPIO #16
// function set pins
17, // LED #1 (red)
18, // SWO
19, // LED #2 (blue)
20, // DFU
21, // Reset
22, // Factory Reset
23, // N/A
24, // N/A
25, // SDA
26, // SCL
27, // GPIO #27
28, // A4
29, // A5
30, // A6
31, // A7
};
void initVariant()
{
// LED1 & LED2
pinMode(PIN_LED1, OUTPUT);
ledOff(PIN_LED1);
pinMode(PIN_LED2, OUTPUT);
ledOff(PIN_LED2);
}

View File

@ -0,0 +1,126 @@
/*
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
Copyright (c) 2016 Sandeep Mistry All right reserved.
Copyright (c) 2018, Adafruit Industries (adafruit.com)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _VARIANT_RAK4600_
#define _VARIANT_RAK4600_
#define RAK4600
/** Master clock frequency */
#define VARIANT_MCK (64000000ul)
#define USE_LFXO // Board uses 32khz crystal for LF
// define USE_LFRC // Board uses RC for LF
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "WVariant.h"
#ifdef __cplusplus
extern "C"
{
#endif // __cplusplus
// Number of pins defined in PinDescription array
#define PINS_COUNT (32u)
#define NUM_DIGITAL_PINS (32u)
#define NUM_ANALOG_INPUTS (8u)
#define NUM_ANALOG_OUTPUTS (0u)
// LEDs
#define PIN_LED1 (17)
#define PIN_LED2 (19)
#define LED_BUILTIN PIN_LED1
#define LED_CONN PIN_LED2
#define LED_RED PIN_LED1
#define LED_BLUE PIN_LED2
#define LED_STATE_ON 1 // State when LED is litted
/*
* Analog pins
*/
#define PIN_A0 (2)
#define PIN_A1 (3)
#define PIN_A2 (4)
#define PIN_A3 (5)
#define PIN_A4 (28)
#define PIN_A5 (29)
#define PIN_A6 (30)
#define PIN_A7 (31)
static const uint8_t A0 = PIN_A0;
static const uint8_t A1 = PIN_A1;
static const uint8_t A2 = PIN_A2;
static const uint8_t A3 = PIN_A3;
static const uint8_t A4 = PIN_A4;
static const uint8_t A5 = PIN_A5;
static const uint8_t A6 = PIN_A6;
static const uint8_t A7 = PIN_A7;
#define ADC_RESOLUTION 14
// Other pins
#define PIN_AREF (24)
#define PIN_VBAT PIN_A7
#define PIN_NFC1 (9)
#define PIN_NFC2 (10)
static const uint8_t AREF = PIN_AREF;
/*
* Serial interfaces
*/
// Serial
#define PIN_SERIAL_RX (22)
#define PIN_SERIAL_TX (23)
/*
* SPI Interfaces
*/
#define SPI_INTERFACES_COUNT 1
#define PIN_SPI_MISO (6)
#define PIN_SPI_MOSI (5)
#define PIN_SPI_SCK (7)
static const uint8_t SS = 4;
static const uint8_t MOSI = PIN_SPI_MOSI;
static const uint8_t MISO = PIN_SPI_MISO;
static const uint8_t SCK = PIN_SPI_SCK;
/*
* Wire Interfaces
*/
#define WIRE_INTERFACES_COUNT 1
#define PIN_WIRE_SDA (13u)
#define PIN_WIRE_SCL (12u)
#ifdef __cplusplus
}
#endif
/*----------------------------------------------------------------------------
* Arduino objects - C++ only
*----------------------------------------------------------------------------*/
#endif

View File

@ -171,6 +171,9 @@ static const uint8_t SCK = PIN_SPI_SCK;
#define GPS_RX_PIN PIN_SERIAL1_RX
#define GPS_TX_PIN PIN_SERIAL1_TX
// The battery sense is hooked to pin A0
#define BATTERY_PIN PIN_A0
#ifdef __cplusplus
}
#endif

View File

@ -1,4 +1,4 @@
[VERSION]
major = 1
minor = 2
build = 26
build = 28