SX127x (LoRa transceiver) driver for (Micro)Python on ESP8266/ESP32/Raspberry_Pi

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
User avatar
Wei Lin
Posts: 19
Joined: Sat Jan 21, 2017 1:07 pm

Re: SX127x (LoRa transceiver) driver for (Micro)Python on ESP8266/ESP32/Raspberry_Pi

Post by Wei Lin » Wed Dec 25, 2019 8:10 am

mczubel wrote:
Thu Dec 19, 2019 7:01 pm
Wei Lin wrote:
Wed Feb 06, 2019 10:01 pm
The error message means that the SPI communication failed. Sometimes it fails after h/w reset until s/w reset.
I have no oscilloscope hence not sure why it is so.
Hi
I have the same error after deepsleep wake up.
First time work perfect, but after wakeup reset this error appears.
thank
That may concern two issues:

1. after reset:
https://github.com/Wei1234c/SX127x_driv ... /issues/14

2. power supply:
please see the post above by kurt at Fri Feb 08, 2019 1:08 am
viewtopic.php?f=16&t=3871#p33923

bluesky007
Posts: 3
Joined: Wed Apr 07, 2021 1:46 pm

Re: SX127x (LoRa transceiver) driver for (Micro)Python on ESP8266/ESP32/Raspberry_Pi

Post by bluesky007 » Thu Apr 08, 2021 6:27 pm

Hi,
Last edited by bluesky007 on Sat Apr 10, 2021 6:22 pm, edited 1 time in total.

User avatar
Wei Lin
Posts: 19
Joined: Sat Jan 21, 2017 1:07 pm

Re: SX127x (LoRa transceiver) driver for (Micro)Python on ESP8266/ESP32/Raspberry_Pi

Post by Wei Lin » Thu Apr 08, 2021 8:07 pm

Hi,

No, I have no connection with MAKERFABS company.

Regards.

Wei
Last edited by Wei Lin on Sat Apr 10, 2021 1:11 pm, edited 1 time in total.

kodsi
Posts: 2
Joined: Mon Jan 10, 2022 7:27 pm

Re: SX127x (LoRa transceiver) driver for (Micro)Python on ESP8266/ESP32/Raspberry_Pi

Post by kodsi » Mon Jan 10, 2022 7:32 pm

Hello,

I had the same problem with esp32 Heltec board, running micropython 1.17.
Fixed it by calling machine.SoftSPI instead of machine.SPI in the first argument of the SX127x class constructor(SPI is deprectated)

Code: Select all

device_spi = machine.SoftSPI(baudrate = 10000000,
        polarity = 0, phase = 0, bits = 8, firstbit = machine.SPI.MSB,
        sck = machine.Pin(device_config['sck'], machine.Pin.OUT, machine.Pin.PULL_DOWN),
        mosi = machine.Pin(device_config['mosi'],machine.Pin.OUT, machine.Pin.PULL_UP),
        miso = machine.Pin(device_config['miso'], machine.Pin.IN, machine.Pin.PULL_UP))

lora = SX127x(device_spi, pins=device_config, parameters=lora_parameters)
I hope this helps,
cheers

dawgshalmer
Posts: 2
Joined: Wed Jan 12, 2022 3:54 am

Re: SX127x (LoRa transceiver) driver for (Micro)Python on ESP8266/ESP32/Raspberry_Pi

Post by dawgshalmer » Wed Jan 12, 2022 3:57 am

kodsi wrote:
Mon Jan 10, 2022 7:32 pm
Hello,

I had the same problem with esp32 Heltec board, running micropython 1.17.
Fixed it by calling machine.SoftSPI instead of machine.SPI in the first argument of the SX127x class constructor(SPI is deprectated)

Code: Select all

device_spi = machine.SoftSPI(baudrate = 10000000,
        polarity = 0, phase = 0, bits = 8, firstbit = machine.SPI.MSB,
        sck = machine.Pin(device_config['sck'], machine.Pin.OUT, machine.Pin.PULL_DOWN),
        mosi = machine.Pin(device_config['mosi'],machine.Pin.OUT, machine.Pin.PULL_UP),
        miso = machine.Pin(device_config['miso'], machine.Pin.IN, machine.Pin.PULL_UP))

