<?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[M5Stack + NRF24 = LCD slow down]]></title><description><![CDATA[<p dir="auto">Hi!<br />
I'm using a M5Stack Gray, with a NRF24L01 radio transmitter.</p>
<pre><code>#include &lt;M5Stack.h&gt;
#include &lt;RF24.h&gt;

//------------------------------------- Radio RF24
#define rf24CePin 16
#define rf24CsnPin 17

RF24 RF24(rf24CePin, rf24CsnPin);
</code></pre>
<p dir="auto">As soon as I invoke a RF24 function like RF24.available() or RF24.printDetails(), the LCD display of the M5Stack slows down dramatically.<br />
At the start, the SPI BUS of the M5Stak is at 40mHz (In_eSPI_Setup.h  #define SPI_FREQUENCY  40000000 // Maximum to use SPIFFS), it seems to me that it falls below 1mHz.<br />
Why?</p>
<p dir="auto">Thanks for your help</p>
<p dir="auto">cordially<br />
jpbbricole</p>
]]></description><link>https://community.m5stack.com/topic/1686/m5stack-nrf24-lcd-slow-down</link><generator>RSS for Node</generator><lastBuildDate>Fri, 01 May 2026 09:37:52 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/1686.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 09 Feb 2020 11:19:54 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to M5Stack + NRF24 = LCD slow down on Thu, 13 Feb 2020 08:08:28 GMT]]></title><description><![CDATA[<p dir="auto">Hi world101</p>
<p dir="auto">To make this modification, I determined the speed of the M5Stack by making a program with:</p>
<pre><code>Serial.println (F_CPU)
</code></pre>
<p dir="auto">which gave 24000000</p>
<p dir="auto">Then, I modified the file <strong>..\libraries\RF24-master\RF24.cpp</strong> by adding these lines (who have <strong>// For M5Stack Gray</strong> as a remark)</p>
<pre><code>#if !defined(SOFTSPI)
    _SPI.setBitOrder(MSBFIRST);
    _SPI.setDataMode(SPI_MODE0);
            #if !defined(F_CPU) || F_CPU &lt; 20000000
        _SPI.setClockDivider(SPI_CLOCK_DIV2);
                #elif F_CPU &lt; 40000000
        _SPI.setClockDivider(SPI_CLOCK_DIV4);
                #elif F_CPU &lt; 80000000
        _SPI.setClockDivider(SPI_CLOCK_DIV8);
                #elif F_CPU &lt; 160000000
        _SPI.setClockDivider(SPI_CLOCK_DIV16);
               #elif F_CPU == 240000000                      // For M5Stack Grey
        _SPI.setClockDivider(SPI_CLOCK_DIV2);                // For M5Stack Grey**
                #elif F_CPU &lt; 320000000
        _SPI.setClockDivider(SPI_CLOCK_DIV32);
                #elif F_CPU &lt; 640000000
        _SPI.setClockDivider(SPI_CLOCK_DIV64);
                #elif F_CPU &lt; 1280000000
        _SPI.setClockDivider(SPI_CLOCK_DIV128);
                #else
                    #error "Unsupported CPU frequency. Please set correct SPI divider."
                #endif

            #endif
</code></pre>
<p dir="auto">Regarding the program where I use the RF24, it is very large, I can, if you want, give you an example of use, with several pipes.</p>
<p dir="auto">cordially<br />
jpbbricole</p>
]]></description><link>https://community.m5stack.com/post/7379</link><guid isPermaLink="true">https://community.m5stack.com/post/7379</guid><dc:creator><![CDATA[jpbbricole]]></dc:creator><pubDate>Thu, 13 Feb 2020 08:08:28 GMT</pubDate></item><item><title><![CDATA[Reply to M5Stack + NRF24 = LCD slow down on Tue, 11 Feb 2020 11:27:13 GMT]]></title><description><![CDATA[<p dir="auto">Glad you found the issue. I’m interested in seeing your full code once you have it done. I’m also interested in using the NRF24L01 in a project idea that I have been thinking of.</p>
]]></description><link>https://community.m5stack.com/post/7351</link><guid isPermaLink="true">https://community.m5stack.com/post/7351</guid><dc:creator><![CDATA[world101]]></dc:creator><pubDate>Tue, 11 Feb 2020 11:27:13 GMT</pubDate></item><item><title><![CDATA[Reply to M5Stack + NRF24 = LCD slow down on Tue, 11 Feb 2020 07:36:35 GMT]]></title><description><![CDATA[<p dir="auto">Hi<br />
I found the reason for the slowdown of the LCD display, it's in RF24-master library, file RF24.cpp.</p>
<pre><code>            #elif F_CPU &lt; 320000000
            _SPI.setClockDivider(SPI_CLOCK_DIV32);
</code></pre>
<p dir="auto">As the speed of the M5Stack is 24000000, that divided the frequency of the SPI by 32.<br />
I added</p>
<pre><code>             #elif F_CPU == 240000000                     // For M5Stack Grey
            _SPI.setClockDivider(SPI_CLOCK_DIV2);                // For M5Stack Grey
</code></pre>
<p dir="auto">and the problem is solved.</p>
<p dir="auto">Thanks for reading me</p>
<p dir="auto">cordially<br />
jpbbricole</p>
]]></description><link>https://community.m5stack.com/post/7350</link><guid isPermaLink="true">https://community.m5stack.com/post/7350</guid><dc:creator><![CDATA[jpbbricole]]></dc:creator><pubDate>Tue, 11 Feb 2020 07:36:35 GMT</pubDate></item></channel></rss>