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:
- RXD: which used for Receiving data
- TXD: which used for Transmitting data
- AUX
- NC1, NC2, NC3
- GND
- VCC
- M0, M1
in ESP32S I have a lot of pins:
- GND, VCC
- a lot of GPIO
checking idf.py menuconfig lora configuration 
I can see that RXD/TXD should be connected to P19 in ESP32. Hence, the wiring I did is:
- Lora GND -> ESP GND
- Lora VCC -> ESP VCC 5V
- Lora TXD -> ESP P19
- 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...