- Tested on RA-02 (SX1278)
- Compatible CAD (Channel activity detection)
git clone https://github.com/LastuvkaLukas/espidf-lora.git lora
Everything can be configured using menuconfig
--> LoRa Configuration
- Settings
- Frequency (
433MHz
) - Sync word (
0xFD
) - Preamble length (
255
) - TX power (
17
) - Init timeout (
100
)
- Frequency (
- SPI Config
- DIO 0-5 Config
LoRa™ module | ESP |
---|---|
GND |
GND |
3V3 |
3V3 |
RST |
GPIO27 |
Compatible HSPI
and VSPI
Default select HSPI
LoRa™ module | ESP |
---|---|
MISO |
GPIO12 |
MOSI |
GPIO13 |
SCK |
GPIO14 |
NSS |
GPIO15 (optional) |
Default dio pins disconnect
LoRa™ module | ESP |
---|---|
DIO0 |
--- (optional) |
DIO1 |
--- (optional) |
DIO2 |
--- (optional) |
DIO3 |
--- (optional) |
DIO4 |
--- (optional) |
DIO5 |
--- (optional) |
First init LoRa™ module
esp_err_t err = lora_init();
if(err != ESP_OK)
ESP_CHECK(err);
...
...
lora_begin_tx();
uint8_t buf[] = "data";
uint8_t size = sizeof(buf);
lora_write_tx(buf, uint8_t size);
lora_end_tx();
...
...
uint8_t buf[255];
uint8_t len;
esp_err_t err = lora_begin_rx(&len);
if(err == ESP_OK)
lora_read_rx(buf, len);
lora_end_rx(); // Switch to Standby mode (optional)
...
...
uint8_t buf[255];
uint8_t len;
esp_err_t err = lora_waiting_cad_rx(&len);
if(err == ESP_OK)
lora_read_rx(buf, len);
lora_end_rx(); // Switch to Standby mode (optional)
...
Copyright (c) 2023 Laštůvka Lukáš