<?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[SPI clash between LCD and nRF24L01]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">Created a protoboard with a nRF24L01 board on it which uses SPI.</p>
<p dir="auto">RF24 board is close to 100% successful before I include the M5Stack library, now it it's maybe 3% successful. When I "disable" the LCD and TFCard (by conditionally removing the code in the M5Stack library) then the RF24 is good again.</p>
<p dir="auto">I'm wondering if the LCD is "locking" the SPI bus?</p>
<p dir="auto">I am running the SPI devices in parallel and have set the RF24 CS/CE pins to GPIO5 and GPIO17.</p>
<p dir="auto">Any ideas? Thanks! ... love your stuff!</p>
]]></description><link>https://community.m5stack.com/topic/72/spi-clash-between-lcd-and-nrf24l01</link><generator>RSS for Node</generator><lastBuildDate>Mon, 09 Mar 2026 17:47:31 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/72.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 14 Jan 2018 16:57:51 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to SPI clash between LCD and nRF24L01 on Tue, 12 Jun 2018 15:33:32 GMT]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">thank you for your reply. I'v tried to only use the CS pin and it works, but... yes, there is always a but :-) the results are not very accurate. From the moment a set a brightness in the screen, the values of the temperatures grows.</p>
<p dir="auto">I try to read the temp in a separate task, but it didn't change anything.</p>
<p dir="auto">Here is my code</p>
<pre><code>#include "Adafruit_MAX31855.h"
#include &lt;SPI.h&gt;
#include &lt;M5Stack.h&gt;

// Example creating a thermocouple instance with software SPI on any three
// digital IO pins.
#define MAXCS   17

Adafruit_MAX31855 thermocouple(MAXCS);

void task1(void * pvParameters) {
  for (;;) {
    float avg = 0;

    /* Read nbReadToAvg times to make an average of the temp */
    for (int i = 0; i &lt; nbReadToAvg; i++) {
      float c = thermocouple.readCelsius();
      avg = avg + c;
      delay(100);
    }

    avg = avg / nbReadToAvg;
    Serial.println(avg);
  }
}


void setup() {

  Serial.begin(115200);
  Serial.print("MOSI=");
  Serial.println(MOSI);
  Serial.print("MISO=");
  Serial.println(MISO);
  Serial.print("SCK=");
  Serial.println(SCK);
  Serial.print("SS=");
  Serial.println(SS);

  thermocouple.begin();
  
  Serial.print("Internal Temp = ");
  Serial.println(thermocouple.readInternal());

  while (!Serial) delay(1); // wait for Serial on Leonardo/Zero, etc

  Serial.println("MAX31855 Initializing ...");

  //  M5.Lcd.setTextColor(WHITE, BLACK);

  // wait for MAX chip to stabilize
  delay(1000);

  xTaskCreatePinnedToCore(
    task1,
    "task1",
    4096,
    NULL,
    1,
    NULL,
    0
  );

  Serial.println("M5 begin without LCD");
  M5.begin(false, false);
  delay(10000);
  Serial.println("LCD Start");
  M5.Lcd.begin();
  for(int j=0;j&lt;100;j++) {
    //Serial.printf("Brigthness=%d\n", j);
    M5.Lcd.setBrightness(j);
    delay(200);
  }
  //delay(10000);
  Serial.println("LCD Shutdown set Brightness to 20");
  M5.Lcd.setBrightness(10);
  //M5.Lcd.sleep();
  M5.Lcd.setTextSize(4);
  M5.Lcd.print("test");
  M5.update();
}

void loop() {

}
</code></pre>
<p dir="auto">And here is the result :</p>
<pre><code>20.27
20.50
20.35
20.45
20.27
18.52
20.12
20.58
20.42
LCD Start
20.27
18.60
21.55
22.73
21.58
21.77
21.98
20.87
21.40
22.40
21.65
23.60
23.40
24.02
24.48
24.62
24.55
29.67
26.83
25.52
29.15
LCD Shutdown set Brightness to 20
23.48
22.27
22.15
21.50
22.92
20.50
21.67
22.60
21.92
22.12
22.42
</code></pre>
<p dir="auto">Why can see that between the line LCD start and the LCD shutdown, the temperature grows and that why the brightness of the screen is increasing. After the line "LCD Shutdown" the brightness is set to 20 and the value are higher that the values at the beginning but they don't moved.</p>
]]></description><link>https://community.m5stack.com/post/1066</link><guid isPermaLink="true">https://community.m5stack.com/post/1066</guid><dc:creator><![CDATA[sibtcha]]></dc:creator><pubDate>Tue, 12 Jun 2018 15:33:32 GMT</pubDate></item><item><title><![CDATA[Reply to SPI clash between LCD and nRF24L01 on Mon, 28 May 2018 14:22:15 GMT]]></title><description><![CDATA[<p dir="auto">Phisically connect Your MAX to SPI lines and CS leave connected as is!<br />
M5Stack pinout:<br />
<a href="https://github.com/m5stack/M5Stack#pinout" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/m5stack/M5Stack#pinout</a></p>
<p dir="auto">MAX DO -&gt; M5Stack MISO (GPIO19)<br />
MAX CS -&gt; M5Stack GPIO17<br />
MAX CLK -&gt; M5Stack CLK (GPIO18)</p>
<p dir="auto">Looks like You have connection prepared corectly...</p>
<p dir="auto">Change only Your sketch like this:</p>
<pre><code>#include &lt;SPI.h&gt;
#include &lt;Adafruit_MAX31855.h&gt;
//#include &lt;M5Stack.h&gt;

