Lora E220-400T22S to ESP32S wiring, transmitting/receiving issue

I'm not quit sure if this is correct forum but I'm putting my question here out of desperate to find the solution. thanks

I'm trying to connect Lora E220-400T22S version installed on Ebyte E15 card with antena to ESP32S and transmit or receive RF data.

my code is based on this library ESPIDF Lora github

however, the problem seem to be in wiring where I can't figure out what Im missing.

from Lora side, I have pins:

  1. RXD: which used for Receiving data
  2. TXD: which used for Transmitting data
  3. AUX
  4. NC1, NC2, NC3
  5. GND
  6. VCC
  7. M0, M1

in ESP32S I have a lot of pins:

  1. GND, VCC
  2. a lot of GPIO

checking idf.py menuconfig lora configuration lora configuration

I can see that RXD/TXD should be connected to P19 in ESP32. Hence, the wiring I did is:

  1. Lora GND -> ESP GND
  2. Lora VCC -> ESP VCC 5V
  3. Lora TXD -> ESP P19
  4. M0, M1 -> ESP GND

But no success to send data, in terms of code, init_lora always fails

it says that version always is 0xff which tried to read from register 0x42 which I have no clue what does this mean, neither anybody answers in github question.

Updating the code to use UART:

I have used UART to connect to Lora and try to send receive data but without success.

I have connected Lora RXD and TXD to GPIO 16, 17 in ESP and wrote the following app for receiver ESP:

#define ECHO_TEST_TXD (17)
#define ECHO_TEST_RXD (16)
#define ECHO_TEST_RTS (UART_PIN_NO_CHANGE)
#define ECHO_TEST_CTS (UART_PIN_NO_CHANGE)

#define ECHO_UART_PORT_NUM      (UART_NUM_0)
#define ECHO_UART_BAUD_RATE     (115200)

#define BUF_SIZE (1024)

void lora_uart() {

/* Configure parameters of an UART driver,
 * communication pins and install the driver */
uart_config_t uart_config = {
    .baud_rate = ECHO_UART_BAUD_RATE,
    .data_bits = UART_DATA_8_BITS,
    .parity    = UART_PARITY_DISABLE,
    .stop_bits = UART_STOP_BITS_1,
    .flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
    .source_clk = UART_SCLK_DEFAULT,
};
int intr_alloc_flags = 0;


#if CONFIG_UART_ISR_IN_IRAM
    intr_alloc_flags = ESP_INTR_FLAG_IRAM;
#endif

ESP_ERROR_CHECK(uart_driver_install(ECHO_UART_PORT_NUM, BUF_SIZE * 2, 0, 0, NULL, intr_alloc_flags));
ESP_ERROR_CHECK(uart_param_config(ECHO_UART_PORT_NUM, &uart_config));
ESP_ERROR_CHECK(uart_set_pin(ECHO_UART_PORT_NUM, ECHO_TEST_TXD, ECHO_TEST_RXD, ECHO_TEST_RTS, ECHO_TEST_CTS));

// Configure a temporary buffer for the incoming data
uint8_t *data = (uint8_t *) malloc(BUF_SIZE);

while (1) {
    // Read data from the UART
    ESP_LOGI(TAG, "Receiving.....");
    int len = uart_read_bytes(ECHO_UART_PORT_NUM, data, (BUF_SIZE - 1), 20 / portTICK_PERIOD_MS);
    if (len) {
        data[len] = '\0';
        ESP_LOGI(TAG, "Recv str: %s", (char *) data);
    }
    vTaskDelay(1000);
}
}

and the following to to the transmit ESP with same connections:

#define ECHO_TEST_TXD (17)
#define ECHO_TEST_RXD (16)
#define ECHO_TEST_RTS (UART_PIN_NO_CHANGE)
#define ECHO_TEST_CTS (UART_PIN_NO_CHANGE)

#define ECHO_UART_PORT_NUM      (UART_NUM_0)
#define ECHO_UART_BAUD_RATE     (115200)

