Compare commits

...

5 Commits

Author SHA1 Message Date
Thomas Göttgens 8a412e5436 Park unused LNA_CTRL_MCU net with pulldown on makerfabs_pucky 2026-05-20 21:22:05 +02:00
Thomas Göttgens 83c16d93a3 Enable LR11X0_DIO_AS_RF_SWITCH for makerfabs_pucky 2026-05-20 20:30:31 +02:00
Kongduino 449bb537c5 Update variant.h (#10405)
Added TX Power curve.
2026-05-19 08:34:54 +02:00
Jonathan Bennett 6238c32d77 Fixes 2026-05-06 11:53:34 -05:00
Jonathan Bennett 7cc404890f Initial support for Pucky 2026-04-16 11:39:48 -05:00
7 changed files with 365 additions and 1 deletions
+52
View File
@@ -0,0 +1,52 @@
{
"build": {
"arduino": {
"ldscript": "nrf52840_s140_v6.ld"
},
"core": "nRF5",
"cpu": "cortex-m4",
"extra_flags": "-DARDUINO_NRF52840_FEATHER -DNRF52840_XXAA",
"f_cpu": "64000000L",
"hwids": [
["0x239A", "0x8029"],
["0x239A", "0x0029"],
["0x239A", "0x002A"],
["0x239A", "0x802A"]
],
"usb_product": "makerfabs_pucky",
"mcu": "nrf52840",
"variant": "makerfabs_pucky",
"bsp": {
"name": "adafruit"
},
"softdevice": {
"sd_flags": "-DS140",
"sd_name": "s140",
"sd_version": "6.1.1",
"sd_fwid": "0x00B6"
},
"bootloader": {
"settings_addr": "0xFF000"
}
},
"connectivity": ["bluetooth"],
"debug": {
"jlink_device": "nRF52840_xxAA",
"svd_path": "nrf52840.svd",
"openocd_target": "nrf52840-mdk-rs"
},
"frameworks": ["arduino", "freertos"],
"name": "makerfabs_pucky",
"upload": {
"maximum_ram_size": 248832,
"maximum_size": 815104,
"speed": 115200,
"protocol": "nrfutil",
"protocols": ["jlink", "nrfjprog", "nrfutil", "stlink"],
"use_1200bps_touch": true,
"require_upload_port": true,
"wait_for_upload_port": true
},
"url": "https://www.makerfabs.com",
"vendor": "Makerfabs"
}
+1 -1
View File
@@ -473,7 +473,7 @@ class AnalogBatteryLevel : public HasBatteryLevel
// technically speaking this should work for all(?) NRF52 boards
// but needs testing across multiple devices. NRF52 USB would not even work if
// VBUS was not properly connected and detected by the CPU
#elif defined(MUZI_BASE) || defined(PROMICRO_DIY_TCXO)
#elif defined(MUZI_BASE) || defined(PROMICRO_DIY_TCXO) || defined(HOCKEY_PUCK)
return powerHAL_isVBUSConnected();
#endif
return getBattVoltage() > chargingVolt;
+3
View File
@@ -497,6 +497,9 @@ void cpuDeepSleep(uint32_t msecToWake)
;
#endif
#ifdef POWER_ON_OFF
digitalWrite(POWER_ON_OFF, HIGH);
#endif
auto ok = sd_power_system_off();
if (ok != NRF_SUCCESS) {
LOG_ERROR("FIXME: Ignoring soft device (EasyDMA pending?) and forcing system-off!");
@@ -0,0 +1,68 @@
[env:makerfabs_pucky]
custom_meshtastic_hw_model = 124
custom_meshtastic_hw_model_slug = Hockey_Puck
custom_meshtastic_architecture = nrf52840
custom_meshtastic_actively_supported = true
custom_meshtastic_support_level = 1
custom_meshtastic_display_name = Makerfabs Hockey Puck
custom_meshtastic_images = rak4631.svg, rak4631_case.svg
custom_meshtastic_tags = Makerfabs
extends = nrf52840_base
board = makerfabs_pucky
board_level = pr
board_check = true
build_type = release
build_flags = ${nrf52840_base.build_flags}
-I variants/nrf52840/makerfabs_pucky
-D Hockey_Puck
-DMESHTASTIC_USE_EINK_UI=0
-DMESHTASTIC_HAS_SCREEN=0
-DMESHTASTIC_HAS_GPS=1
-DRADIOLIB_EXCLUDE_SX128X=1
-DRADIOLIB_EXCLUDE_SX127X=1
-DRADIOLIB_EXCLUDE_SX126X=1
-DRADIOLIB_EXCLUDE_LR11X0=0
build_src_filter = ${nrf52_base.build_src_filter} \
+<../variants/nrf52840/makerfabs_pucky> \
+<mesh/api/> \
+<mqtt/> \
lib_deps =
${nrf52840_base.lib_deps}
${networking_base.lib_deps}
# TODO renovate
https://github.com/meshtastic/QMA6100P_Arduino_Library/archive/14c900b8b2e4feaac5007a7e41e0c1b7f0841136.zip
; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm)
; Note: as of 6/2013 the serial/bootloader based programming takes approximately 30 seconds
;upload_protocol = jlink
; Allows programming and debug via the RAK NanoDAP as the default debugger tool for the RAK4631 (it is only $10!)
; programming time is about the same as the bootloader version.
; For information on this see the meshtastic developers documentation for "Development on the NRF52"
[env:makerfabs_pucky_dbg]
extends = env:makerfabs_pucky
board_level = extra
; if the builtin version of openocd has a buggy version of semihosting, so use the external version
; platform_packages = platformio/tool-openocd@3.1200.0
build_flags =
${env:makerfabs_pucky.build_flags}
-D USE_SEMIHOSTING
lib_deps =
${env:makerfabs_pucky.lib_deps}
# TODO renovate
https://github.com/geeksville/Armduino-Semihosting/archive/35b538fdf208c3530c1434cd099a08e486672ee4.zip
; NOTE: the pyocd support for semihosting is buggy. So I switched to using the builtin platformio support for the stlink adapter which worked much better.
; However the built in openocd version in platformio has buggy support for TCP to semihosting.
;
; So I'm now trying the external openocd - but the openocd scripts for nrf52.cfg assume you are using a DAP adapter not an STLINK adapter.
; In theory I could change those scripts. But for now I'm trying going back to a DAP adapter but with the external openocd.
upload_protocol = stlink
; eventually use platformio/tool-pyocd@2.3600.0 instad
;upload_protocol = custom
;upload_command = pyocd flash -t nrf52840 $UPLOADERFLAGS $SOURCE
@@ -0,0 +1,18 @@
#include "RadioLib.h"
#include "nrf.h"
static const uint32_t rfswitch_dio_pins[] = {
RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6, RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC // RADIOLIB_LR11X0_DIO7
};
static const Module::RfSwitchMode_t rfswitch_table[] = {
// mode DIO5 DIO6 // DIO7
{LR11x0::MODE_STBY, {LOW, LOW}}, // { LR11x0::MODE_STBY, { LOW, LOW, LOW } },
{LR11x0::MODE_RX, {HIGH, LOW}}, // { LR11x0::MODE_RX, { HIGH, LOW, LOW } },
{LR11x0::MODE_TX, {HIGH, HIGH}}, // { LR11x0::MODE_TX, { HIGH, HIGH, LOW } },
{LR11x0::MODE_TX_HP, {LOW, HIGH}}, // { LR11x0::MODE_TX_HP, { LOW, HIGH, HIGH } },
{LR11x0::MODE_TX_HF, {LOW, LOW}}, // { LR11x0::MODE_TX_HF, { LOW, LOW, HIGH } },
{LR11x0::MODE_GNSS, {LOW, LOW}}, // { LR11x0::MODE_GNSS, { LOW, LOW, LOW } },
{LR11x0::MODE_WIFI, {LOW, LOW}}, // { LR11x0::MODE_WIFI, { LOW, LOW, LOW } },
END_OF_MODE_TABLE,
};
@@ -0,0 +1,46 @@
/*
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};
void initVariant()
{
// 3V3 Power Rail
pinMode(PIN_3V3_EN, OUTPUT);
digitalWrite(PIN_3V3_EN, HIGH);
// Power latch
pinMode(POWER_ON_OFF, OUTPUT);
digitalWrite(POWER_ON_OFF, HIGH);
// Park the unconnected LNA_CTRL_MCU net so it does not float
pinMode(LNA_CTRL_PIN, INPUT_PULLDOWN);
}
+177
View File
@@ -0,0 +1,177 @@
/*
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_RAK4630_
#define _VARIANT_RAK4630_
// #define RAK4630
/** Master clock frequency */
#define VARIANT_MCK (64000000ul)
#define USE_LFXO // Board uses 32khz crystal for LF
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "WVariant.h"
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
// Number of pins defined in PinDescription array
#define PINS_COUNT (48)
#define NUM_DIGITAL_PINS (48)
#define NUM_ANALOG_INPUTS (6)
#define NUM_ANALOG_OUTPUTS (0)
// #define LED_PIN 16 // This is a LED_WS2812 not a standard LED
#define HAS_NEOPIXEL // Enable the use of neopixels
#define NEOPIXEL_COUNT 1 // How many neopixels are connected
#define NEOPIXEL_DATA 25 // gpio pin used to send data to the neopixels
#define NEOPIXEL_TYPE (NEO_GRB + NEO_KHZ800) // type of neopixels in use
#define RGB_LED_POWER
#define LED_STATE_ON 1
/*
* Buttons
*/
#define BUTTON_PIN 5
#define PIN_BUZZER 22
/*
* 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 (2)
static const uint8_t AREF = PIN_AREF;
/*
* Serial interfaces
*/
// GPS on Base Board
#define PIN_SERIAL1_RX (8)
#define PIN_SERIAL1_TX (6)
// DEBUG on Base Board
#define PIN_SERIAL2_RX (38)
#define PIN_SERIAL2_TX (37)
/*
* SPI Interfaces
*/
#define SPI_INTERFACES_COUNT 1
#define PIN_SPI_MISO (47)
#define PIN_SPI_MOSI (46)
#define PIN_SPI_SCK (45)
static const uint8_t SS = 44;
static const uint8_t MOSI = PIN_SPI_MOSI;
static const uint8_t MISO = PIN_SPI_MISO;
static const uint8_t SCK = PIN_SPI_SCK;
#define USE_LR1121
#define LR11X0_POWER_EN (13)
#define LR1121_IRQ_PIN 14
#define LR1121_NRESET_PIN (42)
#define LR1121_BUSY_PIN (43)
#define LR1121_SPI_NSS_PIN SS
#define LR1121_SPI_SCK_PIN PIN_SPI_SCK
#define LR1121_SPI_MOSI_PIN PIN_SPI_MOSI
#define LR1121_SPI_MISO_PIN PIN_SPI_MISO
#define LR11X0_DIO3_TCXO_VOLTAGE 3.3
#define LR11X0_DIO_AS_RF_SWITCH
/*
* Wire Interfaces
*/
#define WIRE_INTERFACES_COUNT 1
#define PIN_WIRE_SDA (26)
#define PIN_WIRE_SCL (27)
#define HAS_QMA6100P
/*
* Power Switches
*/
#define POWER_ON_OFF (30) // P0.30 Power latch control, set high to keep power on, set low to turn off
#define PIN_3V3_EN (16)
#define HAS_GPS 1
#define PIN_GPS_PPS (11) // Pulse per second input from the GPS
#define GPS_RX_PIN PIN_SERIAL1_RX
#define GPS_TX_PIN PIN_SERIAL1_TX
// Battery
#define EXT_CHRG_DETECT (32 + 7) // P1.07
#define HAS_CW2015 1
// RAK4630 AIN0 = nrf52840 AIN3 = Pin 5
// #define BATTERY_LPCOMP_INPUT NRF_LPCOMP_INPUT_3
// We have AIN3 with a VBAT divider so AIN3 = VBAT * (1.5/2.5)
// We have the device going deep sleep under 3.1V, which is AIN3 = 1.86V
// So we can wake up when VBAT>=VDD is restored to 3.3V, where AIN3 = 1.98V
// 1.98/3.3 = 6/10, but that's close to the VBAT divider, so we
// pick 6/8VDD, which means VBAT=4.1V.
// Reference:
// VDD=3.3V AIN3=5/8*VDD=2.06V VBAT=1.66*AIN3=3.41V
// VDD=3.3V AIN3=11/16*VDD=2.26V VBAT=1.66*AIN3=3.76V
// VDD=3.3V AIN3=6/8*VDD=2.47V VBAT=1.66*AIN3=4.1V
// #define BATTERY_LPCOMP_THRESHOLD NRF_LPCOMP_REF_SUPPLY_11_16
#define LNA_CTRL_PIN 4 // P0.04
#define HOCKEY_PUCK 1
#define NUM_PA_POINTS 22
#define TX_GAIN_LORA 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 13, 13, 12, 12, 11, 10, 9, 8, 7
#ifdef __cplusplus
}
#endif
/*----------------------------------------------------------------------------
* Arduino objects - C++ only
*----------------------------------------------------------------------------*/
#endif