xreef / EByte_LoRa_E22_python_raspberrypi_library

RaspberryPi LoRa EBYTE E22 device library complete and tested. sx1262/sx1268
https://www.mischianti.org/category/my-libraries/ebyte-lora-e22-devices/
Other
7 stars 0 forks source link

Support E22T33D #1

Closed OxMarco closed 11 months ago

OxMarco commented 11 months ago

There seems to be a problem with the E22T33D module, on Ubuntu Server 22

$~/EByte_LoRa_E22_python_raspberrypi_library/examples$ sudo python3 get_configuration.py 
Initialization: {} Success
Traceback (most recent call last):
  File "/home/ubuntu/EByte_LoRa_E22_python_raspberrypi_library/examples/get_configuration.py", line 25, in <module>
    code, configuration = lora.get_configuration()
  File "/usr/local/lib/python3.10/dist-packages/ebyte_lora_e22_rpi-0.0.2-py3.10.egg/lora_e22.py", line 568, in get_configuration
  File "/usr/local/lib/python3.10/dist-packages/ebyte_lora_e22_rpi-0.0.2-py3.10.egg/lora_e22.py", line 272, in from_bytes
  File "/usr/local/lib/python3.10/dist-packages/ebyte_lora_e22_rpi-0.0.2-py3.10.egg/lora_e22.py", line 231, in from_hex_array
IndexError: list index out of range

On Raspian I am not getting the same error, except for

Retrieve configuration: {} Save mode returned not recognized!
OxMarco commented 11 months ago

I confirm the cause is very probably a reading error as all retrieved values are null even on Raspian

/usr/local/lib/python3.9/dist-packages/ebyte_lora_e22_rpi-0.0.2-py3.9.egg/lora_e22.py:398: RuntimeWarning: This channel is already in use, continuing anyway.  Use GPIO.setwarnings(False) to disable warnings.
/usr/local/lib/python3.9/dist-packages/ebyte_lora_e22_rpi-0.0.2-py3.9.egg/lora_e22.py:399: RuntimeWarning: This channel is already in use, continuing anyway.  Use GPIO.setwarnings(False) to disable warnings.
Initialization: {} Success
Retrieve configuration: {} Save mode returned not recognized!
------------- CONFIGURATION BEFORE CHANGE -------------
----------------------------------------
HEAD :  0x0   0x0   0x0

AddH :  0x0
AddL :  0x0

Chan :  0  ->  410

SpeedParityBit :  0b0  ->  8N1 (Default)
SpeedUARTDatte :  0b0  ->  1200bps
SpeedAirDataRate :  0b0  ->  0.3kbps

OptionSubPacketSett:  0b0  ->  240bytes (default)
OptionTranPower :  0b0  ->  33dBm (Default)
OptionRSSIAmbientNo:  0b0  ->  Disabled (default)

TransModeWORPeriod :  0b0  ->  500ms
TransModeTransContr:  0b0  ->  WOR Receiver (default)
TransModeEnableLBT :  0b0  ->  Disabled (default)
TransModeEnableRSSI:  0b0  ->  Disabled (default)
TransModeEnabRepeat:  0b0  ->  Disabled (default)
TransModeFixedTrans:  0b0  ->  Transparent transmission (default)
----------------------------------------
------------- CONFIGURATION AFTER CHANGE -------------
Data size not match!
----------------------------------------
Traceback (most recent call last):
  File "/home/pi/EByte_LoRa_E22_python_raspberrypi_library/examples/set_configuration.py", line 79, in <module>
    print_configuration(confSetted)
  File "/usr/local/lib/python3.9/dist-packages/ebyte_lora_e22_rpi-0.0.2-py3.9.egg/lora_e22.py", line 277, in print_configuration
AttributeError: 'NoneType' object has no attribute '_COMMAND'
xreef commented 11 months ago

Hi OxMarco, other people have the same problem and normally It indicates a wiring problem or not sufficient power supply. But in this case, I think It is simply that E22T33D isn't an EByte model, I think you mean 400E22D. Bye Renzo

OxMarco commented 11 months ago

Hi, thank you for you prompt reply.

The item is a E22-400T33D, a LoRa 433MHz module featuring a maximum output power of 33dbm, UART version.

I double checked the wiring and tried with an USB-to-UART converter too, changing the port to the /dev/ttyUSB0 one with the same error coming up. Could it be that the library does not recognise the model?

xreef commented 11 months ago

You must insert 400T33D as model. Bye Renzo

OxMarco commented 11 months ago

I already changed the model to the new one, that is not the source of the problem

import serial

from lora_e22 import LoRaE22, print_configuration
from lora_e22_operation_constant import ResponseStatusCode

loraSerial = serial.Serial('/dev/serial0') #, baudrate=9600, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ON>

lora = LoRaE22('400T33D', loraSerial, aux_pin=18, m0_pin=23, m1_pin=24)

code = lora.begin()
print("Initialization: {}", ResponseStatusCode.get_description(code))

code, configuration = lora.get_configuration()

print("Retrieve configuration: {}", ResponseStatusCode.get_description(code))

print_configuration(configuration)
OxMarco commented 11 months ago

Issue solved by disabling the default shell on Serial port

For those having the same issue: sudo raspi-config > interface options > serial port > No > Yes

xreef commented 10 months ago

Thanks for your reply.