// Example creating a thermocouple instance with software SPI on any three digital IO pins.
//#define MAXDO   19
//#define MAXCLK  18
#define MAXCS   17

Adafruit_MAX31855 thermocouple(MAXCS);

void setup() {
  //M5.begin();
  Serial.begin(115200);
  Serial.print("Internal Temp = ");
  Serial.println(thermocouple.readInternal());
  
  while (!Serial) delay(1); // wait for Serial on Leonardo/Zero, etc
  
  Serial.println("MAX31855 test");

  thermocouple.begin();

  // wait for MAX chip to stabilize
  delay(2000);
}

void loop() {

  // basic readout test, just print the current temp
  Serial.print("Internal Temp = ");
  Serial.println(thermocouple.readInternal());
  
  double c = thermocouple.readCelsius();
  if (isnan(c)) {
    Serial.println("Something wrong with thermocouple!");
  } else {
    Serial.print("C = ");
    Serial.println(c);
  }
 
  delay(1000);

  //M5.update();
}
</code></pre>
]]></description><link>https://community.m5stack.com/post/1017</link><guid isPermaLink="true">https://community.m5stack.com/post/1017</guid><dc:creator><![CDATA[reaper7]]></dc:creator><pubDate>Mon, 28 May 2018 14:22:15 GMT</pubDate></item><item><title><![CDATA[Reply to SPI clash between LCD and nRF24L01 on Mon, 28 May 2018 13:27:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/160">@reaper7</a> 在 <a href="/post/1013">SPI clash between LCD and nRF24L01</a> 中说：</p>
<blockquote>
<p dir="auto">thermocouple.begin();</p>
</blockquote>
<p dir="auto">Thank you for the reply.</p>
<p dir="auto">Wich pin do you think I have to use for the CS ? No matter wich one ? In the MAX31855 I've 5 pins</p>
<ul>
<li>GND</li>
<li>VCC (3v3)</li>
<li>DO</li>
<li>CS</li>
<li>CLK</li>
</ul>
<p dir="auto">If I only initialize the object with the CS, what must I do with the other pins (DO and CLK) ?</p>
<p dir="auto">Sorry for this question, but I'm a begginer</p>
]]></description><link>https://community.m5stack.com/post/1015</link><guid isPermaLink="true">https://community.m5stack.com/post/1015</guid><dc:creator><![CDATA[sibtcha]]></dc:creator><pubDate>Mon, 28 May 2018 13:27:54 GMT</pubDate></item><item><title><![CDATA[Reply to SPI clash between LCD and nRF24L01 on Mon, 28 May 2018 12:15:09 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/395">@sibtcha</a> , try to initialize Adafruit_MAX31855 library only with <strong>CS</strong> pin:</p>
<pre><code>Adafruit_MAX31855 thermocouple(MAXCS);
</code></pre>
<p dir="auto">as You see at library source: <a href="https://github.com/adafruit/Adafruit-MAX31855-library/blob/master/Adafruit_MAX31855.cpp" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/adafruit/Adafruit-MAX31855-library/blob/master/Adafruit_MAX31855.cpp</a><br />
when You declare SPI CLK line then library try read this device by software SPI implementation!</p>
<p dir="auto">also You are forgot <strong>thermocouple.begin();</strong></p>
]]></description><link>https://community.m5stack.com/post/1013</link><guid isPermaLink="true">https://community.m5stack.com/post/1013</guid><dc:creator><![CDATA[reaper7]]></dc:creator><pubDate>Mon, 28 May 2018 12:15:09 GMT</pubDate></item><item><title><![CDATA[Reply to SPI clash between LCD and nRF24L01 on Mon, 28 May 2018 11:54:16 GMT]]></title><description><![CDATA[<p dir="auto">Thank you @JimiT</p>
<p dir="auto">Indeed I forgot to include the SPI lib, but unfortunetaly the result isn't good. The values jump between positive and negastives and I do nothing.</p>
<pre><code>Internal Temp = 68.12
Something wrong with thermocouple!
Internal Temp = -111.87
Something wrong with thermocouple!
Internal Temp = 33.75
Something wrong with thermocouple!
Internal Temp = -120.00
C = 1548.50
Internal Temp = 32.63
C = 530.00
Internal Temp = 33.56
Something wrong with thermocouple!
</code></pre>
]]></description><link>https://community.m5stack.com/post/1012</link><guid isPermaLink="true">https://community.m5stack.com/post/1012</guid><dc:creator><![CDATA[sibtcha]]></dc:creator><pubDate>Mon, 28 May 2018 11:54:16 GMT</pubDate></item><item><title><![CDATA[Reply to SPI clash between LCD and nRF24L01 on Fri, 25 May 2018 21:48:52 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/395">@sibtcha</a>  At the very top of the code it should have:</p>
<pre><code>#include &lt;SPI.h&gt;
</code></pre>
<p dir="auto">That file should already be on your system if you followed standard setup for the M5Stack - it should be located in:</p>
<p dir="auto">C:\Users\YOUR USER NAME\Documents\Arduino\hardware\espressif\esp32\libraries\SPI\src</p>
<p dir="auto">Perhaps give that a try with the M5Stack commands enabled.</p>
<p dir="auto">Further tweaks may be required....</p>
]]></description><link>https://community.m5stack.com/post/1011</link><guid isPermaLink="true">https://community.m5stack.com/post/1011</guid><dc:creator><![CDATA[JJ]]></dc:creator><pubDate>Fri, 25 May 2018 21:48:52 GMT</pubDate></item><item><title><![CDATA[Reply to SPI clash between LCD and nRF24L01 on Fri, 25 May 2018 11:38:03 GMT]]></title><description><![CDATA[<p dir="auto">@JimiT You're right. Here is my code and the result when M5 lib is included or not</p>
<pre><code>#include &lt;Adafruit_MAX31855.h&gt;
//#include &lt;M5Stack.h&gt;

