I have bought 2 Arduino Giga R1, 2 nRF24L01+ modules and 2 nRF24L01+ adapters. I am using the Arduino SPI in order to connect it with nRF24L01+. And I am using the following code with this change in the code only:
RF24 radio(7, 10); // CE, CSN
This is the Arduino GIGA R1 SPI documentation, and this is the nRF24L01+ modules, and the related adapter (the links of the modules are from a random Google search, just to show you the images + the documentation of the modules).
However I don't see something working. I added the following command both in the Receiver and Transmitter codes:
SPI.begin();
SPI1.begin();
in order to activate both SPI of each Arduino, because I don't know which is which. The result: Nothing works on Arduino GIGA R1... The same code above works fine on Arduino MEGA 2560 R3, so all the modules and the code are fine. The problem is on Arduino GIGA R1...
I supply the nRF24L01+ and the related adapters with 5V/1.5A power supply. I supply each Arduino GIGA R1 with 5V/1.5A power supply.
I have also tried this code, and I got this message:
We have lost connection, preventing unwanted behavior
Does anyone has any idea how to make the 2 Arduino GIGA R1 communicate via the nRF24L01+ link?
-
please no links to code and no pictures of code ... copy your code and paste it into your question ... format as codejsotola– jsotola10/23/2023 21:59:06Commented Oct 23, 2023 at 21:59
-
I cannot copy paste code from other sites. There are terms of use in every website. It is not my code...greg– greg10/24/2023 09:59:42Commented Oct 24, 2023 at 9:59
-
then how do you know that the code has no errors?jsotola– jsotola10/24/2023 15:13:35Commented Oct 24, 2023 at 15:13
-
It runs if I use Arduino MEGA 2560 R3 instead of Arduino GIGA R1.greg– greg10/24/2023 17:30:26Commented Oct 24, 2023 at 17:30
2 Answers 2
Not sure if you found a solution but I had a similar problem and found a solution, which may work for you.
As you know, the Giga has two SPI buses. The default are the ones on the ICSP header, the second one is on pins 11-13.
The NRF24L01, by default, assumes that you want to use the default one - SPI in this case. If you want to use the other one (SPI1), all you need to do is call begin on SPI1 and pass that to the NRF begin function, as follows:
SPI1.begin();
radio.begin(&SPI1);
This worked for me, hopefully it will for you as well.
I just want to note that You Do Not Need An External Antenna module, because the Arduino Giga R1 has a micro UFL antenna connector, and an antenna is shipped with every arduino giga(sorry for you if they forgot to include it in your one), However It IS probably more for wifi porpuses than enclosed communication, still the nRF24L01+ is a great way to actually communicate between two mcu's, especially if an mcu doesnt come with a built in wifi or some sort of wireless communication