WIP RAK815 support

This commit is contained in:
geeksville
2020-07-10 11:02:29 -07:00
parent 5b11c1ca86
commit b00a936f41
12 changed files with 8078 additions and 25 deletions

55
boards/rak815.json Normal file
View File

@@ -0,0 +1,55 @@
{
"build": {
"arduino":{
"ldscript": "nrf52832_s132_v6.ld"
},
"core": "nRF5",
"cpu": "cortex-m4",
"extra_flags": "-DNRF52832_XXAA -DNRF52",
"f_cpu": "64000000L",
"hwids": [
[
"0x10c4",
"0xea60"
]
],
"usb_product": "RAK815",
"mcu": "nrf52832",
"variant": "rak815",
"bsp": {
"name": "adafruit"
},
"softdevice": {
"sd_flags": "-DS132",
"sd_name": "s132",
"sd_version": "6.1.1",
"sd_fwid": "0x00B7"
}
},
"connectivity": [
"bluetooth"
],
"debug": {
"jlink_device": "nRF52832_xxAA",
"svd_path": "nrf52.svd"
},
"frameworks": [
"arduino"
],
"name": "RAK RAK815",
"upload": {
"maximum_ram_size": 65536,
"maximum_size": 524288,
"require_upload_port": true,
"speed": 115200,
"protocol": "nrfutil",
"protocols": [
"jlink",
"nrfjprog",
"nrfutil",
"stlink"
]
},
"url": "https://store.rakwireless.com/products/rak815-hybrid-location-tracker",
"vendor": "RAK"
}

View File

Binary file not shown.

View File

File diff suppressed because one or more lines are too long

View File

Binary file not shown.

View File

File diff suppressed because one or more lines are too long

View File

@@ -31,6 +31,10 @@ Applying system reset.
Run.
```
### Appload
tips on installing https://github.com/platformio/platform-nordicnrf52/issues/8#issuecomment-374017768
## Misc work items
RAM investigation.

View File

@@ -9,7 +9,7 @@
; https://docs.platformio.org/page/projectconf.html
[platformio]
default_envs = feather_nrf52832 ; Note: the github actions CI test build can't yet build NRF52 targets
default_envs = rak815 ; Note: the github actions CI test build can't yet build NRF52 targets
[common]
; common is not currently used
@@ -183,6 +183,12 @@ board = nrf52840_dk_modified
extends = nrf52_base
board = adafruit_feather_nrf52832
[env:rak815]
extends = nrf52_base
board = rak815
; hack to force TINYUSB to be disabled - something is wrong in the adafruilt dependencies
; build_flags = ${nrf52_base.build_flags}-UUSE_TINYUSB
# For experimenting with RAM sizes
# board_build.ldscript = linker/nrf52840_s140_sim832.ld

View File

@@ -113,10 +113,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// LoRa SPI
// -----------------------------------------------------------------------------
#define SCK_GPIO 5
#define MISO_GPIO 19
#define MOSI_GPIO 27
#define NSS_GPIO 18
#define RF95_SCK 5
#define RF95_MISO 19
#define RF95_MOSI 27
#define RF95_NSS 18
#endif

View File

@@ -296,7 +296,7 @@ void setup()
SPI.begin();
#else
// ESP32
SPI.begin(SCK_GPIO, MISO_GPIO, MOSI_GPIO, NSS_GPIO);
SPI.begin(RF95_SCK, RF95_MISO, RF95_MOSI, RF95_NSS);
SPI.setFrequency(4000000);
#endif

View File

@@ -128,25 +128,7 @@ static const uint8_t SCK = PIN_SPI_SCK;
#define PIN_WIRE_SDA (32 + 2)
#define PIN_WIRE_SCL (32)
// CUSTOM GPIOs the SX1262
#define SX1262_CS (10)
#define SX1262_DIO1 (20)
#define SX1262_DIO2 (26)
#define SX1262_BUSY (31) // Supposed to be P0.18 but because of reworks, now on P0.31 (18)
#define SX1262_RESET (17)
// #define SX1262_ANT_SW (32 + 10)
#define SX1262_RXEN (22)
#define SX1262_TXEN (24)
#define SX1262_E22 // Indicates this SX1262 is inside of an ebyte E22 module and special config should be done for that
// ERC12864-10 LCD
#define ERC12864_CS (32 + 4)
#define ERC12864_RESET (32 + 6)
#define ERC12864_CD (32 + 9)
// L80 GPS
#define L80_PPS (28)
#define L80_RESET (29)
#define GPS_I2C_ADDR FIXME
#ifdef __cplusplus
}

View File

@@ -0,0 +1,81 @@
/*
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);
}

127
variants/rak815/variant.h Normal file
View File

@@ -0,0 +1,127 @@
/*
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_RAK815_
#define _VARIANT_RAK815_
/** 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 (25)
#define PIN_LED2 (26)
#define LED_BUILTIN PIN_LED1
#define LED_CONN PIN_LED2
//#define LED_RED PIN_LED1
//#define LED_BLUE PIN_LED2
#define LED_STATE_ON 0 // 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
*/
#define PIN_SERIAL_RX (28)
#define PIN_SERIAL_TX (29)
/*
* SPI Interfaces
*/
#define SPI_INTERFACES_COUNT 1
/*
* This is the interal SPI bus for the RAK813 module - goes to the lora chip
*/
#define PIN_SPI_MISO (12)
#define PIN_SPI_MOSI (13)
#define PIN_SPI_SCK (11)
static const uint8_t SS = 14 ;
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 (15u)
#define PIN_WIRE_SCL (16u)
#ifdef __cplusplus
}
#endif
/*----------------------------------------------------------------------------
* Arduino objects - C++ only
*----------------------------------------------------------------------------*/
#endif