Site icon Renzo Mischianti

LORA E32 na ESP32 Micropython

Hi. I am learning to work with LORA E32 using your articles. I have ESP32_devkitc_V4 or ESP32_devkit_V1, LORE E32 433T30D. I program in Python. I use the codes from your articles: https://mischianti.org/ebyte-lora-e32-micropython-specifications-overview-and-first-use-1/ . On the first test with the code
#############################
#
# Simple send receive test
#
# by Renzo Mischianti
# www.mischianti.org
#
#############################
from machine import UART, Pin
import utime

# UART configuration Raspberry Pi Pico (Arduino)
#uart1 = UART(1, 9600, rx=Pin(9), tx=Pin(8))
# UART configuration Raspberry Pi Pico (MicroPython)
# uart1 = UART(1, 9600)
# UART configuration ESP32
uart1 = UART(2, 9600)

print("Hi, I'm going to send message!")
uart1.write("Hello, world?")
utime.sleep_ms(500)

while True:
    if uart1.any():
        char = uart1.read(1).decode('utf-8')
        print(char, end='')
the device worked well. The transmitter sent the message and the receiver received it. When using the library and code
#############################
#
# Simple send receive test
# with the micropython library
# pip install ebyte-lora-e32
#
# by Renzo Mischianti
# www.mischianti.org
#
#############################
 
from lora_e32 import LoRaE32, print_configuration, Configuration
from lora_e32_operation_constant import ResponseStatusCode
from machine import UART, Pin
 
# Initialize the LoRaE32 module
# UART configuration Raspberry Pi Pico (Arduino)
# uart1 = UART(1, 9600, rx=Pin(9), tx=Pin(8))
# UART configuration Raspberry Pi Pico (MicroPython)
# uart1 = UART(1, 9600)
# UART configuration ESP32
uart1 = UART(2, 9600)
 
lora = LoRaE32('433T30D', uart1)
code = lora.begin()
print("Initialization: ", ResponseStatusCode.get_description(code))
 
# Send a string message (transparent)
message = 'Hello, world!'
code = lora.send_transparent_message(message)
print("Send message: ", ResponseStatusCode.get_description(code))
 
# Receive a string message (transparent)
while True:
    if lora.available() > 0:
        code, value = lora.receive_message()
        print(ResponseStatusCode.get_description(code))

    print(value)
ESP32 gives me an error after the reset:
rst:0x1 (POWERON_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:0x3fff0030,len:4728
load:0x40078000,len:14888
load:0x40080400,len:3368
entry 0x400805cc
E (1639) uart: tout_thresh = 244 > maximum value = 101
Traceback (most recent call last):
File “main.py”, line 25, in <module>
File “lora_e32.py”, line 305, in begin
OSError: (-258, ‘ESP_ERR_INVALID_ARG’)
MicroPython v1.22.2 on 2024-02-22; Generic ESP32 module with ESP32
Type “help()” for more information.
>>>

I have connected the circuits according to the article. The only modification of the code is the change of the original module to E32 433T30D. Thanks for help. Peter
Exit mobile version