// Example creating a thermocouple instance with software SPI on any three digital IO pins.
#define MAXDO   19
#define MAXCS   17
#define MAXCLK  18

Adafruit_MAX31855 thermocouple(MAXCLK, MAXCS, MAXDO);

void setup() {
  //M5.begin();
  Serial.begin(115200);
  Serial.print("Internal Temp = ");
  Serial.println(thermocouple.readInternal());
  
  while (!Serial) delay(1); // wait for Serial on Leonardo/Zero, etc
  
  Serial.println("MAX31855 test");

  // wait for MAX chip to stabilize
  delay(2000);
}

void loop() {

  // basic readout test, just print the current temp
  Serial.print("Internal Temp = ");
  Serial.println(thermocouple.readInternal());
  
  double c = thermocouple.readCelsius();
  if (isnan(c)) {
    Serial.println("Something wrong with thermocouple!");
  } else {
    Serial.print("C = ");
    Serial.println(c);
  }
 
  delay(1000);

  //M5.update();
}
</code></pre>
<p dir="auto">And the result is</p>
<pre><code>Internal Temp = 32.50
C = 17.25
Internal Temp = 32.56
C = 15.25
Internal Temp = 32.56
C = 18.25
Internal Temp = 32.50
C = 16.50
Internal Temp = 32.56
C = 17.25
Internal Temp = 32.63
C = 18.50
Internal Temp = 32.56
C = 18.25
Internal Temp = 32.63
</code></pre>
<p dir="auto">But if I uncomment the line 3 lines to include M5 to the projet, the result is:</p>
<pre><code>Internal Temp = 0.00
C = 0.00
Internal Temp = 0.00
C = 0.00
Internal Temp = 0.00
C = 0.00
Internal Temp = 0.00
C = 0.00
Internal Temp = 0.00
C = 0.00
Internal Temp = 0.00
C = 0.00
</code></pre>
<p dir="auto">I think is something about the SPI, but I'm not sure. I try to use other pins but unfortunately unsucessfully</p>
]]></description><link>https://community.m5stack.com/post/1010</link><guid isPermaLink="true">https://community.m5stack.com/post/1010</guid><dc:creator><![CDATA[sibtcha]]></dc:creator><pubDate>Fri, 25 May 2018 11:38:03 GMT</pubDate></item><item><title><![CDATA[Reply to SPI clash between LCD and nRF24L01 on Fri, 25 May 2018 10:21:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/395">@sibtcha</a> Hi Sibtcha,<br />
I haven't tried using a thermocouple with the M5Stack..... I don't think Skelstar has been here in a while....  Perhaps post your code... someone may notice a problem.</p>
]]></description><link>https://community.m5stack.com/post/1007</link><guid isPermaLink="true">https://community.m5stack.com/post/1007</guid><dc:creator><![CDATA[JJ]]></dc:creator><pubDate>Fri, 25 May 2018 10:21:53 GMT</pubDate></item><item><title><![CDATA[Reply to SPI clash between LCD and nRF24L01 on Thu, 24 May 2018 11:30:02 GMT]]></title><description><![CDATA[<p dir="auto">Hello, It seems like I have a problem similaire has yours... I would like to use à MAX6675 to get temperature from a Thermocouple K, but this board use SPI.</p>
<p dir="auto">When I test my code in a ESP32, it's OK. When I test my code in the M5Stack without the M5.begin(), it's ok, but when I include de M5.begin, the value returned by the MAX6675 are 0</p>
<p dir="auto">Is there any solution ?</p>
]]></description><link>https://community.m5stack.com/post/1004</link><guid isPermaLink="true">https://community.m5stack.com/post/1004</guid><dc:creator><![CDATA[sibtcha]]></dc:creator><pubDate>Thu, 24 May 2018 11:30:02 GMT</pubDate></item><item><title><![CDATA[Reply to SPI clash between LCD and nRF24L01 on Wed, 17 Jan 2018 00:24:21 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/1">@m5stack</a> any ideas about this? I shouldn't have any issues using other devices that use SPI should I?</p>
<p dir="auto">Thanks!</p>
]]></description><link>https://community.m5stack.com/post/199</link><guid isPermaLink="true">https://community.m5stack.com/post/199</guid><dc:creator><![CDATA[skelstar]]></dc:creator><pubDate>Wed, 17 Jan 2018 00:24:21 GMT</pubDate></item><item><title><![CDATA[Reply to SPI clash between LCD and nRF24L01 on Mon, 15 Jan 2018 17:26:56 GMT]]></title><description><![CDATA[<p dir="auto">For what it's worth commenting out the two lines in the post above didn't fix it. I also tried writing LOW to LCD_CS (before writing) then HIGH to disable (after writing) and that did not fix it either.</p>
<p dir="auto">Going to try using a different LCD library.</p>
]]></description><link>https://community.m5stack.com/post/189</link><guid isPermaLink="true">https://community.m5stack.com/post/189</guid><dc:creator><![CDATA[skelstar]]></dc:creator><pubDate>Mon, 15 Jan 2018 17:26:56 GMT</pubDate></item><item><title><![CDATA[Reply to SPI clash between LCD and nRF24L01 on Sun, 14 Jan 2018 22:31:10 GMT]]></title><description><![CDATA[<p dir="auto">Ah, I think I got it. Guessing it's going to be related to this line (in /src/utility/Display.h): <a href="https://github.com/m5stack/M5Stack/blob/fdedf5fd901963068a0ec6a4b2270c239a21b29e/src/utility/Display.h#L60" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/m5stack/M5Stack/blob/fdedf5fd901963068a0ec6a4b2270c239a21b29e/src/utility/Display.h#L60</a></p>
<p dir="auto">Should get back to work... looking forward to having a hack tonight :)</p>
]]></description><link>https://community.m5stack.com/post/186</link><guid isPermaLink="true">https://community.m5stack.com/post/186</guid><dc:creator><![CDATA[skelstar]]></dc:creator><pubDate>Sun, 14 Jan 2018 22:31:10 GMT</pubDate></item><item><title><![CDATA[Reply to SPI clash between LCD and nRF24L01 on Sun, 14 Jan 2018 21:33:07 GMT]]></title><description><![CDATA[<p dir="auto">Been reading some of the issues in the RF24.h git repo and someone is having similar-ish issues. It was suggested that I write the LCD CS high (disable) high before using the RF24, then write the LCD CS pin low again (or maybe write LCD CS low-high when I want to update the LCD display).</p>
<p dir="auto">I should also point out that the M5Stack device is the master, and the slave <em>is</em> receiving the data ok, the M5Stack device is just not getting the ACK/getting the reply.</p>
]]></description><link>https://community.m5stack.com/post/185</link><guid isPermaLink="true">https://community.m5stack.com/post/185</guid><dc:creator><![CDATA[skelstar]]></dc:creator><pubDate>Sun, 14 Jan 2018 21:33:07 GMT</pubDate></item></channel></rss>