<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Trying to get this LoRa Module working on Core2]]></title><description><![CDATA[<p dir="auto">/*<br />
After some further trial and error and comparison of what works and what not works.<br />
In this piece of code :</p>
<pre><code>   auto cfg = M5.config();


cfg.serial_baudrate = 115200;
cfg.output_power = true;

M5.begin(cfg);
M5.Power.begin();
M5.Display.startWrite();

</code></pre>
<p dir="auto">The problem starts with M5.Display.startWrite(); If we remove that one, LoRa.begin(LORA_FREQ))  works fine.<br />
So I assume that there is some kind of SPI conflict.<br />
Then the next question is : i need to keep both the startwrite because i use M5Unified and I wnat to connect to the Lora module.</p>
<p dir="auto">Is this info a better pointer to find a solution?<br />
Thanks</p>
<p dir="auto">*/</p>
<p dir="auto">Hi,<br />
We are trying to get this LoRa module : ```<br />
<a href="https://docs.m5stack.com/en/module/lora868" target="_blank" rel="noopener noreferrer nofollow ugc">https://docs.m5stack.com/en/module/lora868</a></p>
<pre><code>working in a M5Core2. We realize that this module is no longer supported. But we have a lot of them operational in the field, and for several reasons we need to upgrade from M5Stack the grey on to M5Core2.
I have included our testing code. We are using the M5_SX127X.h which works great with the M5Stack grey one.
We also updated the pins to the Core2 (when the LoRa module is stcked on the Core 2.
This piece of code tells us that SPI is started:
</code></pre>
<pre><code>if (SPI.begin(LORA_SCLK, LORA_MISO, LORA_MOSI,-1))  // SCK, MISO, MOSI, SS
 { Serial.println("Fine");} else {Serial.println("Not fine");}
</code></pre>
<pre><code>We are not sure about this one : LoRa.setSPIFrequency(300000); // Not sure , we tried different values
also left this out, to no avail.

The software hangs inside this call LoRa.begin(LORA_FREQ) , which looks like the SPI transmission with the LoRa device hangs. But we have no idea. Double checked the pin assignments, we beleive they are correct.

Anyone a suggestion how to get this LoRa module working on an M5Core2?
Thanks


However, 
</code></pre>
<p dir="auto">#include &lt;arduino.h&gt;<br />
#include &lt;M5Unified.h&gt;<br />
#include &lt;SPI.h&gt;<br />
#include "M5_SX127X.h"</p>
<p dir="auto">#include &lt;Wire.h&gt;     //The DHT12 uses I2C comunication.<br />
#include &lt;WiFi.h&gt;<br />
#include &lt;WiFiClient.h&gt;</p>
<p dir="auto">#include &lt;WiFiMulti.h&gt;<br />
#include &lt;HTTPClient.h&gt;</p>
<p dir="auto">#include &lt;EEPROM.h&gt;</p>
<p dir="auto">#define EEPROM_SIZE 1</p>
<p dir="auto">#include &lt;OneWire.h&gt;<br />
#include &lt;DallasTemperature.h&gt;<br />
#define ONE_WIRE_BUS GPIO_NUM_26 //9<br />
OneWire oneWire(ONE_WIRE_BUS);<br />
DallasTemperature sensors(&amp;oneWire);</p>
<p dir="auto">// Module Connect Pins Config<br />
// Core<br />
/*<br />
#define CS_PIN  5<br />
#define RST_PIN 26 //13<br />
#define IRQ_PIN 36 //34</p>
<p dir="auto">#define LORA_MISO 19<br />
#define LORA_MOSI 23<br />
#define LORA_SCLK 18<br />
*/<br />
// Core2<br />
#define CS_PIN  33 //5<br />
#define RST_PIN 25 //26 //13<br />
#define IRQ_PIN 36 //36 //36 //34</p>
<p dir="auto">#define LORA_MISO 38 //19<br />
#define LORA_MOSI 23 //23<br />
#define LORA_SCLK 18 //18</p>
<p dir="auto">// LoRa Parameters Config<br />
// #define LORA_FREQ     433E6<br />
#define LORA_FREQ     868E6<br />
#define LORA_SF       12<br />
#define LORA_BW       125E3<br />
#define LORA_TX_POWER 17</p>
<p dir="auto">/*<br />
// Module Connect Pins Config<br />
#define CS_PIN  5<br />
#define RST_PIN 13<br />
#define IRQ_PIN 34</p>
<p dir="auto">#define LORA_MISO 19<br />
#define LORA_MOSI 23<br />
#define LORA_SCLK 18</p>
<p dir="auto">// LoRa Parameters Config<br />
// #define LORA_FREQ     433E6<br />
#define LORA_FREQ     868E6<br />
#define LORA_SF       12<br />
#define LORA_BW       125E3<br />
#define LORA_TX_POWER 17<br />
*/</p>
<p dir="auto">//****************************       LoRa</p>
<p dir="auto">int packetSize;</p>
<p dir="auto">int        LoRa_Pulse_Count_Max=0; // Om de WindGust te bepalen<br />
int        LoRa_Counter_Cumm=0;<br />
int        LoRa_Windspeed_Counter=0;<br />
float      LoRa_Windspeed_Avg=0;</p>
<p dir="auto">float LoRa_Outside_Temperature;<br />
int   LoRa_Pulse_Count;<br />
float LoRa_Wind_Speed;<br />
float LoRa_WindGust;</p>
<p dir="auto">const int LoRa_Pulse_Array_size= 400; // inschatting<br />
int LoRa_Pulse_Array[LoRa_Pulse_Array_size];</p>
<p dir="auto">const long Ten_Minutes=600000;<br />
long       Next_Ten_Minutes;</p>
<p dir="auto">typedef struct  {<br />
int SecretCode;<br />
int Pulse_Count;<br />
int CallCounter;<br />
//float Current;<br />
//float Voltage;<br />
float tempC;</p>
<p dir="auto">}   LoRa_Receive_struct;<br />
LoRa_Receive_struct LoRa_Receive_Data;</p>
<p dir="auto">//*****************************      End of LoRa</p>
<p dir="auto">void setup() {<br />
Serial.begin(115200);<br />
//pinMode(CS_PIN,OUTPUT);<br />
//pinMode(RST_PIN,OUTPUT);<br />
Serial.println("LoRa Receiver");<br />
if (SPI.begin(LORA_SCLK, LORA_MISO, LORA_MOSI,-1))  // SCK, MISO, MOSI, SS<br />
{ Serial.println("Fine");} else {Serial.println("Not fine");}<br />
LoRa.setSPI(&amp;SPI);<br />
LoRa.setPins(CS_PIN, RST_PIN, IRQ_PIN);  // set CS, reset, IRQ pin<br />
LoRa.setSPIFrequency(300000); // Not sure , we tried different values<br />
while (!LoRa.begin(LORA_FREQ)) {<br />
Serial.println("LoRa init fail.");<br />
delay(1000);<br />
}<br />
Serial.println("Seems okay");</p>
<pre><code>//LoRa.setTxPower(LORA_TX_POWER);
//LoRa.setSignalBandwidth(LORA_BW);
//LoRa.setSpreadingFactor(LORA_SF);
</code></pre>
<p dir="auto">}</p>
<p dir="auto">void loop() {<br />
// try to parse packet<br />
int packetSize = LoRa.parsePacket();<br />
if (packetSize) {<br />
// received a packet<br />
Serial.print("Received packet '");<br />
LoRa.readBytes((uint8_t *)&amp;LoRa_Receive_Data, packetSize);<br />
if (LoRa_Receive_Data.SecretCode==5498)<br />
{</p>
<pre><code>         Serial.print("LoRa :");
         Serial.print(LoRa_Receive_Data.tempC);
         Serial.print("  |  ");
         Serial.println(LoRa_Receive_Data.Pulse_Count);
      }
</code></pre>
<p dir="auto">/*<br />
// read packet<br />
while (LoRa.available()) {<br />
Serial.print((char)LoRa.read());<br />
}<br />
*/<br />
// print RSSI of packet<br />
Serial.print("with RSSI ");<br />
Serial.println(LoRa.packetRssi());<br />
}<br />
}</p>
<pre><code></code></pre>
]]></description><link>https://community.m5stack.com/topic/7831/trying-to-get-this-lora-module-working-on-core2</link><generator>RSS for Node</generator><lastBuildDate>Wed, 29 Apr 2026 09:38:59 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/7831.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 23 Sep 2025 14:29:03 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Trying to get this LoRa Module working on Core2 on Tue, 30 Sep 2025 19:46:20 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/felmue" aria-label="Profile: felmue">@<bdi>felmue</bdi></a> Dear Felix,</p>
<p dir="auto">Actually, we have done nearly the same thing.<br />
We have connected this module: HopeRF RFM95W to the connectors on the back of the Core2. That works great.<br />
We have no idea why the LoRa module does not work with the Core2. Maybe a SPI conflict somewhere deep in the background, maybe a power issue or maybe, and more likely, we are lacking some understanding.<br />
Anyway, we have decided to use a Proto board, solder the LoRa module on it and place that on the backside of the Core2.<br />
We have to do that for 35 devices, but it is fail save.<br />
Thanks for all the effort<br />
Regards</p>
]]></description><link>https://community.m5stack.com/post/30013</link><guid isPermaLink="true">https://community.m5stack.com/post/30013</guid><dc:creator><![CDATA[HappyUser]]></dc:creator><pubDate>Tue, 30 Sep 2025 19:46:20 GMT</pubDate></item><item><title><![CDATA[Reply to Trying to get this LoRa Module working on Core2 on Thu, 25 Sep 2025 20:57:36 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/happyuser" aria-label="Profile: HappyUser">@<bdi>HappyUser</bdi></a></p>
<p dir="auto">I found an SX1276 LoRa in my box of electronics and wired it up to an M5Core2 using the same GPIOs as the LoRa module is using.</p>
<p dir="auto">Then I tested with the stock LoRaReceiver example (adapted to M5Core2) and with some added output to the display successfully. E.g. both LoRa and display worked fine together. You can find my example <a href="https://github.com/felmue/MyM5StackExamples/blob/main/M5Core2/LoRaReceiverWithDisplay/LoRaReceiverWithDisplay.ino" target="_blank" rel="noopener noreferrer nofollow ugc">here</a>.</p>
<p dir="auto">What do you mean by restart? Powering up M5Core2 or pressing the reset button or after uploading new firmware?</p>
<p dir="auto">How are you powering the M5Core2? Maybe there is a power supply issue?</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/30002</link><guid isPermaLink="true">https://community.m5stack.com/post/30002</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Thu, 25 Sep 2025 20:57:36 GMT</pubDate></item><item><title><![CDATA[Reply to Trying to get this LoRa Module working on Core2 on Thu, 25 Sep 2025 11:04:39 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/felmue" aria-label="Profile: felmue">@<bdi>felmue</bdi></a> Thank you.<br />
We are struggling really hard with the M5Unified library. We tried getting things working using startwrite and endwrite at the correct places, and also without using (as you suggested). The problems that we are facing is that sometimes the display lights up after a restart and sometimes it does not. We dont believe it is a faulty device because we se it happening with different M5Core2.</p>
<p dir="auto">We are diving into it. Maybe i will make a new post discribing the problems (and hopefuly solutions) that we are facing with M5Unified.<br />
For now, we dont dare to update our devices in the field because there is no turning back.<br />
Regards</p>
]]></description><link>https://community.m5stack.com/post/30000</link><guid isPermaLink="true">https://community.m5stack.com/post/30000</guid><dc:creator><![CDATA[HappyUser]]></dc:creator><pubDate>Thu, 25 Sep 2025 11:04:39 GMT</pubDate></item><item><title><![CDATA[Reply to Trying to get this LoRa Module working on Core2 on Tue, 23 Sep 2025 18:25:43 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/happyuser" aria-label="Profile: HappyUser">@<bdi>HappyUser</bdi></a></p>
<p dir="auto">you do not need to explicitly call <code>M5.Power.begin()</code> as it is already called from within <code>M5.begin()</code>.</p>
<p dir="auto">Well, as soon as you call <code>M5.Display.startWrite()</code> it will assert the display CS line and occupy the SPI bus for the display until you call <code>M5.Display.endWrite()</code>. In other words, between those two calls the SPI bus can only be used for display updates.</p>
<p dir="auto">Question: why are you calling <code>M5.Display.startWrite()</code> explicitly at all? You should be able to write onto the display by calling <code>M5.Display.println()</code> or similar without first calling <code>M5.Display.startWrite()</code>. Doesn't that work for you?</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/29996</link><guid isPermaLink="true">https://community.m5stack.com/post/29996</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Tue, 23 Sep 2025 18:25:43 GMT</pubDate></item><item><title><![CDATA[Reply to Trying to get this LoRa Module working on Core2 on Tue, 23 Sep 2025 16:00:03 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/felmue" aria-label="Profile: felmue">@<bdi>felmue</bdi></a> Thank you.<br />
Pins are assigned correctly. Double checked.<br />
Not shown but this piece of code</p>
<pre><code>   auto cfg = M5.config();


cfg.serial_baudrate = 115200;
cfg.output_power = true;
cfg.led_brightness=180;
M5.begin(cfg);
M5.Power.begin();```

Handles the power.
Tested out : if we remove M5.Display.startWrite(); then Lora.begin works great. However, we need to startup the display also.
So, I strongly beleive there is some interference with SPI and startWrite(). No idea how.
Regards 

Regards</code></pre>
]]></description><link>https://community.m5stack.com/post/29995</link><guid isPermaLink="true">https://community.m5stack.com/post/29995</guid><dc:creator><![CDATA[HappyUser]]></dc:creator><pubDate>Tue, 23 Sep 2025 16:00:03 GMT</pubDate></item><item><title><![CDATA[Reply to Trying to get this LoRa Module working on Core2 on Tue, 23 Sep 2025 15:34:13 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/happyuser" aria-label="Profile: HappyUser">@<bdi>HappyUser</bdi></a></p>
<p dir="auto">I think you are missing the <code>M5.begin()</code> in <code>setup()</code>. Without that call, the 5 V isn't turned on, e.g. the LoRa module is not powered. (At least on my M5Core2 5 V is not present without the <code>M5.begin()</code> call.)</p>
<p dir="auto">And I think the <code>RST_PIN</code> should be GPIO 26 (as it hasn't changed from M5Core to M5Core2).</p>
<p dir="auto">Note: I do not have this LoRa module so I cannot test myself.</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/29993</link><guid isPermaLink="true">https://community.m5stack.com/post/29993</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Tue, 23 Sep 2025 15:34:13 GMT</pubDate></item></channel></rss>