xreef / EByte_LoRa_E220_micropython_library

MicroPython LoRa EBYTE E220 LLCC68 device library complete and tested with Arduino, esp8266, esp32, STM32 and Raspberry Pi Pico (rp2040 boards).
https://www.mischianti.org/category/my-libraries/lora-e220-llcc68-devices/
Other
12 stars 1 forks source link

Save mode returned not recognized! #1

Closed HomineLudens closed 1 year ago

HomineLudens commented 1 year ago

Hi!, I'm testing the library with a RP2040 and a E220900T22D, seems like something went wrong using get_configuration()

DEBUG  MODE NORMAL!
  DEBUG  AUX HIGH!
  DEBUG  Complete!
Initialization: {} Success
  DEBUG  check_UART_configuration: 1
  DEBUG  MODE PROGRAM!
  DEBUG  AUX HIGH!
  DEBUG  Complete!
  DEBUG  set_mode: 1
  DEBUG  data: b'\x00\x00\xc1\x00\x08\x01\x02b\x00\x01\x03\x00\x00\x00'
  DEBUG  data len: 14
  DEBUG  model: 900T22D
  DEBUG  MODE NORMAL!
  DEBUG  AUX HIGH!
  DEBUG  Complete!
Retrieve configuration: {} Save mode returned not recognized!
----------------------------------------
HEAD :  0x0   0x0   0xc1

AddH :  0x0
AddL :  0x8

Chan :  98  ->  948

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

OptionSubPacketSett:  0b0  ->  200bytes (default)
OptionTranPower :  0b10  ->  13dBm
OptionRSSIAmbientNo:  0b0  ->  Disabled (default)

TransModeWORPeriod :  0b0  ->  500ms
TransModeEnableLBT :  0b0  ->  Disabled (default)
TransModeEnableRSSI:  0b0  ->  Disabled (default)
TransModeFixedTrans:  0b0  ->  Transparent transmission (default)
----------------------------------------

with this code

from machine import Pin
from time import sleep

from lora_e220 import LoRaE220, print_configuration, Configuration
from lora_e220 import logger
from lora_e220_operation_constant import ResponseStatusCode
from machine import UART

# Init Lora
# https://github.com/xreef/EByte_LoRa_E220_micropython_library
uart1 = UART(1)
lora = LoRaE220('900T22D', uart1, aux_pin=7, m0_pin=2, m1_pin=3)
logger.enable_debug = True

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

# read config
code, configuration = lora.get_configuration()
print("Retrieve configuration: {}", ResponseStatusCode.get_description(code))
print_configuration(configuration)

Am I doing something wrong?

xreef commented 1 year ago

Hi, we had discovered that problem in other devices, and It seems that It isn't an EByte device. You can find some additional information here.

https://github.com/xreef/EByte_LoRa_E220_Series_Library/pull/11

Probably I'm going to do a setting also to manage this fake device, and keep in touch. Bye Renzo

HomineLudens commented 1 year ago

It isn't an EByte device.

That's quite odd, as I bought from their "official" store on Aliexpress

The issue you pointed out is mentioning the use of hardware serial to fix the problem, but I suppose the library is already using hardware UART in RP2040 micropython.

Keep me updated if you find a way to fix this, and thanks for the interest.

xreef commented 1 year ago

Hi, finally, I do all the tests with Raspberry Pi Pico (and W) and from this code

from lora_e32 import LoRaE32, print_configuration, Configuration
from lora_e32_operation_constant import ResponseStatusCode
from machine import UART

uart2 = UART(1)

lora = LoRaE32('433T20D', uart2, aux_pin=2, m0_pin=10, m1_pin=11)

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

code, configuration = lora.get_configuration()

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

print_configuration(configuration)

I retrieve


Initialization: {} Success
Retrieve configuration: {} Success
----------------------------------------
HEAD : 0b11000000 192

AddH : 0
AddL : 2
Chan : 23  ->  433

SpeedParityBit    : 0b0  ->  8N1 (Default)
SpeedUARTDatte : 0b11  ->  9600bps (default)
SpeedAirDataRate  : 0b10  ->  2.4kbps (default)
OptionTrans       : 0b1  ->  Fixed transmission (first three bytes can be used a
s high/low address and channel)
OptionPullup      : 0b1  ->  TXD, RXD, AUX are push-pulls/pull-ups (default)    
OptionWakeup      : 0b0  ->  250ms (default)
OptionFEC         : 0b1  ->  Turn on Forward Error Correction Switch (Default)  
OptionPower       : 0b0  ->  20dBm (Default)
----------------------------------------

and for l'E220

  DEBUG  MODE NORMAL!
  DEBUG  AUX HIGH!
  DEBUG  Complete!
Initialization: {} Success
  DEBUG  check_UART_configuration: 1
  DEBUG  MODE PROGRAM!
  DEBUG  AUX HIGH!
  DEBUG  Complete!
  DEBUG  set_mode: 1
  DEBUG  data: b'\xc1\x00\x08\x00\x00b\x00\x17\x03\x00\x00'
  DEBUG  data len: 11
  DEBUG  model: 400T22D
  DEBUG  MODE NORMAL!
  DEBUG  AUX HIGH!
  DEBUG  Complete!
Retrieve configuration: {} Success
----------------------------------------
HEAD :  0xc1   0x0   0x8

AddH :  0x0
AddL :  0x0

Chan :  23  ->  433

SpeedParityBit :  0b0  ->  8N1 (Default)
SpeedUARTDatte :  0b11  ->  9600bps (default)
SpeedAirDataRate :  0b10  ->  2.4kbps (default)

OptionSubPacketSett:  0b0  ->  200bytes (default)
OptionTranPower :  0b0  ->  22dBm (Default)
OptionRSSIAmbientNo:  0b0  ->  Disabled (default)

TransModeWORPeriod :  0b11  ->  2000ms (default)
TransModeEnableLBT :  0b0  ->  Disabled (default)
TransModeEnableRSSI:  0b0  ->  Disabled (default)
TransModeFixedTrans:  0b0  ->  Transparent transmission (default)
----------------------------------------

But pay attention, and you MUST add two pull-up resistors on RaspberryPiPico RX TX, to connect E220, without nothing works.

Bye Renzo

HomineLudens commented 1 year ago

Awesome, can't wait to try it!

xreef commented 1 year ago

Ahhh! I use 4.7k resistor.