mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-03-30 19:15:49 +00:00
38
boards/nrf52840_s140_v7.ld
Normal file
38
boards/nrf52840_s140_v7.ld
Normal file
@@ -0,0 +1,38 @@
|
||||
/* Linker script to configure memory regions. */
|
||||
|
||||
SEARCH_DIR(.)
|
||||
GROUP(-lgcc -lc -lnosys)
|
||||
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x27000, LENGTH = 0xED000 - 0x27000
|
||||
|
||||
/* SRAM required by Softdevice depend on
|
||||
* - Attribute Table Size (Number of Services and Characteristics)
|
||||
* - Vendor UUID count
|
||||
* - Max ATT MTU
|
||||
* - Concurrent connection peripheral + central + secure links
|
||||
* - Event Len, HVN queue, Write CMD queue
|
||||
*/
|
||||
RAM (rwx) : ORIGIN = 0x20006000, LENGTH = 0x20040000 - 0x20006000
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
INCLUDE "nrf52_common.ld"
|
||||
58
boards/tracker-t1000-e.json
Normal file
58
boards/tracker-t1000-e.json
Normal file
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino": {
|
||||
"ldscript": "nrf52840_s140_v7.ld"
|
||||
},
|
||||
"core": "nRF5",
|
||||
"cpu": "cortex-m4",
|
||||
"extra_flags": "-DARDUINO_WIO_WM1110 -DNRF52840_XXAA",
|
||||
"f_cpu": "64000000L",
|
||||
"hwids": [
|
||||
["0x239A", "0x8029"],
|
||||
["0x239A", "0x0029"],
|
||||
["0x239A", "0x002A"],
|
||||
["0x239A", "0x802A"]
|
||||
],
|
||||
"usb_product": "T1000-E-BOOT",
|
||||
"mcu": "nrf52840",
|
||||
"variant": "Seeed_T1000-E",
|
||||
"bsp": {
|
||||
"name": "adafruit"
|
||||
},
|
||||
"softdevice": {
|
||||
"sd_flags": "-DS140",
|
||||
"sd_name": "s140",
|
||||
"sd_version": "7.3.0",
|
||||
"sd_fwid": "0x0123"
|
||||
},
|
||||
"bootloader": {
|
||||
"settings_addr": "0xFF000"
|
||||
}
|
||||
},
|
||||
"connectivity": ["bluetooth"],
|
||||
"debug": {
|
||||
"jlink_device": "nRF52840_xxAA",
|
||||
"svd_path": "nrf52840.svd"
|
||||
},
|
||||
"frameworks": ["arduino"],
|
||||
"name": "Seeed T1000-E",
|
||||
"upload": {
|
||||
"maximum_ram_size": 248832,
|
||||
"maximum_size": 815104,
|
||||
"speed": 115200,
|
||||
"protocol": "nrfutil",
|
||||
"protocols": [
|
||||
"jlink",
|
||||
"nrfjprog",
|
||||
"nrfutil",
|
||||
"stlink",
|
||||
"cmsis-dap",
|
||||
"blackmagic"
|
||||
],
|
||||
"use_1200bps_touch": true,
|
||||
"require_upload_port": true,
|
||||
"wait_for_upload_port": true
|
||||
},
|
||||
"url": "https://www.seeedstudio.com/SenseCAP-Card-Tracker-T1000-E-for-Meshtastic-p-5913.html",
|
||||
"vendor": "Seeed Studio"
|
||||
}
|
||||
@@ -475,3 +475,48 @@ build_src_filter = ${rak4631.build_src_filter} +<helpers/nrf52/*.cpp> +<../examp
|
||||
lib_deps =
|
||||
${rak4631.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
|
||||
; ----------------- NRF52 T1000e---------------------
|
||||
[nrf52840_t1000e]
|
||||
extends = nrf52_base
|
||||
platform_packages = framework-arduinoadafruitnrf52
|
||||
build_flags = ${nrf52_base.build_flags}
|
||||
-I src/helpers/nrf52
|
||||
lib_ignore =
|
||||
BluetoothOTA
|
||||
lvgl
|
||||
lib5b4
|
||||
lib_deps =
|
||||
${nrf52_base.lib_deps}
|
||||
rweather/Crypto @ ^0.4.0
|
||||
|
||||
[t1000-e]
|
||||
extends = nrf52840_t1000e
|
||||
board = tracker-t1000-e
|
||||
board_build.ldscript = boards/nrf52840_s140_v7.ld
|
||||
build_flags = ${nrf52840_t1000e.build_flags}
|
||||
-Ivariants/t1000-e
|
||||
-DT1000_E
|
||||
-D RADIO_CLASS=CustomLR1110
|
||||
-D WRAPPER_CLASS=CustomLR1110Wrapper
|
||||
build_src_filter = ${nrf52840_t1000e.build_src_filter}
|
||||
+<helpers/*.cpp>
|
||||
+<helpers/nrf52/T1000eBoard.cpp>
|
||||
+<../variants/t1000-e>
|
||||
debug_tool = jlink
|
||||
upload_protocol = nrfutil
|
||||
|
||||
[env:t1000e_companion_radio_ble]
|
||||
extends = t1000-e
|
||||
build_flags = ${t1000-e.build_flags}
|
||||
-D MAX_CONTACTS=100
|
||||
-D MAX_GROUP_CHANNELS=1
|
||||
-D BLE_PIN_CODE=123456
|
||||
-D BLE_DEBUG_LOGGING=1
|
||||
-D MESH_PACKET_LOGGING=1
|
||||
-D MESH_DEBUG=1
|
||||
build_src_filter = ${t1000-e.build_src_filter}
|
||||
+<helpers/nrf52/SerialBLEInterface.cpp>
|
||||
+<../examples/companion_radio/*.cpp>
|
||||
lib_deps = ${t1000-e.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
#include <Arduino.h>
|
||||
#include "T1000eBoard.h"
|
||||
|
||||
#include <bluefruit.h>
|
||||
#include <Wire.h>
|
||||
|
||||
void T1000eBoard::begin() {
|
||||
#include <bluefruit.h>
|
||||
|
||||
void T1000eBoard::begin()
|
||||
{
|
||||
// for future use, sub-classes SHOULD call this from their begin()
|
||||
startup_reason = BD_STARTUP_NORMAL;
|
||||
btn_prev_state = HIGH;
|
||||
|
||||
pinMode(BATTERY_PIN, INPUT);
|
||||
pinMode(BUTTON_PIN, INPUT);
|
||||
pinMode(LED_PIN, OUTPUT);
|
||||
|
||||
#if defined(PIN_BOARD_SDA) && defined(PIN_BOARD_SCL)
|
||||
Wire.begin(PIN_BOARD_SDA, PIN_BOARD_SCL);
|
||||
@@ -14,12 +20,7 @@ void T1000eBoard::begin() {
|
||||
Wire.begin();
|
||||
#endif
|
||||
|
||||
// pinMode(PIN_VBAT_READ, INPUT);
|
||||
|
||||
// Doesn't seem to be a pwr en pin ...
|
||||
// pinMode(LR1110_POWER_EN, OUTPUT);
|
||||
// digitalWrite(LR1110_POWER_EN, HIGH);
|
||||
delay(10); // give sx1262 some time to power up
|
||||
delay(10); // give sx1262 some time to power up
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
#include <MeshCore.h>
|
||||
#include <Arduino.h>
|
||||
|
||||
#define HAS_T1000e_POWEROFF
|
||||
|
||||
// LoRa and SPI pins
|
||||
#define P_LORA_DIO_1 (32 + 1) // P1.1
|
||||
#define P_LORA_NSS (0 + 12) // P0.12
|
||||
@@ -11,7 +13,6 @@
|
||||
#define P_LORA_SCLK (0 + 11) // P0.11
|
||||
#define P_LORA_MISO (32 + 8) // P1.8
|
||||
#define P_LORA_MOSI (32 + 9) // P0.9
|
||||
#define LR1110_POWER_EN 37
|
||||
|
||||
#define LR11X0_DIO_AS_RF_SWITCH true
|
||||
#define LR11X0_DIO3_TCXO_VOLTAGE 1.6
|
||||
@@ -23,12 +24,15 @@
|
||||
class T1000eBoard : public mesh::MainBoard {
|
||||
protected:
|
||||
uint8_t startup_reason;
|
||||
uint8_t btn_prev_state;
|
||||
|
||||
public:
|
||||
void begin();
|
||||
|
||||
uint16_t getBattMilliVolts() override {
|
||||
return 0;
|
||||
analogReadResolution(12);
|
||||
float volts = (analogRead(BATTERY_PIN) * ADC_MULTIPLIER * AREF_VOLTAGE) / 4096;
|
||||
return volts * 1000;
|
||||
}
|
||||
|
||||
uint8_t getStartupReason() const override { return startup_reason; }
|
||||
@@ -37,9 +41,41 @@ public:
|
||||
return "Seeed Tracker T1000-e";
|
||||
}
|
||||
|
||||
int buttonStateChanged() {
|
||||
uint8_t v = digitalRead(BUTTON_PIN);
|
||||
if (v != btn_prev_state) {
|
||||
btn_prev_state = v;
|
||||
return (v == LOW) ? 1 : -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void powerOff() {
|
||||
#ifdef HAS_GPS
|
||||
digitalWrite(GPS_VRTC_EN, LOW);
|
||||
digitalWrite(GPS_RESET, LOW);
|
||||
digitalWrite(GPS_SLEEP_INT, LOW);
|
||||
digitalWrite(GPS_RTC_INT, LOW);
|
||||
pinMode(GPS_RESETB, OUTPUT);
|
||||
digitalWrite(GPS_RESETB, LOW);
|
||||
#endif
|
||||
|
||||
#ifdef BUZZER_EN
|
||||
digitalWrite(BUZZER_EN, LOW);
|
||||
#endif
|
||||
|
||||
#ifdef PIN_3V3_EN
|
||||
digitalWrite(PIN_3V3_EN, LOW);
|
||||
#endif
|
||||
|
||||
digitalWrite(LED_PIN, LOW);
|
||||
nrf_gpio_cfg_sense_input(digitalPinToInterrupt(BUTTON_PIN), NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_SENSE_HIGH);
|
||||
sd_power_system_off();
|
||||
}
|
||||
|
||||
void reboot() override {
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
|
||||
// bool startOTAUpdate() override;
|
||||
};
|
||||
};
|
||||
96
variants/t1000-e/variant.cpp
Normal file
96
variants/t1000-e/variant.cpp
Normal file
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* variant.cpp
|
||||
* Copyright (C) 2023 Seeed K.K.
|
||||
* MIT License
|
||||
*/
|
||||
|
||||
#include "variant.h"
|
||||
#include "wiring_constants.h"
|
||||
#include "wiring_digital.h"
|
||||
|
||||
const uint32_t g_ADigitalPinMap[PINS_COUNT + 1] =
|
||||
{
|
||||
0, // P0.00
|
||||
1, // P0.01
|
||||
2, // P0.02, AIN0 BATTERY_PIN
|
||||
3, // P0.03
|
||||
4, // P0.04, SENSOR_EN
|
||||
5, // P0.05, EXT_PWR_DETEC
|
||||
6, // P0.06, PIN_BUTTON1
|
||||
7, // P0.07, LORA_BUSY
|
||||
8, // P0.08, GPS_VRTC_EN
|
||||
9, // P0.09
|
||||
10, // P0.10
|
||||
11, // P0.11, PIN_SPI_SCK
|
||||
12, // P0.12, PIN_SPI_NSS
|
||||
13, // P0.13, PIN_SERIAL1_TX
|
||||
14, // P0.14, PIN_SERIAL1_RX
|
||||
15, // P0.15, GPS_RTC_INT
|
||||
16, // P0.16, PIN_SERIAL2_TX
|
||||
17, // P0.17, PIN_SERIAL2_RX
|
||||
18, // P0.18
|
||||
19, // P0.19
|
||||
20, // P0.20
|
||||
21, // P0.21
|
||||
22, // P0.22
|
||||
23, // P0.23
|
||||
24, // P0.24, LED_GREEN
|
||||
25, // P0.25, BUZZER_PIN
|
||||
26, // P0.26, PIN_WIRE_SDA
|
||||
27, // P0.27, PIN_WIRE_SCL
|
||||
28, // P0.28
|
||||
29, // P0.29, AIN5, LUX_SENSOR
|
||||
30, // P0.30
|
||||
31, // P0.31, AIN7, TEMP_SENSOR
|
||||
32, // P1.00
|
||||
33, // P1.01, LORA_DIO_1
|
||||
34, // P1.02
|
||||
35, // P1.03, EXT_CHRG_DETECT
|
||||
36, // P1.04
|
||||
37, // P1.05, LR1110_EN
|
||||
38, // P1.06, 3V3_EN PWR TO SENSORS
|
||||
39, // P1.07, PIN_3V3_ACC_EN
|
||||
40, // P1.08, PIN_SPI_MISO
|
||||
41, // P1.09, PIN_SPI_MOSI
|
||||
42, // P1.10, LORA_RESET
|
||||
43, // P1.11, GPS_EN
|
||||
44, // P1.12, GPS_SLEEP_INT
|
||||
45, // P1.13
|
||||
46, // P1.14, GPS_RESETB
|
||||
47, // P1.15, PIN_GPS_RESET
|
||||
255, // NRFX_SPIM_PIN_NOT_USED
|
||||
};
|
||||
|
||||
void initVariant()
|
||||
{
|
||||
// All pins output HIGH by default.
|
||||
// https://github.com/Seeed-Studio/Adafruit_nRF52_Arduino/blob/fab7d30a997a1dfeef9d1d59bfb549adda73815a/cores/nRF5/wiring.c#L65-L69
|
||||
|
||||
pinMode(BATTERY_PIN, INPUT);
|
||||
pinMode(EXT_CHRG_DETECT, INPUT);
|
||||
pinMode(EXT_PWR_DETECT, INPUT);
|
||||
pinMode(GPS_RESETB, INPUT);
|
||||
pinMode(PIN_BUTTON1, INPUT);
|
||||
|
||||
pinMode(PIN_3V3_EN, OUTPUT);
|
||||
pinMode(PIN_3V3_ACC_EN, OUTPUT);
|
||||
pinMode(BUZZER_EN, OUTPUT);
|
||||
pinMode(SENSOR_EN, OUTPUT);
|
||||
pinMode(GPS_EN, OUTPUT);
|
||||
pinMode(GPS_RESET, OUTPUT);
|
||||
pinMode(GPS_VRTC_EN, OUTPUT);
|
||||
pinMode(GPS_SLEEP_INT, OUTPUT);
|
||||
pinMode(GPS_RTC_INT, OUTPUT);
|
||||
pinMode(LED_PIN, OUTPUT);
|
||||
|
||||
digitalWrite(PIN_3V3_EN, HIGH);
|
||||
digitalWrite(PIN_3V3_ACC_EN, LOW);
|
||||
digitalWrite(BUZZER_EN, LOW);
|
||||
digitalWrite(SENSOR_EN, LOW);
|
||||
digitalWrite(GPS_EN, LOW);
|
||||
digitalWrite(GPS_RESET, LOW);
|
||||
digitalWrite(GPS_VRTC_EN, HIGH);
|
||||
digitalWrite(GPS_SLEEP_INT, HIGH);
|
||||
digitalWrite(GPS_RTC_INT, LOW);
|
||||
digitalWrite(LED_PIN, LOW);
|
||||
}
|
||||
136
variants/t1000-e/variant.h
Normal file
136
variants/t1000-e/variant.h
Normal file
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
* variant.h
|
||||
* Copyright (C) 2023 Seeed K.K.
|
||||
* MIT License
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "WVariant.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Low frequency clock source
|
||||
|
||||
#define USE_LFXO // 32.768 kHz crystal oscillator
|
||||
#define VARIANT_MCK (64000000ul)
|
||||
// #define USE_LFRC // 32.768 kHz RC oscillator
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Power
|
||||
|
||||
#define NRF_APM // detect usb power
|
||||
#define PIN_3V3_EN (38) // P1.6 Power to Sensors
|
||||
|
||||
#define BATTERY_PIN (2) // P0.2/AIN0
|
||||
#define BATTERY_IMMUTABLE
|
||||
#define ADC_MULTIPLIER (2.0F)
|
||||
|
||||
#define EXT_CHRG_DETECT (35) // P1.3
|
||||
#define EXT_PWR_DETECT (5) // P0.5
|
||||
|
||||
#define ADC_RESOLUTION (14)
|
||||
#define BATTERY_SENSE_RES (12)
|
||||
|
||||
#define AREF_VOLTAGE (3.0)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Number of pins
|
||||
|
||||
#define PINS_COUNT (48)
|
||||
#define NUM_DIGITAL_PINS (48)
|
||||
#define NUM_ANALOG_INPUTS (6)
|
||||
#define NUM_ANALOG_OUTPUTS (0)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// UART pin definition
|
||||
|
||||
#define PIN_SERIAL1_RX (14) // P0.14
|
||||
#define PIN_SERIAL1_TX (13) // P0.13
|
||||
|
||||
#define PIN_SERIAL2_RX (17) // P0.17
|
||||
#define PIN_SERIAL2_TX (16) // P0.16
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// I2C pin definition
|
||||
|
||||
#define HAS_WIRE (1)
|
||||
#define WIRE_INTERFACES_COUNT (1)
|
||||
|
||||
#define PIN_WIRE_SDA (26) // P0.26
|
||||
#define PIN_WIRE_SCL (27) // P0.27
|
||||
#define I2C_NO_RESCAN
|
||||
#define HAS_QMA6100P
|
||||
#define QMA_6100P_INT_PIN (34) // P1.2
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// SPI pin definition
|
||||
|
||||
#define SPI_INTERFACES_COUNT (1)
|
||||
|
||||
#define PIN_SPI_MISO (40) // P1.8
|
||||
#define PIN_SPI_MOSI (41) // P1.9
|
||||
#define PIN_SPI_SCK (11) // P0.11
|
||||
#define PIN_SPI_NSS (12) // P0.12
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Builtin LEDs
|
||||
|
||||
#define LED_BUILTIN (-1)
|
||||
#define LED_BLUE (-1) // No blue led
|
||||
#define LED_GREEN (24) // P0.24
|
||||
#define LED_PIN LED_GREEN
|
||||
|
||||
#define LED_STATE_ON HIGH
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Builtin buttons
|
||||
|
||||
#define PIN_BUTTON1 (6) // P0.6
|
||||
#define BUTTON_PIN PIN_BUTTON1
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// LR1110
|
||||
|
||||
#define LORA_DIO_1 (33) // P1.1
|
||||
#define LORA_NSS (PIN_SPI_NSS) // P0.12
|
||||
#define LORA_RESET (42) // P1.10
|
||||
#define LORA_BUSY (7) // P0.7
|
||||
#define LORA_SCLK (PIN_SPI_SCK) // P0.11
|
||||
#define LORA_MISO (PIN_SPI_MISO) // P1.8
|
||||
#define LORA_MOSI (PIN_SPI_MOSI) // P0.9
|
||||
|
||||
#define LR11X0_DIO_AS_RF_SWITCH true
|
||||
#define LR11X0_DIO3_TCXO_VOLTAGE 1.6
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// GPS
|
||||
|
||||
#define HAS_GPS 1
|
||||
#define GPS_RX_PIN PIN_SERIAL1_RX
|
||||
#define GPS_TX_PIN PIN_SERIAL1_TX
|
||||
|
||||
#define GPS_EN (43) // P1.11
|
||||
#define GPS_RESET (47) // P1.15
|
||||
|
||||
#define GPS_VRTC_EN (8) // P0.8
|
||||
#define GPS_SLEEP_INT (44) // P1.12
|
||||
#define GPS_RTC_INT (15) // P0.15
|
||||
#define GPS_RESETB (46) // P1.14
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Temp+Lux Sensor
|
||||
|
||||
#define SENSOR_EN (4) // P0.4
|
||||
#define TEMP_SENSOR (31) // P0.31/AIN7
|
||||
#define LUX_SENSOR (29) // P0.29/AIN5
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Accelerometer (I2C addr : ??? )
|
||||
|
||||
#define PIN_3V3_ACC_EN (39) // P1.7
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Buzzer
|
||||
|
||||
#define BUZZER_EN (37) // P1.5
|
||||
#define BUZZER_PIN (25) // P0.25
|
||||
Reference in New Issue
Block a user