LoRaE220 Unit

Support the following products:

LoRaE220

Micropython TX Example:

import os, sys, io
import M5
from M5 import *
from unit import LoRaE220JPUnit
import time

lorae220_0 = LoRaE220JPUnit((33, 32))

while True:
    lorae220_0.send(0xFFFF, 0, bytes([0x68, 0x65, 0x6C, 0x6C, 0x6F]))
    time.sleep(1)

Micropython RX Example:

import os, sys, io
from unit import LoRaE220JPUnit

def lorae220_0_receive_event(received_data, rssi):
    print(received_data)

lorae220_0 = LoRaE220JPUnit((15, 13))
lorae220_0.receiveNoneBlock(lorae220_0_receive_event)

UIFLOW2 TX Example:

tx_example.svg

UIFLOW2 RX Example:

rx_example.svg

lora_e220_tx_core2.m5f2

lora_e220_rx_dial.m5f2

Working Mode

Working mode table

Mode (0-3)

M1

M0

Function description

0:Transmission Mode

0

0

SEND: Users can enter data through the serial port, and the module will start wireless transmission.

RECEIVE: The wireless receiving function of the module is enabled, and the wireless data will be output through the TXD pin of the serial port after receiving it.

1:WOR Sending Mode

0

1

SEND: Wirelessly sending data on

RECEIVE: Wireless receiving data on

NOTE: Support Air Wake Up

2:WOR Receiving Mode

1

0

SEND: Wirelessly sending data off

RECEIVE: Wireless receiving data on

NOTE: Support Air Wake Up

3:Configuration Mode

1

1

SEND: Wirelessly sending data off

RECEIVE: Wireless receiving data off

CONFIGURATION: Users can access registers to configure module status

working mode.jpg

class LoRaE220JPUnit

Constructors

class LoRaE220JPUnit(port, port_id=1)

Create a LoRaE220JPUnit object.

The parameters is:
  • port uart pin tuple, which contains: (tx_pin, rx_pin).

  • port_id uart port ID.

UIFLOW2:

init.svg

Methods

LoRaE220JPUnit.setup(own_address=0, own_channel=0, encryption_key=0x2333, air_data_rate=LoRaE220JPUnit.BW500K_SF5, subpacket_size=LoRaE220JPUnit.SUBPACKET_200_BYTE, rssi_ambient_noise_flag=LoRaE220JPUnit.RSSI_AMBIENT_NOISE_DISABLE, transmitting_power=LoRaE220JPUnit.TX_POWER_13dBm, rssi_byte_flag=LoRaE220JPUnit.RSSI_BYTE_DISABLE, transmission_method_type=LoRaE220JPUnit.UART_TT_MODE, wor_cycle=LoRaE220JPUnit.WOR_2000MS) bool

Note

Available when LoRaE220JPUnit working mode is 3. Please refer to working mode table for the working mode.

Set module parameters.

The parameters is:
  • own_address: Local address.

  • own_channel: Native channel.

  • encryption_key: Encryption key.

  • air_data_rate: rate.

  • subpacket_size: Maximum packet length.

  • rssi_ambient_noise_flag: RSSI Ambient Noise.

  • transmitting_power: Transmit power.

  • rssi_byte_flag: Output RSSI strength bytes.

  • transmission_method_type: transmission mode.

  • lbt_flag: Parameter no longer used.

  • wor_cycle: Wireless wake-up time.

UIFLOW2:

setup.svg

LoRaE220JPUnit.receiveNoneBlock(receive_callback: function) None

Deprecated since version 2.0.2: This method is deprecated and will be removed in version 2.0.2.

Note

Available when the working mode of LoRaE220JPUnit is 0 / 1 / 2. Please refer to working mode table for the working mode.

Use non-blocking mode to receive data. receive_callback The callback function passed in will be called when data is received.

The format of receive_callback is:

def receive_callback(data: bytes, rssi: int)

UIFLOW2:

receiveNoneBlock.svg

LoRaE220JPUnit.receive_none_block(receive_callback: function) None

Added in version 2.0.2: This method will be added in version 2.0.2.

Note

Available when the working mode of LoRaE220JPUnit is 0 / 1 / 2. Please refer to working mode table for the working mode.

Use non-blocking mode to receive data. receive_callback The callback function passed in will be called when data is received.

The format of receive_callback is:

def receive_callback(data: bytes, rssi: int)

UIFLOW2:

receiveNoneBlock.svg receive_callback1.svg receive_callback2.svg

LoRaE220JPUnit.stopReceive() None

