Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions variants/nrf52840/diy/easy-nrf52-promicro_e22/platformio.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
; DIY no custom PCB, easy construction node based on Pro Micro Supermini NRF52840 Development Board + E22 900M30S
[env:easy-pro_micro_nrf_e22]
extends = nrf52840_base
board = promicro-nrf52840
build_flags = ${nrf52840_base.build_flags}
-I variants/nrf52840/diy/easy-nrf52-promicro_e22
-D PRIVATE_HW
build_src_filter = ${nrf52_base.build_src_filter} +<../variants//nrf52840/diy/easy-nrf52-promicro_e22>
lib_deps =
${nrf52840_base.lib_deps}
debug_tool = jlink
40 changes: 40 additions & 0 deletions variants/nrf52840/diy/easy-nrf52-promicro_e22/variant.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
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 "nrf.h"
#include "wiring_constants.h"
#include "wiring_digital.h"

const uint32_t g_ADigitalPinMap[] = {
// P0
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,

// P1
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47};

#ifdef PIN_3V3_EN
void initVariant()
{
// 3V3 Power Rail
pinMode(PIN_3V3_EN, OUTPUT);
digitalWrite(PIN_3V3_EN, HIGH);
}
#endif
186 changes: 186 additions & 0 deletions variants/nrf52840/diy/easy-nrf52-promicro_e22/variant.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
/*
A DIY, easy, no PCB, basic but powerful node based on E22 900M33S and
Pro Micro compatible NRF52840 dev boards such as the Tenstar Robot
Supermini or Nice Nano.

Without adding GPS or other peripherals, this node should run about 45
hours on a 1S 1000 mAh battery.

This node can be constructed by directly soldering the development
board directly to an EBYTE E22 900m30S. There will be 7 directly
soldered pads, 3 header pins, and only 1 wire connection required.

You can power the node via USB or a battery, or you can install a power
connector on the GND and VCC pads of the E22; a JST PH or XH socket
should fit. It may be easiest to install this first if you want it.

Note that the E22-900M33S will output near it's specified power level
only when supplied with 5-5.5 volts. If you take advantage of the
battery charger on the Pro Micro board and power everything from a 1S
Lithium battery, the E22-900M33S will output a maximum of about 1
Watt.

Be sure to perform the initial flash of the Meshtastic firmware before
proceeding with the assembly to protect the E22 and ensure that the
TXEN pad is not driven when it shouldn't be.

Detailed build instructions can be found here:
https://github.com/brad112358/easy_E22?tab=readme-ov-file#easy-diy-e22-nrf52840-build-instructions

*/

#ifndef _VARIANT_EASY_PROMICRO_DIY_
#define _VARIANT_EASY_PROMICRO_DIY_

/** Master clock frequency */
#define VARIANT_MCK (64000000ul)

// #define USE_LFXO // Board uses 32khz crystal for LF
#define USE_LFRC // Board uses RC for LF

#define PROMICRO_DIY_TCXO

/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/

#include "WVariant.h"

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus

/*
E22/NRF52 PRO MICRO PIN ASSIGNMENT

| Pin   | Function   |   | Pin     | Function     |
| ----- | ----------- | --- | -------- | ------------ |
| Gnd   |             |   | vbat     |             |
| P0.06 | Button opt |   | vbat     |             |
| P0.08 | Buzzer opt |   | Gnd     |             |
| Gnd   |             |   | reset   |             |
| Gnd   | GND         |   | ext_vcc | *see 0.13   |
| P0.17 | Serial2 TX |   | P0.31   | BATTERY_PIN |
| P0.20 | Rotary B   |   | P0.29   | DI01         |
| P0.22 | Rotary A   |   | P0.02   | BUSY         |
| P0.24 | Rotary press|   | P1.15   | NRST         |
| P1.00 | TXEN        |   | P1.13   | MISO         |
| P0.11 | RXEN        |   | P1.11   | MOSI         |
| P1.04 | SDA         |   | P0.10   | SCK         |
| P1.06 | SCL         |   | P0.09   | NSS         |
|       |             |   |         |             |
|       | Mid board   |   |         | Internal     |
| P1.01 | Serial2 RX |   | 0.15     | LED         |
| P1.02 | GPS_TX     |   | 0.13     | 3V3_EN       |
| P1.07 | GPS_RX     |   |         |             |
*/

