Skip to content

Commit a507007

Browse files
committed
equalize RAK with all other nrf52 variants and use newer platform with all important fixes
1 parent f085a9d commit a507007

File tree

5 files changed

+295
-4
lines changed

5 files changed

+295
-4
lines changed

boards/rak4631.json

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
"build": {
3+
"arduino": {
4+
"ldscript": "nrf52840_s140_v6.ld"
5+
},
6+
"core": "nRF5",
7+
"cpu": "cortex-m4",
8+
"extra_flags": "-DARDUINO_NRF52840_FEATHER -DNRF52840_XXAA",
9+
"f_cpu": "64000000L",
10+
"hwids": [
11+
[
12+
"0x239A",
13+
"0x8029"
14+
],
15+
[
16+
"0x239A",
17+
"0x0029"
18+
],
19+
[
20+
"0x239A",
21+
"0x002A"
22+
],
23+
[
24+
"0x239A",
25+
"0x802A"
26+
]
27+
],
28+
"usb_product": "WisCore RAK4631 Board",
29+
"mcu": "nrf52840",
30+
"variant": "WisCore_RAK4631_Board",
31+
"bsp": {
32+
"name": "adafruit"
33+
},
34+
"softdevice": {
35+
"sd_flags": "-DS140",
36+
"sd_name": "s140",
37+
"sd_version": "6.1.1",
38+
"sd_fwid": "0x00B6"
39+
},
40+
"bootloader": {
41+
"settings_addr": "0xFF000"
42+
}
43+
},
44+
"connectivity": [
45+
"bluetooth"
46+
],
47+
"debug": {
48+
"jlink_device": "nRF52840_xxAA",
49+
"svd_path": "nrf52840.svd"
50+
},
51+
"frameworks": [
52+
"arduino"
53+
],
54+
"name": "WisCore RAK4631 Board",
55+
"upload": {
56+
"maximum_ram_size": 248832,
57+
"maximum_size": 815104,
58+
"speed": 115200,
59+
"protocol": "nrfutil",
60+
"protocols": [
61+
"jlink",
62+
"nrfjprog",
63+
"nrfutil",
64+
"stlink"
65+
],
66+
"use_1200bps_touch": true,
67+
"require_upload_port": true,
68+
"wait_for_upload_port": true
69+
},
70+
"url": "https://www.rakwireless.com",
71+
"vendor": "RAKwireless"
72+
}

variants/rak4631/platformio.ini

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[rak4631]
22
extends = nrf52_base
3-
platform = https://github.com/maxgerhardt/platform-nordicnrf52.git#rak
4-
board = wiscore_rak4631
3+
board = rak4631
54
board_check = true
65
build_flags = ${nrf52_base.build_flags}
76
${sensor_base.build_flags}

variants/rak4631/variant.cpp

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
3+
Copyright (c) 2016 Sandeep Mistry All right reserved.
4+
Copyright (c) 2018, Adafruit Industries (adafruit.com)
5+
6+
This library is free software; you can redistribute it and/or
7+
modify it under the terms of the GNU Lesser General Public
8+
License as published by the Free Software Foundation; either
9+
version 2.1 of the License, or (at your option) any later version.
10+
11+
This library is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14+
See the GNU Lesser General Public License for more details.
15+
16+
You should have received a copy of the GNU Lesser General Public
17+
License along with this library; if not, write to the Free Software
18+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19+
*/
20+
21+
#include "variant.h"
22+
#include "wiring_constants.h"
23+
#include "wiring_digital.h"
24+
#include "nrf.h"
25+
26+
const uint32_t g_ADigitalPinMap[] =
27+
{
28+
// P0
29+
0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 ,
30+
8 , 9 , 10, 11, 12, 13, 14, 15,
31+
16, 17, 18, 19, 20, 21, 22, 23,
32+
24, 25, 26, 27, 28, 29, 30, 31,
33+
34+
// P1
35+
32, 33, 34, 35, 36, 37, 38, 39,
36+
40, 41, 42, 43, 44, 45, 46, 47
37+
};
38+
39+
40+
void initVariant()
41+
{
42+
// LED1 & LED2
43+
pinMode(PIN_LED1, OUTPUT);
44+
ledOff(PIN_LED1);
45+
46+
pinMode(PIN_LED2, OUTPUT);
47+
ledOff(PIN_LED2);;
48+
}
49+

