Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rp2040 clk init #105

Merged
merged 2 commits into from
Sep 5, 2024
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- esp32:esp32:m5stack_core2
- esp32:esp32:esp32s3_powerfeather
- esp32:esp32:adafruit_feather_esp32s2
#- rp2040:rp2040:adafruit_feather:dbgport=Serial
- rp2040:rp2040:adafruit_feather:dbgport=Serial

runs-on: ubuntu-latest
name: ${{ matrix.board }}
Expand Down
2 changes: 1 addition & 1 deletion data/node_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"powerfeather": {
"battery_capacity": 2201,
"supply_maintain_voltage": 4600,
"max_charge_current": 50,
"max_charge_current": 1000,
"temperature_measurement": true,
"battery_fuel_gauge": true
}
Expand Down
6 changes: 3 additions & 3 deletions data/secrets.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"joinEUI": "0x0000000000000000",
"devEUI": "0x123456789ABCDEF0",
"nwkKey": ["0x11", "0x22", "0x33", "0x44", "0x55", "0x66", "0x77", "0x88", "0x99", "0xAA", "0xBB", "0xCC", "0xDD", "0xEE", "0xFF", "0x00"],
"appKey": ["0x10", "0x20", "0x30", "0x40", "0x50", "0x60", "0x70", "0x80", "0x90", "0xA0", "0xB0", "0xC0", "0xD0", "0xE0", "0xF0", "0xFF"]
"devEUI": "0x0C8B95AAB05CFEFF",
"nwkKey": ["0x81", "0x83", "0xF4", "0xDD", "0x1B", "0x1F", "0xCF", "0x36", "0xC3", "0x73", "0x2A", "0xBE", "0x7C", "0xA2", "0x2F", "0x92"],
"appKey": ["0x73", "0xF9", "0x96", "0x32", "0x29", "0x2A", "0xF9", "0x23", "0xC0", "0x7D", "0x26", "0x43", "0x1D", "0x0C", "0x9A", "0xBC"]
}
138 changes: 125 additions & 13 deletions secrets.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,127 @@
// JoinEUI - previous versions of LoRaWAN called this AppEUI
// for development purposes you can use all zeros - see wiki for details
#define RADIOLIB_LORAWAN_JOIN_EUI 0x0000000000000000

// The Device EUI & two keys can be generated on the TTN console (or any other LoRaWAN Network Service Provider's console)
#pragma message("Replace the dummy values for RADIOLIB_LORAWAN_DEV_EUI, RADIOLIB_LORAWAN_APP_KEY and RADIOLIB_LORAWAN_NWK_KEY by your own credentials.")
#ifndef RADIOLIB_LORAWAN_DEV_EUI // Replace with your Device EUI
#define RADIOLIB_LORAWAN_DEV_EUI 0x0000000000000000
#endif
#ifndef RADIOLIB_LORAWAN_APP_KEY // Replace with your App Key
#define RADIOLIB_LORAWAN_APP_KEY 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
#define SECRETS

//-------------------------------
// --> REPLACE BY YOUR VALUES <--
//-------------------------------

#if 0
// application identifier - pre-LoRaWAN 1.1.0, this was called appEUI
// when adding new end device in TTN, you will have to enter this number
// you can pick any number you want, but it has to be unique
uint64_t joinEUI = 0x12AD1011B0C0FFEE;

// device identifier - this number can be anything
// when adding new end device in TTN, you can generate this number,
// or you can set any value you want, provided it is also unique
uint64_t devEUI = 0x70B3D57ED005E120;

// select some encryption keys which will be used to secure the communication
// there are two of them - network key and application key
// because LoRaWAN uses AES-128, the key MUST be 16 bytes (or characters) long

// network key is the ASCII string "topSecretKey1234"
uint8_t nwkKey[] = { 0x74, 0x6F, 0x70, 0x53, 0x65, 0x63, 0x72, 0x65,
0x74, 0x4B, 0x65, 0x79, 0x31, 0x32, 0x33, 0x34 };

// application key is the ASCII string "aDifferentKeyABC"
uint8_t appKey[] = { 0x61, 0x44, 0x69, 0x66, 0x66, 0x65, 0x72, 0x65,
0x6E, 0x74, 0x4B, 0x65, 0x79, 0x41, 0x42, 0x43 };

// prior to LoRaWAN 1.1.0, only a single "nwkKey" is used
// when connecting to LoRaWAN 1.0 network, "appKey" will be disregarded
// and can be set to NULL
#endif
#ifndef RADIOLIB_LORAWAN_NWK_KEY // Put your Nwk Key here
#define RADIOLIB_LORAWAN_NWK_KEY 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00


// Adafruit RFM9x LoRa Radio #1
//#define RADIO1
//#define RADIO4
#define RADIO5
//#define RADIO7
//#define RADIO9

#ifdef RADIO1
static const uint64_t devEUI = 0x9876B6000011C941;

static const uint64_t joinEUI = 0x0000000000000000;

static const std::uint8_t nwkKey[] = { 0x81, 0x83, 0xF4, 0xDD, 0x1B, 0x1F, 0xCF, 0x36, 0xC3, 0x73, 0x2A, 0xBE, 0x7C, 0xA2, 0x2F, 0x92 };

static const std::uint8_t appKey[] = { 0x24, 0xD4, 0x43, 0xCD, 0xB4, 0xD5, 0xDE, 0x3F, 0x9E, 0x17, 0xB7, 0x19, 0xE1, 0xD7, 0x16, 0xA2 };

#elif defined(RADIO1)
// 20240613
#define RADIOLIB_LORAWAN_DEV_EUI 0x9876b6000011c941

//static const uint64_t joinEUI = 0x0000000000000000;