// Number of pins defined in PinDescription array
#define PINS_COUNT (48)
#define NUM_DIGITAL_PINS (48)
#define NUM_ANALOG_INPUTS (1)
#define NUM_ANALOG_OUTPUTS (0)

// Pin 13 enables 3.3V periphery.
// #define PIN_3V3_EN (0 + 13) // P0.13

// Battery
#define BATTERY_PIN (0 + 31) // P0.31
#define USE_VDDHDIV5 // Fallback to allow grounding BATTERY_PIN instead of installing voltage divider resistors
#define BATTERY_SENSE_RESOLUTION_BITS 12
#define ADC_MULTIPLIER (2.02) // 2 + adjustment for current drain of input
#define AREF_VOLTAGE 3.0
#define VBAT_AR_INTERNAL AR_INTERNAL_3_0

#define HAS_SCREEN 1
#define USE_SSD1306
// #define USE_SH1106

// WIRE IC AND IIC PINS
#define WIRE_INTERFACES_COUNT 1

#define PIN_WIRE_SDA (32 + 4) // P1.04
#define PIN_WIRE_SCL (32 + 6) // P1.06

// Buzzer - PWM
#define PIN_BUZZER (0 + 8) // p0.08

// LED
#define PIN_LED1 (0 + 15) // P0.15
// Actually red
#define LED_BLUE PIN_LED1
#define LED_STATE_ON 1 // State when LED is lit

// Button
#define BUTTON_PIN (0 + 6) // P0.06

// GPS
#define GPS_TX_PIN (32 + 2) // P1.02
#define GPS_RX_PIN (32 + 7) // P1.07

#define PIN_GPS_EN (0 + 13) // P0.13 3.3V enable
#define GPS_POWER_TOGGLE
#define GPS_UBLOX
// define GPS_DEBUG

// UART interfaces
#define PIN_SERIAL1_TX GPS_TX_PIN
#define PIN_SERIAL1_RX GPS_RX_PIN

#define PIN_SERIAL2_RX (32 + 1) // P1.01
#define PIN_SERIAL2_TX (0 + 17) // P0.17

// Serial interfaces
#define SPI_INTERFACES_COUNT 1

#define PIN_SPI_MISO (32 + 13) // P1.13
#define PIN_SPI_MOSI (32 + 11) // P1.11
#define PIN_SPI_SCK (0 + 10) // P0.10

#define LORA_MISO PIN_SPI_MISO
#define LORA_MOSI PIN_SPI_MOSI
#define LORA_SCK PIN_SPI_SCK
#define LORA_CS (0 + 9) // P0.09 NSS

// LORA MODULE
#define USE_SX1262

#define LORA_DIO0 (0 + 2) // P0.02 BUSY
#define LORA_DIO1 (0 + 29) // P0.29 IRQ
#define LORA_RESET (32 + 15) // P1.15 NRST

// SX126X CONFIG
#undef TX_GAIN_LORA
#define TX_GAIN_LORA 22 // 8 for E22 900M30S, 25 for 900M33S, 22 for 3.7V battery powered 900M33S, 0 for 900M22S
#define SX126X_MAX_POWER 8 // 8 for 900M33S, 22 for 900M30S and 900M22S; defaults to 22 if not defined

#define SX126X_CS LORA_CS
#define SX126X_DIO1 LORA_DIO1
#define SX126X_BUSY LORA_DIO0
#define SX126X_RESET LORA_RESET
#define SX126X_RXEN (0 + 11) // P0.11
#define SX126X_TXEN (32 + 0) // P1.00

/*
| Mfr | Module | TCXO | RF Switch | Notes |
| ------------ | ---------------- | ---- | --------- | ------------------------------------- |
| Ebyte | E22-900M22S | Yes | Ext | |
| Ebyte | E22-900M30S | Yes | Ext | |
| Ebyte | E22-900M33S | Yes | Ext | MAX_POWER must be set to 8 for this! |

On the SX1262, DIO3 sets the voltage for an external TCXO, if one is present. If one is not present, use TCXO_OPTIONAL to try both
settings.
*/

#define SX126X_DIO3_TCXO_VOLTAGE 1.8
#define TCXO_OPTIONAL // make it so that the firmware can try both TCXO and XTAL

#ifdef __cplusplus
}
#endif

/*----------------------------------------------------------------------------
* Arduino objects - C++ only
*----------------------------------------------------------------------------*/

#endif
Loading