Xinyuan-LilyGO / LilyGO-T-SIM7000G

LilyGO T-SIM7000G
https://pt.aliexpress.com/item/4000542688096.html
284 stars 123 forks source link

Lora project #153

Closed ro85ac closed 2 years ago

ro85ac commented 2 years ago

I have the new T-SIM7000G board including Lora shield. I have tried both examples "sender" and "received" and I am getting the same output:

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:2 load:0x3fff0018,len:4 load:0x3fff001c,len:1044 load:0x40078000,len:10124 load:0x40080400,len:5828 entry 0x400806a8

What am I doing wrong?

sim7000g

ro85ac commented 2 years ago

After digging more it seems that the error is related to this line of code: "SPIClass SPI1(HSPI);" But without SPI1 I cannot se the SPI to Lora: "LoRa.setSPI(SPI1);"

Probably it's related to the SPI version and/or the dependent library https://github.com/sandeepmistry/arduino-LoRa

ro85ac commented 2 years ago

If I am not declaring SPI1 and initialize SPI with the pins of SPI1 (lora ones) I am getting the following error: Setup Lora freq : 868000000 LORA Begin FAIL

#include <SPI.h>
#include <LoRa.h>

#define PIN_TX              27
#define PIN_RX              26
#define UART_BAUD           115200
#define PWR_PIN             4

#define SD_MISO             2
#define SD_MOSI             15
#define SD_SCLK             14
#define SD_CS               13

#define LORA_RST            12
#define LORA_DI0            32
#define RADIO_DIO_1         33
#define RADIO_DIO_2         34
#define LORA_SS             5
#define LORA_MISO           19
#define LORA_MOSI           23
#define LORA_SCK            18

#define BAND                868E6

void setup()
{
    Serial.begin(115200);
    Serial.println("Starting...");
    while (!Serial);

    Serial.println("LoRa Receiver");

    SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI, LORA_SS);
    LoRa.setSPI(SPI);
    LoRa.setPins(LORA_SS, LORA_RST, LORA_DI0);
    Serial.printf("Setup Lora freq : %.0f\n", BAND);
    if (!LoRa.begin(BAND)) {
        Serial.println("LORA Begin FAIL");
        while (1);
    }
    Serial.println("LORA Begin PASS");
}

void loop()
{
    // try to parse packet
    int packetSize = LoRa.parsePacket();
    if (packetSize) {
        // received a packet
        Serial.print("Received packet '");

        // read packet
        while (LoRa.available()) {
            Serial.print((char)LoRa.read());
        }

        // print RSSI of packet
        Serial.print("' with RSSI ");
        Serial.println(LoRa.packetRssi());
    }
}
ro85ac commented 2 years ago

With the latest code the project works.