- The M5Stack LoRa is using Sandeep drivers (polling) whereas RadioHead drivers use interrupts.
- The M5Stack LoRa board has IRQ/RST reversed! IRQ DIO0 is actually connected to GPIO26. RST is actually connected to GPIO36, but is useless since GPIO36 is input only.
- The M5Stack display shares NSS on GPIO5; LoRa needs to be put to sleep when updating display. (Mutex likely needed in FreeRTOS)
- SemTech SX1276/77/78/79 == HopeRF RFM95/96/97/98 (almost exactly the same pages!)
- Various links on Lora, installing libraries, etc
When considering performance, be sure to check out this excellent YouTube video: #182 ESP32 Lora Boards: What you need to know before you buy (incl. Antenna knowledge) - thanks Mark West @TheFlyingZephy for pointing this out)
There are a variety of LoRa libraries:
- Sandeep Mistry similar to that used in M5Stack fork (specifically here)
- RadioHead: RadioHead Packet Radio library for embedded microprocessors specifically RH_RF95
- Matthijs Kooijman IBM LMIC (LoraMAC-in-C) library, adapted to run under the Arduino environment
Plus this interesting LoRa.py gist
My LoRa32u4 is using the RadioHead libraries; The M5Stack uses a slightly modified Sandeep library. A pair of LoRa32u4 units work great. A LoRa32u4 sending to M5Stack - not so great. So I'm attempting to use the RadioHead library with the M5Stack.
To install M5Stack library with ability to save in GitHub and submit pull requests. First fork the project to your own GitHub repository. Then clone it to your Arduino library (in my case, gojimmypi user)
cd C:\Users\gojimmypi\Documents\Arduino\libraries\ git clone https://github.com/gojimmypi/M5Stack.git :: optionally get RadioHead drivers from Adafruit :: ren RadioHead RadioHead-stockgit clone https://github.com/gojimmypi/RadioHead.git
cd C:\Users\gojimmypi\Documents\Arduino\libraries\ mkdir temp-adafruit cd temp-adafruit git clone https://github.com/adafruit/RadioHead.git cd RadioHead xcopy *.* ..\..\RadioHead\*.* /s /d :: reminder to delete temp-adafruit
In my case, after the fork from Adafruit, I deleted everything (except hidden .git directory, of course) and copied back the contents of the RadioHead-stock directory so we could use Visual Studio diff (right-click, Compare with Unmodified). Not unexpected, the RadioHead I had was older. So I fetched the Adafruit into a temp directory, then copied it back:
See https://github.com/gojimmypi/RadioHead/tree/M5Stack (this is the branch with my active edits for M5Stack LoRa)
I've created a branch to submit changes back to the RadioHead master. Note that for contributions, special instructions are needed since they are not using GitHub. I also have a PR back to Adafruit.
Visual Studio users will be happy to know there's a feature to use File Explorer; right click on the directory and select "open in Visual Studio". With the GitHub extension installed, there's a very nice GUI for GitHub.
I have yet to figure out branch-to-branch compares on GitHub and have opened this issue .
To add the RadioHead libraries to an M5 Stack project: vMicro - Add Library - User - RadioHead:
After spending a ton of time trying to get the RadioHead drivers working, first I found that that M5Stack base I was using had completely inoperable GPIO35 and GPIO36 pins. After swapping that out for a new one... and even more time spent trying to get RadioHead drivers working - I discovered another WIRING problem. <sigh> Connections to GPIO26 and GPIO36 are reversed! Not all coding problems are based solely in software.
Here's the corrected M5Stack LoRa pinout diagram:
Note that the RST (reset) input to the RA-02 LoRa device won't actually reset, as GPIO36 is input only!
Many thanks to Jimmy Lai at M5Stack for sending me a prototype of their next version of LoRa. Looking forward to my next gizmo in the mail :)
So now that I actually have the RadioHead drivers working with the M5Stack... now on to actual performance testing in my next blog .
Resources, Inspiration, Credits, and Other Links:
- #112 LoRa / LoRaWAN De-Mystified / Tutorial
- ESP32 - LoRa - OLED Module | Hackaday.io
- TTGO V2 LoRa
- Low Cost LoRa gateway
- WeMos Lora RFM9x Gateway Shield (see LoRa Gateway with ESP8266 and a RFM95)
- #169 LoRa one-to-one Connection for a Mailbox Notifier with an Arduino and a Wemos Shield
- Time Library https://github.com/PaulStoffregen/Time
- Siglent SSA3021X Spectrum Analyzer 9 kHz to 2.1 GHz
- Application Note: LoRa® Modulation Crystal Oscillator Guidance
- return loss vs. VSWR
- Adafruit Feather 32u4 with LoRa Radio Module
- Understanding RSSI
Copyright (c) gojimmypi all rights reserved. Blogger Image Move Cleaned: 5/3/2021 1:35:53 PM