variants/rak4631/variant.h

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
/*
2+
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
3+
Copyright (c) 2016 Sandeep Mistry All right reserved.
4+
Copyright (c) 2018, Adafruit Industries (adafruit.com)
5+
6+
This library is free software; you can redistribute it and/or
7+
modify it under the terms of the GNU Lesser General Public
8+
License as published by the Free Software Foundation; either
9+
version 2.1 of the License, or (at your option) any later version.
10+
This library is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13+
See the GNU Lesser General Public License for more details.
14+
You should have received a copy of the GNU Lesser General Public
15+
License along with this library; if not, write to the Free Software
16+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17+
*/
18+
19+
#ifndef _VARIANT_RAK4630_
20+
#define _VARIANT_RAK4630_
21+
22+
#define RAK4630
23+
24+
/** Master clock frequency */
25+
#define VARIANT_MCK (64000000ul)
26+
27+
#define USE_LFXO // Board uses 32khz crystal for LF
28+
// define USE_LFRC // Board uses RC for LF
29+
30+
/*----------------------------------------------------------------------------
31+
* Headers
32+
*----------------------------------------------------------------------------*/
33+
34+
#include "WVariant.h"
35+
36+
#ifdef __cplusplus
37+
extern "C"
38+
{
39+
#endif // __cplusplus
40+
41+
/*
42+
* WisBlock Base GPIO definitions
43+
*/
44+
static const uint8_t WB_IO1 = 17; // SLOT_A SLOT_B
45+
static const uint8_t WB_IO2 = 34; // SLOT_A SLOT_B
46+
static const uint8_t WB_IO3 = 21; // SLOT_C
47+
static const uint8_t WB_IO4 = 4; // SLOT_C
48+
static const uint8_t WB_IO5 = 9; // SLOT_D
49+
static const uint8_t WB_IO6 = 10; // SLOT_D
50+
static const uint8_t WB_SW1 = 33; // IO_SLOT
51+
static const uint8_t WB_A0 = 5; // IO_SLOT
52+
static const uint8_t WB_A1 = 31; // IO_SLOT
53+
static const uint8_t WB_I2C1_SDA = 13; // SENSOR_SLOT IO_SLOT
54+
static const uint8_t WB_I2C1_SCL = 14; // SENSOR_SLOT IO_SLOT
55+
static const uint8_t WB_I2C2_SDA = 24; // IO_SLOT
56+
static const uint8_t WB_I2C2_SCL = 25; // IO_SLOT
57+
static const uint8_t WB_SPI_CS = 26; // IO_SLOT
58+
static const uint8_t WB_SPI_CLK = 3; // IO_SLOT
59+
static const uint8_t WB_SPI_MISO = 29; // IO_SLOT
60+
static const uint8_t WB_SPI_MOSI = 30; // IO_SLOT
61+
62+
// Number of pins defined in PinDescription array
63+
#define PINS_COUNT (48)
64+
#define NUM_DIGITAL_PINS (48)
65+
#define NUM_ANALOG_INPUTS (6)
66+
#define NUM_ANALOG_OUTPUTS (0)
67+
68+
// LEDs
69+
#define PIN_LED1 (35)
70+
#define PIN_LED2 (36)
71+
72+
#define LED_BUILTIN PIN_LED1
73+
#define LED_CONN PIN_LED2
74+
75+
#define LED_GREEN PIN_LED1
76+
#define LED_BLUE PIN_LED2
77+
78+
#define LED_STATE_ON 1 // State when LED is litted
79+
80+
/*
81+
* Buttons
82+
*/
83+
// RAK4631 has no buttons
84+
85+
/*
86+
* Analog pins
87+
*/
88+
#define PIN_A0 (5) //(3)
89+
#define PIN_A1 (31) //(4)
90+
#define PIN_A2 (28)
91+
#define PIN_A3 (29)
92+
#define PIN_A4 (30)
93+
#define PIN_A5 (31)
94+
#define PIN_A6 (0xff)
95+
#define PIN_A7 (0xff)
96+
97+
static const uint8_t A0 = PIN_A0;
98+
static const uint8_t A1 = PIN_A1;
99+
static const uint8_t A2 = PIN_A2;
100+
static const uint8_t A3 = PIN_A3;
101+
static const uint8_t A4 = PIN_A4;
102+
static const uint8_t A5 = PIN_A5;
103+
static const uint8_t A6 = PIN_A6;
104+
static const uint8_t A7 = PIN_A7;
105+
#define ADC_RESOLUTION 14
106+
107+
// Other pins
108+
#define PIN_AREF (2)
109+
#define PIN_NFC1 (9)
110+
#define PIN_NFC2 (10)
111+
112+
static const uint8_t AREF = PIN_AREF;
113+
114+
/*
115+
* Serial interfaces
116+
*/
117+
// TXD1 RXD1 on Base Board
118+
#define PIN_SERIAL1_RX (15)
119+
#define PIN_SERIAL1_TX (16)
120+
121+
// TXD0 RXD0 on Base Board
122+
#define PIN_SERIAL2_RX (19)
123+
#define PIN_SERIAL2_TX (20)
124+
125+
/*
126+
* SPI Interfaces
127+
*/
128+
#define SPI_INTERFACES_COUNT 1
129+
130+
#define PIN_SPI_MISO (29)
131+
#define PIN_SPI_MOSI (30)
132+
#define PIN_SPI_SCK (3)
133+
134+
static const uint8_t SS = 26;
135+
static const uint8_t MOSI = PIN_SPI_MOSI;
136+
static const uint8_t MISO = PIN_SPI_MISO;
137+
static const uint8_t SCK = PIN_SPI_SCK;
138+
139+
/*
140+
* Wire Interfaces
141+
*/
142+
#define WIRE_INTERFACES_COUNT 2
143+
144+
#define PIN_WIRE_SDA (13)
145+
#define PIN_WIRE_SCL (14)
146+
147+
#define PIN_WIRE1_SDA (24)
148+
#define PIN_WIRE1_SCL (25)
149+
150+
// QSPI Pins
151+
// QSPI occupied by GPIO's
152+
#define PIN_QSPI_SCK 3 // 19
153+
#define PIN_QSPI_CS 26 // 17
154+
#define PIN_QSPI_IO0 30 // 20
155+
#define PIN_QSPI_IO1 29 // 21
156+
#define PIN_QSPI_IO2 28 // 22
157+
#define PIN_QSPI_IO3 2 // 23
158+
159+
// On-board QSPI Flash
160+
// No onboard flash
161+
#define EXTERNAL_FLASH_DEVICES IS25LP080D
162+
#define EXTERNAL_FLASH_USE_QSPI
163+
164+
#ifdef __cplusplus
165+
}
166+
#endif
167+
168+
/*----------------------------------------------------------------------------
169+
* Arduino objects - C++ only
170+
*----------------------------------------------------------------------------*/
171+
172+
#endif

variants/rak_wismesh_tag/platformio.ini

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[rak_wismesh_tag]
22
extends = nrf52_base
3-
platform = https://github.com/maxgerhardt/platform-nordicnrf52.git#rak
4-
board = wiscore_rak4631
3+
board = rak4631
54
board_check = true
65
build_flags = ${nrf52_base.build_flags}
76
${sensor_base.build_flags}

0 commit comments

Comments
 (0)