Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Guru Meditation Error: Core 1 panic'ed (Interrupt wdt timeout on CPU1).
- Guru Meditation Error: Core 1 panic'ed (Unhandled debug exception).
- Debug exception reason: Stack canary watchpoint triggered (IDLE)
- Core 1 register dump:
- PC : 0x40056f60 PS : 0x00060036 A0 : 0x820112c2 A1 : 0x3fcf4e40
- A2 : 0x3fcf4e50 A3 : 0x3c034c90 A4 : 0x00000060 A5 : 0x3fcf4e80
- A6 : 0x3c034bf3 A7 : 0x3c034bfc A8 : 0x00000000 A9 : 0x00000000
- A10 : 0x3fcf4d04 A11 : 0x80000001 A12 : 0x00040025 A13 : 0x3fcf5000
- A14 : 0x00060a34 A15 : 0x00040024 SAR : 0x0000000a EXCCAUSE: 0x00000001
- EXCVADDR: 0x00000000 LBEG : 0x40056f5c LEND : 0x40056f72 LCOUNT : 0x00000002
- Backtrace:0x40056f5d:0x3fcf4e40 |<-CORRUPTED
- Core 0 register dump:
- PC : 0x42027fea PS : 0x00060134 A0 : 0x82010909 A1 : 0x3fcf4b50
- A2 : 0x00000000 A3 : 0x42019274 A4 : 0x00060120 A5 : 0x80000000
- A6 : 0x02c93ee0 A7 : 0x00ffffff A8 : 0x82010452 A9 : 0x3fcf4b20
- A10 : 0x00000000 A11 : 0x3fc93ed0 A12 : 0x3fc93ed0 A13 : 0x00000000
- A14 : 0x00060120 A15 : 0x00000000 SAR : 0x0000001a EXCCAUSE: 0x00000006
- EXCVADDR: 0x00000000 LBEG : 0x00000000 LEND : 0x00000000 LCOUNT : 0x00000000
- Backtrace:0x42027fe7:0x3fcf4b500x42010906:0x3fcf4b70 0x4037cab4:0x3fcf4b90
- ------
- Guru Meditation Error: Core 0 panic'ed (Interrupt wdt timeout on CPU0).
- Guru Meditation Error: Core 0 panic'ed (Unhandled debug exception).
- Debug exception reason: Stack canary watchpoint triggered (IDLE)
- Core 0 register dump:
- PC : 0x40056f60 PS : 0x00060036 A0 : 0x820112c2 A1 : 0x3fcf48d0
- A2 : 0x3fcf48e0 A3 : 0x3c034c80 A4 : 0x00000060 A5 : 0x3fcf4900
- A6 : 0x3c034bcf A7 : 0x3c034bd8 A8 : 0x00000000 A9 : 0x00000000
- A10 : 0x00000001 A11 : 0x00000001 A12 : 0x00040025 A13 : 0x3fcf4a90
- A14 : 0x00060134 A15 : 0x00040024 SAR : 0x0000000a EXCCAUSE: 0x00000001
- EXCVADDR: 0x00000000 LBEG : 0x40056f5c LEND : 0x40056f72 LCOUNT : 0x00000003
- Backtrace:0x40056f5d:0x3fcf48d0 |<-CORRUPTED
- Core 1 register dump:
- PC : 0x42027fea PS : 0x00060a34 A0 : 0x82010909 A1 : 0x3fcf50c0
- A2 : 0x00000000 A3 : 0x00000003 A4 : 0x00060023 A5 : 0x80000000
- A6 : 0x02c93ee0 A7 : 0x00ffffff A8 : 0x3fc96054 A9 : 0x00000001
- A10 : 0x00000001 A11 : 0x3fcf4e80 A12 : 0x00000020 A13 : 0x80000000
- A14 : 0x00060023 A15 : 0x00000000 SAR : 0x00000000 EXCCAUSE: 0x00000005
- EXCVADDR: 0x00000000 LBEG : 0x00000000 LEND : 0x00000000 LCOUNT : 0x00000000
- Backtrace:0x42027fe7:0x3fcf50c00x42010906:0x3fcf50e0 0x4037cab4:0x3fcf5100
- ---
- #include "Arduino.h"
- #include "LoRaWan_APP.h"
- #include <ResponsiveAnalogRead.h>
- // ----------------------------------------------------------------------------
- // LoRa Configs
- // ----------------------------------------------------------------------------
- #define RF_FREQUENCY 433000000 // Hz
- #define TX_OUTPUT_POWER 17 // dBm
- #define LORA_BANDWIDTH 0 // [0: 125 kHz, 1: 250 kHz, 2: 500 kHz, 3: Reserved]
- #define LORA_SPREADING_FACTOR 9 // [SF7..SF12]
- #define LORA_CODINGRATE 4 // [1: 4/5, 2: 4/6, 3: 4/7, 4: 4/8]
- #define LORA_PREAMBLE_LENGTH 8 // Same for Tx and Rx
- #define LORA_SYMBOL_TIMEOUT 0 // Symbols
- #define LORA_FIX_LENGTH_PAYLOAD_ON false
- #define LORA_IQ_INVERSION_ON false
- #define RX_TIMEOUT_VALUE 1000
- #define BUFFER_SIZE 30 // Define the payload size here
- char txpacket[BUFFER_SIZE];
- char rxpacket[BUFFER_SIZE];
- bool lora_idle=true;
- static RadioEvents_t RadioEvents;
- void OnTxDone( void );
- void OnTxTimeout( void );
- // ----------------------------------------------------------------------------
- // Define Pins
- // ----------------------------------------------------------------------------
- #define VBAT_PIN 1 // Define the battery voltage pin
- #define VBAT_READ_CNTRL_PIN 37 // Control pin for battery voltage reading
- #define MOISTURE_PIN 7 // Define the moisture sensor pin
- #define MOISTURE_PIN_POWER 6 // Define the moisture sensor pin power
- // ----------------------------------------------------------------------------
- // Settings
- // ----------------------------------------------------------------------------
- //For Sector Number
- const int SECTOR_NUMBER = 1; // Define the sector number
- //For Deep Sleep Mode
- const uint32_t DEEP_SLEEP_TIME = 1; // Define the time duration in minutes
- ResponsiveAnalogRead analogBattery(VBAT_PIN, false, 0.0005);
- ResponsiveAnalogRead analogMoisture(MOISTURE_PIN, false, 0.0005);
- // ----------------------------------------------------------------------------
- // Function to Enter in Deep Sleep Mode
- // ----------------------------------------------------------------------------
- void deepSleep() {
- // Enable timer wake-up for deep sleep
- esp_sleep_enable_timer_wakeup(DEEP_SLEEP_TIME * 60 * 1000000);
- //esp_sleep_enable_timer_wakeup(DEEP_SLEEP_TIME * 1000000); // For test
- // Set the MOISTURE_PIN_POWER pin off
- digitalWrite(MOISTURE_PIN_POWER, LOW);
- // End SPI communication
- SPI.end();
- // Set pins as an analog input to save power
- pinMode(RADIO_DIO_1, ANALOG);
- pinMode(RADIO_NSS, ANALOG);
- pinMode(RADIO_RESET, ANALOG);
- pinMode(RADIO_BUSY, ANALOG);
- pinMode(LORA_CLK, ANALOG);
- pinMode(LORA_MISO, ANALOG);
- pinMode(LORA_MOSI, ANALOG);
- // Configure power domains to optimize power consumption
- esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_OFF); // Turn off RTC peripherals
- esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_SLOW_MEM, ESP_PD_OPTION_OFF); // Turn off RTC slow memory
- esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_FAST_MEM, ESP_PD_OPTION_OFF); // Turn off RTC fast memory
- esp_sleep_pd_config(ESP_PD_DOMAIN_XTAL, ESP_PD_OPTION_OFF); // Turn off the crystal oscillator
- Serial.printf("\nEntering deep sleep mode for %u %s...\n", DEEP_SLEEP_TIME, (DEEP_SLEEP_TIME == 1) ? "minute" : "minutes");
- delay(100);
- // Enter deep sleep mode
- esp_deep_sleep_start();
- }
- void blinkLED() {
- digitalWrite(LED, HIGH);
- delay(100);
- digitalWrite(LED, LOW);
- }
- void setup() {
- Serial.begin(115200);
- analogMoisture.setAnalogResolution(4096);
- pinMode(LED, OUTPUT);
- // Set the VBAT_READ_CNTRL_PIN pin to turn it off
- pinMode(VBAT_READ_CNTRL_PIN, OUTPUT);
- digitalWrite(VBAT_READ_CNTRL_PIN, LOW);
- // Set the MOISTURE_PIN_POWER pin to turn it on
- pinMode(MOISTURE_PIN_POWER, OUTPUT);
- digitalWrite(MOISTURE_PIN_POWER, HIGH);
- Mcu.begin();
- Serial.println("\nInitializing LoRa Radio...");
- RadioEvents.TxDone = OnTxDone;
- RadioEvents.TxTimeout = OnTxTimeout;
- Radio.Init( &RadioEvents );
- Radio.SetChannel( RF_FREQUENCY );
- Radio.SetTxConfig( MODEM_LORA, TX_OUTPUT_POWER, 0, LORA_BANDWIDTH,
- LORA_SPREADING_FACTOR, LORA_CODINGRATE,
- LORA_PREAMBLE_LENGTH, LORA_FIX_LENGTH_PAYLOAD_ON,
- true, 0, 0, LORA_IQ_INVERSION_ON, 3000 );
- }
- void loop()
- {
- if(lora_idle == true)
- {
- //delay(100);
- Serial.println("\nGetting Analog Values from the sensors...");
- analogBattery.update();
- analogMoisture.update();
- delay(60000);
- Serial.print("Battery: ");
- Serial.println(analogBattery.getValue());
- Serial.print("Moisture: ");
- Serial.println(analogMoisture.getValue());
- // Start a package
- sprintf(txpacket, "%d:%d:%d", SECTOR_NUMBER, analogBattery.getValue(), analogMoisture.getValue());
- Serial.printf("\r\nSending Packet: \"%s\", length %d\r\n",txpacket, strlen(txpacket));
- // Send the package out
- Radio.Send((uint8_t *)txpacket, strlen(txpacket));
- lora_idle = false;
- }
- Radio.IrqProcess();
- }
- void OnTxDone( void ) {
- // Put LoRa radio to sleep
- Radio.Sleep();
- Serial.println("TX done......");
- lora_idle = true;
- // Blink the LED when sending the package out
- blinkLED();
- delay(100);
- deepSleep();
- }
- void OnTxTimeout( void ){
- // Put LoRa radio to sleep
- Radio.Sleep();
- Serial.println("TX Timeout......");
- lora_idle = true;
- delay(100);
- deepSleep();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement