0

I have an ESP32 TTGO T-Call and I want to add a LoRa SX1276. I am new to that and I am trying to write a simple program that, when it receives a packet from a LoRa sender, sends via gsm an HTTP request. GSM communication works fine with the TinyGSM library. My problem is the LoRa connection.

Specific chips according to this issue have some reserved pins. If I use the pins of the above example lora works but GSM does not work, because of the reserved pins for the SIM800. I am posting a piece of code with the LoRa setup that is not working. If there is a need for further explanation please ask. I will appreciate any kind of help.

#define SCK 14
#define SS 15
#define MISO 19
#define MOSI 27
#define RST 34
#define DIO0 33

SPI.begin(SCK, MISO, MOSI, SS);
//setup LoRa transceiver module
LoRa.setPins(SS, RST, DIO0);

while (!LoRa.begin(866E6)) {
    SerialMonitor.println(".");
    delay(500);
}
SerialMonitor.println("LoRa Initializing OK!");

Edited

With setting

#define LORA_MISO 19
#define LORA_MOSI 27
#define LORA_SCK 5
#define LORA_SS 18

#define LORA_RST 14
#define LORA_DIO0 26

Lora works (not sim800) but with the settings of @Juraj comment i am getting

E (11571) gpio: GPIO can only be used as input mode [ 11575][E][esp32-hal-gpio.c:130] __pinMode(): GPIO config failed E (11571) gpio: gpio_set_level(226): GPIO output gpio_num error E (11586) gpio: gpio_set_level(226): GPIO output gpio_num error

Edit

Although the error exists it is working with the above settings:

#define LORA_MISO 2
#define LORA_MOSI 13
#define LORA_SCK 14
#define LORA_SS 15

#define LORA_RST 34
#define LORA_DIO0 25

Some packets from the sender are lost but it seems to be working. I don't know why, but it is working... Also it does not seem very stable.

Finally pins 34-39 can be used as input so #define LORA_RST 34 is not working. But it is not receiving yet from the sender.

7
  • try MOSI 12, MISO 19, SCK 18 and any pin as SS so your io 15 would be ok
    – Juraj
    Sep 2 at 18:26
  • @Juraj thx for your comment. I will try it and I will give you the feedback
    – kostas ch.
    Sep 2 at 20:05
  • @Juraj thx unfortunately i am getting E (11571) gpio: GPIO can only be used as input mode [ 11575][E][esp32-hal-gpio.c:130] __pinMode(): GPIO config failed E (11571) gpio: gpio_set_level(226): GPIO output gpio_num error E (11586) gpio: gpio_set_level(226): GPIO output gpio_num error
    – kostas ch.
    Sep 5 at 8:40
  • try to swap MISO an MOSI in my suggestion. so MOSI 19, MISO 12, SCK 18
    – Juraj
    Sep 5 at 8:48
  • Althought Lora.begin, i am getting before begin same error and of course when sender sends nothing is recieved
    – kostas ch.
    Sep 5 at 9:04

1 Answer 1

1
+50

The issue seems to be arising from the pin definitions and the fact that the SIM800 and the SX1276 LoRa chip on the board might be competing for the same pins, causing interference

First, let's understand the TTGO T-Call pin mapping for SIM800:

SIM800L IP5306 version 20190610:

  1. 4: SIM800L RST
  2. 23: SIM800L DTR
  3. 26: SIM800L PWR
  4. 27: SIM800L TX
  5. 32: SIM800L RX
  6. 33: SIM800L RI

From the pins you've listed for the LoRa SX1276:

  1. SCK: 14
  2. SS: 15
  3. MISO: 19
  4. MOSI: 27
  5. RST: 34
  6. DIO0: 33

It's clear that MOSI on 27 and DIO0 on 33 interfere with SIM800L's pins.

You need to select pins for LoRa that do not interfere with the SIM800L. However, keep in mind that the ESP32 has certain pins that are not suitable for all types of connections.

a proposed remapping would be as follows:

#define SCK 14
#define SS 15
#define MISO 19
#define MOSI 22
#define RST 34
#define DIO0 25

Tell me if this works.

5
  • would like to thank you for the try but i am getting the above: E (4757) gpio: GPIO can only be used as input mode [ 4761][E][esp32-hal-gpio.c:130] __pinMode(): GPIO config failed E (4757) gpio: gpio_set_level(226): GPIO output gpio_num error E (4771) gpio: gpio_set_level(226): GPIO output gpio_num error. This happens when try connect to Lora
    – kostas ch.
    Sep 5 at 8:48
  • hi there in that case please change the "RST" to something like 13? if the pin 13 is not being used by some other modules and if available switching to that should work. if 13 is in use I think you can also use 12, 16, 17, 21, 22 as well. please make sure that the pin you assign does not interfere with anything else. just change the "RST" pin in my answer and it should start working. write back to me after checking the available pin and please tell me if it works. good luck. the problem with my first answer was probably 34 was input only but 13 should work. if it works please approve.
    – b1n3t
    Sep 5 at 14:45
  • With my last edit in pins config and set rst to 33 worked like a harm! Mosi in 27 did not worked. I had to set to other like I did set it to 2.
    – kostas ch.
    Sep 5 at 15:01
  • I am very glad to hear that. Some pins are pre-occupied so they don't work. It seems like 34 was only input pin. 33 or 13 in that aspect would work. does mosi 22 works?
    – b1n3t
    Sep 5 at 15:08
  • I haven't tested yet and I am done for today 😊. I will check it tomorrow and I will give you feedback. Thx for your time
    – kostas ch.
    Sep 5 at 15:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.