#define BUF_SIZE (1024)


void lora_uart() {

/* Configure parameters of an UART driver,
 * communication pins and install the driver */
uart_config_t uart_config = {
    .baud_rate = ECHO_UART_BAUD_RATE,
    .data_bits = UART_DATA_8_BITS,
    .parity    = UART_PARITY_DISABLE,
    .stop_bits = UART_STOP_BITS_1,
    .flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
    .source_clk = UART_SCLK_DEFAULT,
};
int intr_alloc_flags = 0;

#if CONFIG_UART_ISR_IN_IRAM
    intr_alloc_flags = ESP_INTR_FLAG_IRAM;
#endif

ESP_ERROR_CHECK(uart_driver_install(ECHO_UART_PORT_NUM, BUF_SIZE * 2, 0, 0, NULL, intr_alloc_flags));
ESP_ERROR_CHECK(uart_param_config(ECHO_UART_PORT_NUM, &uart_config));
ESP_ERROR_CHECK(uart_set_pin(ECHO_UART_PORT_NUM, ECHO_TEST_TXD, ECHO_TEST_RXD, ECHO_TEST_RTS, ECHO_TEST_CTS));

// Configure a temporary buffer for the incoming data
// uint8_t *data = (uint8_t *) malloc(BUF_SIZE);

while (1) {
    // Write data back to the UART
    ESP_LOGI(TAG, "Sending....." );
    uart_write_bytes(ECHO_UART_PORT_NUM, (const char *) "Hello", 5);
    ESP_LOGI(TAG, "Wrote data str: %s", (char *) "Hello");
    vTaskDelay(1000);
}
}

But no success of receiving any data...

This is a forum for the Nano ESP32, do you have one ?

Might be best to seek advice from Espressif who publish that code.

However the E220-400T22S is a LoRa module with a serial UART based interface so it wont work with a library that is for LoRa modules with an SPI interface.

regarding 1: I have ESP32 Wroom 32

Regarding 2: Thats a valid point! missed it! thank. will give it a try, is it fine to connect RX and TX of ESP to Lora directly ? that should work ?

Thanks a lot for pointing out

I recommend you use a seperate power supply for the Lora E220-400T22S, it pulls about 125mA during transmit and many ESP modules cannot supply that current without problems. That may cause problem after you get the communications sorted out.

Thanks. I tried this as well, no success

I moved your topic to a more appropriate forum category @saeedisa90.

The Nano ESP32 category you chose is only used for discussions directly related to the Arduino Nano ESP32 board.

In the future, please take the time to pick the forum category that best suits the subject of your question. There is an "About the _____ category" topic at the top of each category that explains its purpose.

Thanks in advance for your cooperation.

Sure, thanks! my bad

Probably, check the documentation of the library for the E220.

try the EByte_LoRa_E220_Series_Library

when installed try File>Examples>Ebyte LoRa E220 Library>01_getConfiguration
which should display something along the lines of

Success
1
----------------------------------------
HEAD : C1 0 8
 
AddH : 0
AddL : 0
 
Chan : 15 -> 425MHz
 
SpeedParityBit     : 0 -> 8N1 (Default)
SpeedUARTDatte     : 11 -> 9600bps (default)
SpeedAirDataRate   : 10 -> 2.4kbps (default)
 
OptionSubPacketSett: 0 -> 200bytes (default)
OptionTranPower    : 0 -> 22dBm (Default)
OptionRSSIAmbientNo: 0 -> Disabled (default)
 
TransModeWORPeriod : 11 -> 2000ms (default)
TransModeEnableLBT : 0 -> Disabled (default)
TransModeEnableRSSI: 0 -> Disabled (default)
TransModeFixedTrans: 0 -> Transparent transmission (default)
----------------------------------------
Success
1
----------------------------------------
HEAD: C1 8 3
Model no.: 20
Version  : B
Features : 16
----------------------------------------

did you use esp-idf or platformIO ?