lora = SX127x(device_spi, pins=device_config, parameters=lora_parameters)
I hope this helps,
cheers
Could you share the device_config and lora_parameters objects that you passed into this to make this work? I have the same board and there is scant documentation for anything.

kodsi
Posts: 2
Joined: Mon Jan 10, 2022 7:27 pm

Re: SX127x (LoRa transceiver) driver for (Micro)Python on ESP8266/ESP32/Raspberry_Pi

Post by kodsi » Wed Jan 12, 2022 8:51 am

dawgshalmer wrote:
Wed Jan 12, 2022 3:57 am
kodsi wrote:
Mon Jan 10, 2022 7:32 pm
Hello,

I had the same problem with esp32 Heltec board, running micropython 1.17.
Fixed it by calling machine.SoftSPI instead of machine.SPI in the first argument of the SX127x class constructor(SPI is deprectated)

Code: Select all

device_spi = machine.SoftSPI(baudrate = 10000000,
        polarity = 0, phase = 0, bits = 8, firstbit = machine.SPI.MSB,
        sck = machine.Pin(device_config['sck'], machine.Pin.OUT, machine.Pin.PULL_DOWN),
        mosi = machine.Pin(device_config['mosi'],machine.Pin.OUT, machine.Pin.PULL_UP),
        miso = machine.Pin(device_config['miso'], machine.Pin.IN, machine.Pin.PULL_UP))

lora = SX127x(device_spi, pins=device_config, parameters=lora_parameters)
I hope this helps,
cheers
Could you share the device_config and lora_parameters objects that you passed into this to make this work? I have the same board and there is scant documentation for anything.
lora_parameters = {
'address': 1,
'frequency': 868E6,
'tx_power_level': 2,
'signal_bandwidth': 125E3,
'spreading_factor': 8,
'coding_rate': 5,
'preamble_length': 8,
'implicit_header': False,
'sync_word': 0x12,
'enable_CRC': False,
'invert_IQ': False,
}

dawgshalmer
Posts: 2
Joined: Wed Jan 12, 2022 3:54 am

Re: SX127x (LoRa transceiver) driver for (Micro)Python on ESP8266/ESP32/Raspberry_Pi

Post by dawgshalmer » Fri Jan 14, 2022 7:49 am

kodsi wrote:
Wed Jan 12, 2022 8:51 am
dawgshalmer wrote:
Wed Jan 12, 2022 3:57 am
kodsi wrote:
Mon Jan 10, 2022 7:32 pm
Hello,

I had the same problem with esp32 Heltec board, running micropython 1.17.
Fixed it by calling machine.SoftSPI instead of machine.SPI in the first argument of the SX127x class constructor(SPI is deprectated)

Code: Select all

device_spi = machine.SoftSPI(baudrate = 10000000,
        polarity = 0, phase = 0, bits = 8, firstbit = machine.SPI.MSB,
        sck = machine.Pin(device_config['sck'], machine.Pin.OUT, machine.Pin.PULL_DOWN),
        mosi = machine.Pin(device_config['mosi'],machine.Pin.OUT, machine.Pin.PULL_UP),
        miso = machine.Pin(device_config['miso'], machine.Pin.IN, machine.Pin.PULL_UP))

lora = SX127x(device_spi, pins=device_config, parameters=lora_parameters)
I hope this helps,
cheers
Could you share the device_config and lora_parameters objects that you passed into this to make this work? I have the same board and there is scant documentation for anything.
lora_parameters = {
'address': 1,
'frequency': 868E6,
'tx_power_level': 2,
'signal_bandwidth': 125E3,
'spreading_factor': 8,
'coding_rate': 5,
'preamble_length': 8,
'implicit_header': False,
'sync_word': 0x12,
'enable_CRC': False,
'invert_IQ': False,
}
Thanks!

Post Reply