#define RADIOLIB_LORAWAN_NWK_KEY 0x81, 0x83, 0xF4, 0xDD, 0x1B, 0x1F, 0xCF, 0x36, 0xC3, 0x73, 0x2A, 0xBE, 0x7C, 0xA2, 0x2F, 0x92

#define RADIOLIB_LORAWAN_APP_KEY 0xD2, 0x0F, 0xCB, 0x68, 0xEC, 0x64, 0x42, 0xF9, 0x73, 0x00, 0x91, 0x3A, 0xAA, 0x5A, 0xE2, 0x9F

#elif defined(RADIO4)
// Adafruit RFM9x LoRa Radio #4

static const uint64_t devEUI = 0x9876B6000011F87A;

static const uint64_t joinEUI = 0x0000000000000000;

static const std::uint8_t nwkKey[] = { 0x81, 0x83, 0xF4, 0xDD, 0x1B, 0x1F, 0xCF, 0x36, 0xC3, 0x73, 0x2A, 0xBE, 0x7C, 0xA2, 0x2F, 0x92 };

static const std::uint8_t appKey[] = { 0x39, 0x15, 0x2C, 0xBB, 0xDA, 0xEC, 0x25, 0xC6, 0x53, 0x4F, 0xA2, 0x20, 0x40, 0x04, 0xFA, 0xC8 };

#elif defined(RADIO5)

#define RADIOLIB_LORAWAN_DEV_EUI 0x0C8B95AAB05CFEFF

//static const uint64_t joinEUI = 0x0000000000000000;

#define RADIOLIB_LORAWAN_NWK_KEY 0x81, 0x83, 0xF4, 0xDD, 0x1B, 0x1F, 0xCF, 0x36, 0xC3, 0x73, 0x2A, 0xBE, 0x7C, 0xA2, 0x2F, 0x92

#define RADIOLIB_LORAWAN_APP_KEY 0x73, 0xF9, 0x96, 0x32, 0x29, 0x2A, 0xF9, 0x23, 0xC0, 0x7D, 0x26, 0x43, 0x1D, 0x0C, 0x9A, 0xBC

#elif defined(RADIO6)
static const uint64_t devEUI = 0x0C8B95AAAE6CFEFF;

static const uint64_t joinEUI = 0x0000000000000000;

static const std::uint8_t nwkKey[] = { 0x81, 0x83, 0xF4, 0xDD, 0x1B, 0x1F, 0xCF, 0x36, 0xC3, 0x73, 0x2A, 0xBE, 0x7C, 0xA2, 0x2F, 0x92 };

static const std::uint8_t appKey[] = { 0x59, 0xDC, 0x28, 0x58, 0xF6, 0x0C, 0x54, 0x70, 0x4E, 0x2E, 0xCB, 0x5E, 0x7B, 0x10, 0x79, 0x70 };

#elif defined(RADIO7)
// FireBeetleCover LoRa Radio #7
// pv-inverter-0

#define RADIOLIB_LORAWAN_DEV_EUI 0x70B3D57ED005CF56

// appeui, little-endian (lsb first)
///static const uint64_t joinEUI = 0x0000000000000000;

#define RADIOLIB_LORAWAN_NWK_KEY 0x2B, 0xA8, 0x2A, 0x2D, 0xCE, 0x8F, 0xC5, 0x01, 0x4A, 0xBB, 0xFA, 0x7A, 0xF7, 0x97, 0x1D, 0x3B

#define RADIOLIB_LORAWAN_APP_KEY 0xD6, 0xB3, 0x3F, 0xBB, 0x7B, 0x3B, 0x01, 0xC8, 0x04, 0x8A, 0xCF, 0x9E, 0x24, 0x12, 0x45, 0xC1

#elif defined(RADIO8)
// FireBeetleCover LoRa Radio #8
// pv-inverter-1

static const uint64_t devEUI[] = 0x70B3D57ED005D3B9;

static const uint64_t joinEUI = 0x0000000000000000;

static const std::uint8_t nwkKey[] = { 0x81, 0x83, 0xF4, 0xDD, 0x1B, 0x1F, 0xCF, 0x36, 0xC3, 0x73, 0x2A, 0xBE, 0x7C, 0xA2, 0x2F, 0x92 };

static const std::uint8_t appKey[] = { 0xB2, 0xA3, 0xD7, 0x16, 0xA6, 0x77, 0x8E, 0xEF, 0xBA, 0x57, 0xB7, 0xBE, 0x4F, 0xD7, 0xC4, 0x7E };

#elif defined(RADIO9)
// 98:76:B6:12:87:a1
static const uint64_t devEUI[] = 0x9876B600001287A1;

static const uint64_t joinEUI = 0x0000000000000000;

static const std::uint8_t nwkKey[] = { 0x81, 0x83, 0xF4, 0xDD, 0x1B, 0x1F, 0xCF, 0x36, 0xC3, 0x73, 0x2A, 0xBE, 0x7C, 0xA2, 0x2F, 0x92 };

static const std::uint8_t appKey[] = { 0x8F, 0xC5, 0x12, 0xE1, 0x22, 0xC8, 0xD0, 0xFC, 0xB7, 0x9F, 0x04, 0xC1, 0xAE, 0xC9, 0x51, 0x4C };

#endif
3 changes: 2 additions & 1 deletion src/rp2040/pico_rtc_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
// History:
//
// 20231006 Created
// 20240905 Removed clocks_init() - not available/not required
// in pico-sdk v2.0.0
//
// ToDo:
// -
Expand Down Expand Up @@ -155,7 +157,6 @@ void pico_sleep(unsigned duration) {

// back from dormant state
rosc_enable();
clocks_init();
// --8<-----
}
#endif
Loading