<?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[Check if (and which) SPI devices is connected (NRF24L01 and SX1278 LoRa modules)]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I Have a small arduino atmega 328p based sensor board.<br />
I want too be able to choose which wireless board (NRF24L01 or SX1278) I hard connect to it without reprogramming it, it may be fast and useful for my distance tests.</p>
<p dir="auto">I actually use those libraries separately with success :</p>
<ul>
<li>#include &lt;nRF24L01.h&gt;           // git clone <a href="https://github.com/nRF24" rel="nofollow ugc">https://github.com/nRF24</a></li>
<li>#include &lt;LoRa.h&gt;             // git clone <a href="https://github.com/sandeepmistry/arduino-LoRa.git" rel="nofollow ugc">https://github.com/sandeepmistry/arduino-LoRa.git</a></li>
</ul>
<p dir="auto">The problem is that if I use one library with the matching chip disconnected, when I will initialise it, my atmega will freeze (get stuck and do nothing).<br />
So I wonder how to check if a SPI module is physically connected and how recognize which one it is so I could initialise the corresponding library or simply go to deep sleep.</p>
<p dir="auto">How could I easily do this SPI check?</p>
<p dir="auto">Thanks for reading, sorry for my poor English level :/</p>
]]></description><link>https://forum.mysensors.org/topic/11100/check-if-and-which-spi-devices-is-connected-nrf24l01-and-sx1278-lora-modules</link><generator>RSS for Node</generator><lastBuildDate>Sun, 08 Nov 2026 07:22:39 GMT</lastBuildDate><atom:link href="https://forum.mysensors.org/topic/11100.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 17 Apr 2020 09:37:39 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Check if (and which) SPI devices is connected (NRF24L01 and SX1278 LoRa modules) on Fri, 22 May 2020 19:05:15 GMT]]></title><description><![CDATA[<p dir="auto">Well.. The quick answer I guess would be Yes, it is possible. But I imagine you would need to know a little bit about how the different components work. I also use the LoRa library from Sandeep Mistry and if you take a look at the code that initializes the card you find the following:</p>
<pre><code>  // check version
  uint8_t version = readRegister(REG_VERSION);
  if (version != 0x12) {
    return 0;
  }
</code></pre>
<p dir="auto">Which is using the function readRegister:</p>
<pre><code>uint8_t LoRaClass::readRegister(uint8_t address)
{
  return singleTransfer(address &amp; 0x7f, 0x00);
}
</code></pre>
<p dir="auto">Which is using the function singleTransfer:</p>
<pre><code>uint8_t LoRaClass::singleTransfer(uint8_t address, uint8_t value)
{
  uint8_t response;

  digitalWrite(_ss, LOW);

  _spi-&gt;beginTransaction(_spiSettings);
  _spi-&gt;transfer(address);
  response = _spi-&gt;transfer(value);
  _spi-&gt;endTransaction();

  digitalWrite(_ss, HIGH);

  return response;
}
</code></pre>
<p dir="auto">Which is using pretty simple SPI commands. So perhaps you could do the same and select the LoRa library if the version is 0x12 or else select the nRF library.</p>
<p dir="auto">I don't know if there is enough space on the 328p to load both the libraries? And if you want to use the mysensors library it would be more complicated i suppose..</p>
]]></description><link>https://forum.mysensors.org/post/105745</link><guid isPermaLink="true">https://forum.mysensors.org/post/105745</guid><dc:creator><![CDATA[niclas]]></dc:creator><pubDate>Fri, 22 May 2020 19:05:15 GMT</pubDate></item><item><title><![CDATA[Reply to Check if (and which) SPI devices is connected (NRF24L01 and SX1278 LoRa modules) on Sun, 03 May 2020 15:07:47 GMT]]></title><description><![CDATA[<p dir="auto">Has any other individual thought about utilizing FM/RBDS/RDS for correspondence? I have a task I've been taking a shot at where I have to transmit a smidgen of information in addition to I have to transmit and get voice. I think utilizing the FM band for the voice comm and RBDS/RDS for the information may be perfect however I haven't gotten around to prototyping it yet and I haven't found any reports of individuals who may have attempted it. I notice it is certainly not on this rundown.</p>
]]></description><link>https://forum.mysensors.org/post/105398</link><guid isPermaLink="true">https://forum.mysensors.org/post/105398</guid><dc:creator><![CDATA[refh href]]></dc:creator><pubDate>Sun, 03 May 2020 15:07:47 GMT</pubDate></item></channel></rss>