Deprecated since version 2.0.2: This method is deprecated and will be removed in version 2.0.2.

Note

Available when the working mode of LoRaE220JPUnit is 0 / 1 / 2. Please refer to working mode table for the working mode.

Stop receiving data in non-blocking mode.

UIFLOW2:

stopReceive.svg

LoRaE220JPUnit.stop_receive() None

Added in version 2.0.2: This method will be added in version 2.0.2.

Note

Available when the working mode of LoRaE220JPUnit is 0 / 1 / 2. Please refer to working mode table for the working mode.

Stop receiving data in non-blocking mode.

UIFLOW2:

stopReceive.svg

LoRaE220JPUnit.receive(timeout=1000) tuple[bytes, int]

Note

Available when the working mode of LoRaE220JPUnit is 0 / 1 / 2. Please refer to working mode table for the working mode.

Use blocking method to receive data. timeout is used to set the reception timeout, the unit is ms.

UIFLOW2:

receive.svg

LoRaE220JPUnit.send(target_address: int, target_channel: int, send_data: bytes | str) bool

Note

Available when the working mode of LoRaE220JPUnit is 0 or 1. Please refer to working mode table for the working mode.

Send data to the specified destination address and channel.

The parameters is:

  • target_address Target address, the address range is 0x0000 - 0xFFFF, where 0xFFFF is the broadcast address.

  • target_channel Target channel, valid channel range is 0 - 30.

  • send_data The data needs to be sent.

UIFLOW2:

send1.svg send2.svg send3.svg

Constants

LoRaE220JPUnit.BAUD_1200: int
LoRaE220JPUnit.BAUD_2400: int
LoRaE220JPUnit.BAUD_4800: int
LoRaE220JPUnit.BAUD_9600: int
LoRaE220JPUnit.BAUD_19200: int
LoRaE220JPUnit.BAUD_38400: int
LoRaE220JPUnit.BAUD_57600: int
LoRaE220JPUnit.BAUD_115200: int

baud rate.

LoRaE220JPUnit.BW125K_SF5: int
LoRaE220JPUnit.BW125K_SF6: int
LoRaE220JPUnit.BW125K_SF7: int
LoRaE220JPUnit.BW125K_SF8: int
LoRaE220JPUnit.BW125K_SF9: int
LoRaE220JPUnit.BW250K_SF5: int
LoRaE220JPUnit.BW250K_SF6: int
LoRaE220JPUnit.BW250K_SF7: int
LoRaE220JPUnit.BW250K_SF8: int
LoRaE220JPUnit.BW250K_SF9: int
LoRaE220JPUnit.BW250K_SF10: int
LoRaE220JPUnit.BW500K_SF5: int
LoRaE220JPUnit.BW500K_SF6: int
LoRaE220JPUnit.BW500K_SF7: int
LoRaE220JPUnit.BW500K_SF8: int
LoRaE220JPUnit.BW500K_SF9: int
LoRaE220JPUnit.BW500K_SF10: int
LoRaE220JPUnit.BW500K_SF11: int

rate.

LoRaE220JPUnit.SUBPACKET_200_BYTE: int
LoRaE220JPUnit.SUBPACKET_128_BYTE: int
LoRaE220JPUnit.SUBPACKET_64_BYTE: int
LoRaE220JPUnit.SUBPACKET_32_BYTE: int

Maximum packet length.

LoRaE220JPUnit.RSSI_AMBIENT_NOISE_ENABLE: int
LoRaE220JPUnit.RSSI_AMBIENT_NOISE_DISABLE: int

RSSI ambient noise.

LoRaE220JPUnit.TX_POWER_13dBm: int
LoRaE220JPUnit.TX_POWER_12dBm: int
LoRaE220JPUnit.TX_POWER_7dBm: int
LoRaE220JPUnit.TX_POWER_0dBm: int

Transmit power.

LoRaE220JPUnit.RSSI_BYTE_ENABLE: int
LoRaE220JPUnit.RSSI_BYTE_DISABLE: int

RSSI bytes. When enabled, the module will append a byte of RSSI value after the data each time it receives data.

LoRaE220JPUnit.UART_TT_MODE: int
LoRaE220JPUnit.UART_P2P_MODE: int

transmission mode.

LoRaE220JPUnit.WOR_500MS: int
LoRaE220JPUnit.WOR_1000MS: int
LoRaE220JPUnit.WOR_1500MS: int
LoRaE220JPUnit.WOR_2000MS: int
LoRaE220JPUnit.WOR_2500MS: int
LoRaE220JPUnit.WOR_3000MS: int

Wireless wake-up time.