HelTecAutomation / Heltec_ESP32

Arduino library for Heltec ESP32 (or ESP32+LoRa) based boards
Other
644 stars 228 forks source link

Wireless paper board issue with display and lorawan #149

Open arash-ahmadi opened 6 months ago

arash-ahmadi commented 6 months ago

Hello. I am trying the lorawan code on heltec wireless paper and it works fine. But when I add the code for e-ink display to it , both display and lorawan doesn't work. Please advise. Thanks

wangxiangwangeuse commented 6 months ago

Using hspi and fspi

yrpn commented 4 months ago

@wangxiangwangeuse Is it possible to work together? Can you submit an example?

Glenno-H commented 3 months ago

Im having the same issues, using Heltec eink library 4.3.2 and ESP32 2.0.2

#include "LoRaWan_APP.h"
#include "Arduino.h"
#include <heltec-eink-modules.h>
#include "Fonts/FreeSerif9pt7b.h"

// Display Setup
#define PIN_DC      2
#define PIN_CS      4
#define PIN_BUSY    5
LCMEN2R13EFC1 display;       // (Green Tab, V1.1)

// Lora Setup
#define RF_FREQUENCY                                915000000 // Hz
#define TX_OUTPUT_POWER                             14        // dBm
#define LORA_BANDWIDTH                              0         // [0: 125 kHz,
#define LORA_SPREADING_FACTOR                       7         // [SF7..SF12]
#define LORA_CODINGRATE                             1         // [1: 4/5,
#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];

static RadioEvents_t RadioEvents;

int16_t txNumber;

int16_t rssi,rxSize;

bool lora_idle = true;

void setup() {
    Serial.begin(115200);
    Mcu.begin(HELTEC_BOARD,SLOW_CLK_TPYE);

    txNumber=0;
    rssi=0;

    RadioEvents.RxDone = OnRxDone;
    Radio.Init( &RadioEvents );
    Radio.SetChannel( RF_FREQUENCY );
    Radio.SetRxConfig( MODEM_LORA, LORA_BANDWIDTH, LORA_SPREADING_FACTOR,
                               LORA_CODINGRATE, 0, LORA_PREAMBLE_LENGTH,
                               LORA_SYMBOL_TIMEOUT, LORA_FIX_LENGTH_PAYLOAD_ON,
                               0, true, 0, 0, LORA_IQ_INVERSION_ON, true );

    // Eink Display Setup
    // 250 * 122 Res
    display.setBackgroundColor(WHITE);
    display.landscape(); // Go into Landscape mode.
}

void loop()
{
  if(lora_idle)
  {
    lora_idle = false;
    // Serial.println("into RX mode");
    Radio.Rx(0);
  }
  Radio.IrqProcess( );
}

void OnRxDone(uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr) {
    char str[30];
    memcpy(rxpacket, payload, size);
    rxpacket[size] = '\0';

    Radio.Sleep();
    Serial.printf("\r\nReceived packet: %s, RSSI: %d\r\n", rxpacket, rssi);

    // Debugging: Print before display update
    Serial.println("Before display update");

    // Update the e-ink display with static text
    display.setTextSize(3);
    display.printCenter("TEST"); // Display static text
    display.update();
    delay(100); // Add a delay of 100 milliseconds

    // Debugging: Print after display update
    Serial.println("After display update");

    lora_idle = true;
}

SERIAL OUTPUT

Rebooting... x�� Received packet: 33A3A6A7371D,1572,4072, RSSI: -36 Before display update ESP-ROM:esp32s3-20210327 Build:Mar 27 2021 rst:0x1 (POWERON),boot:0x18 (SPI_FAST_FLASH_BOOT) SPIWP:0xee mode:DIO, clock div:1 load:0x3fce3818,len:0x508 load:0x403c9700,len:0x4 load:0x403c9704,len:0xad0 load:0x403cc700,len:0x29d8 entry 0x403c9880

Received packet: 33A3A6A7371D,1572,4098, RSSI: -36 Before display update After display update E (21343) task_wdt: Task watchdog got triggered. The following tasks/users did not reset the watchdog in time: E (21343) task_wdt: - IDLE0 (CPU 0) E (21343) task_wdt: Tasks currently running: E (21343) task_wdt: CPU 0: loopTask E (21343) task_wdt: CPU 1: IDLE1 E (21343) task_wdt: Aborting. E (21343) task_wdt: Print CPU 0 (current core) backtrace