-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RF24Mesh Library on the Arduino Due #172
Comments
What's stopping you now? |
I have a mesh network of Arduino Uno's. Now i want to add another node of the Arduino Due, it seems to be connecting properly to the network but the output from the master node is wrong, its not the same as the other nodes in the network yet they are all running similar codes, except for the physical SPI connection with the NRF24L01+ modules. |
If the output is wrong you might've forgotten to take into account data type size changes between the platforms. |
Okay. i surely did not change anything on the code except for the node ID's and SPI config. |
Let me try to work around it and give feed back. |
Any heds
I would appreciate any heads up |
So it turns out i was wrong about the connection to the Mesh Network. the Due is not even connecting, i have tried other examples including the RF24 helloworld but it's not working. on one end i have an arduino uno hooked up to an RF24L01+ which i am sure is working and on the remote end i have an arduino Due hooked up to an RF24L01+. For the Due I am using the SPI pins located near the centre of the board, MISO-MISO(pin1), SCK-SCK(pin3), MOSI-MOSI(pin4). VCC is connected to 3.3V, GND to GND. I need to at least get the helloworld example working between the UNO and the Due to get me going. Please assist, i am stuck.#Newbie |
CE is pin 8, CSN is pin 9. helloworldtx RF24 radio(8,9); // nRF24L01(+) radio attached using Getting Started board RF24Network network(radio); // Network uses that radio const uint16_t this_node = 01; // Address of our node in Octal format const unsigned long interval = 2000; //ms // How often to send 'hello world to the other unit unsigned long last_sent; // When did we last send? struct payload_t { // Structure of our payload void setup(void) SPI.begin(10); void loop() { network.update(); // Check the network regularly unsigned long now = millis(); // If it's time to send a message, send it!
} helloworldrx #include <RF24Network.h> RF24 radio(8,9); // nRF24L01(+) radio attached using Getting Started board RF24Network network(radio); // Network uses that radio struct payload_t { // Structure of our payload void setup(void) SPI.begin(); void loop(void){ network.update(); // Check the network regularly while ( network.available() ) { // Is there anything ready for us?
} |
Sounds like you are correctly using the ICSP header, but I would still
suggest double checking your pin configuration here:
https://www.arduino.cc/en/reference/SPI
The wiring/configuration are going to be the most likely reasons why it
isn't working for you.
Make sure you connect the radio to the 3.3v pin, and NOT the ICSP header
vcc which is 5v.
Also you don't need to call SPI.begin().
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.
www.avg.com
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
On Mon, Apr 6, 2020 at 9:19 AM bnmangirazi ***@***.***> wrote:
So it turns out i was wrong about the connection to the Mesh Network. the
Due is not even connecting, i have tried other examples including the RF24
helloworld but it's not working. on one end i have an arduino uno hooked up
to an RF24L01+ which i am sure is working and on the remote end i have an
arduino Due hooked up to an RF24L01+. For the Due I am using the SPI pins
located near the centre of the board, MISO-MISO(pin1), SCK-SCK(pin3),
MOSI-MOSI(pin4). VCC is connected to 3.3V, GND to GND.
I need to at least get the helloworld example working between the UNO and
the Due to get me going.
Please assist, i am stuck.#Newbie
CE is pin 8, CSN is pin 9.
*helloworldtx*
#include <RF24Network.h>
#include <RF24.h>
#include <SPI.h>
RF24 radio(8,9); // nRF24L01(+) radio attached using Getting Started board
RF24Network network(radio); // Network uses that radio
const uint16_t this_node = 01; // Address of our node in Octal format
const uint16_t other_node = 00; // Address of the other node in Octal
format
const unsigned long interval = 2000; //ms // How often to send 'hello
world to the other unit
unsigned long last_sent; // When did we last send?
unsigned long packets_sent; // How many have we sent already
struct payload_t { // Structure of our payload
unsigned long ms;
unsigned long counter;
};
void setup(void)
{
Serial.begin(115200);
Serial.println("RF24Network/examples/helloworld_tx/");
SPI.begin(10);
SPI.begin(4);
radio.begin();
network.begin(/*channel*/ 90, /*node address*/ this_node);
}
void loop() {
network.update(); // Check the network regularly
unsigned long now = millis(); // If it's time to send a message, send it!
if ( now - last_sent >= interval )
{
last_sent = now;
Serial.print("Sending...");
payload_t payload = { millis(), packets_sent++ };
RF24NetworkHeader header(/*to node*/ other_node);
bool ok = network.write(header,&payload,sizeof(payload));
if (ok)
Serial.println("ok.");
else
Serial.println("failed.");
}
}
*helloworldrx*
#include <RF24Network.h>
#include <RF24.h>
#include <SPI.h>
RF24 radio(8,9); // nRF24L01(+) radio attached using Getting Started board
RF24Network network(radio); // Network uses that radio
const uint16_t this_node = 00; // Address of our node in Octal format (
04,031, etc)
const uint16_t other_node = 01; // Address of the other node in Octal
format
struct payload_t { // Structure of our payload
unsigned long ms;
unsigned long counter;
};
void setup(void)
{
Serial.begin(115200);
Serial.println("RF24Network/examples/helloworld_rx/");
SPI.begin();
radio.begin();
network.begin(/*channel*/ 90, /*node address*/ this_node);
}
void loop(void){
network.update(); // Check the network regularly
while ( network.available() ) { // Is there anything ready for us?
RF24NetworkHeader header; // If so, grab it and print it out
payload_t payload;
network.read(header,&payload,sizeof(payload));
Serial.print("Received packet #");
Serial.print(payload.counter);
Serial.print(" at ");
Serial.println(payload.ms);
}
}
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#172 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAT5KHC5JRQY5CSIW7CUSL3RLHXJBANCNFSM4MBPS6XA>
.
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.
www.avg.com
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
|
I have verified the connections and power to the radio module, but still not working. #define TEST_MOSI 74 void setup() { void loop() { The voltage is flactuating between 0v and 3.28v on all the pins (MISO, SCK & MOSI). |
That's not really a test for SPI, only for GPIO control. To see if you have SPI communication with the radio module and Due call Then if you unplug/reset the Due, it should output the following:
If these settings do not match what you see, you have an SPI communication problem, again most likely wiring/configuration related or even a hardware failure. |
My output is different. RF24Network/examples/helloworld_tx/ I have cross checked the connection quite a considerable number of times now, I am convinced i have a hardware problem on the SPI interface. |
Unfortunate if that is the case. There are not many other options on the Due such as softSPI. There is a possibility to use the Due USARTs for SPI, but I haven't adapted my library for it, and I don't think anybody else has made one either. |
Err, in looking things over for something else I'm working on, I realized that my UART_SPI driver actually does support the Due. I must have added support and forgot about it. In any case, you can actually prove this out if you would like to try it out:
It should work exactly the same, no other changes needed. |
i have tried the above and somehow, my program for helloworldtx cannot go past the setup phase. |
This line It seems something changed in the RF24 library, haven't used the usart lib for a while, but that should correct it. Sorry bout that. |
Recent changes to RF24 library resulted in the SPI clock being set to 84mhz Workaround by always defaulting to 9.33Mhz. Issue identified per nRF24/RF24Mesh#172
Thank you so much, the program is now running beyond "setup", however i'm getting the same results as before with the ICSP SPI. |
Have you tried a different radio with the due? One that works for sure on another device?
… On Apr 7, 2020, at 05:16, bnmangirazi ***@***.***> wrote:
Thank you so much, the program is now running beyond "setup", however i'm getting the same results as before with the ICSP SPI.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Yes i have i am sure the radio is fine. i even tested it on the Uno. i also tried swapping the radios. i am left to believe there could be something wrong with my Due. |
Ok, I think you have done about as much troubleshooting as can be expected. To go any further it would probably be best to have like an oscilloscope or logic analyzer to see wtf is going on with those SPI pins... if you do manage to figure something out, please let us know the cause of this. |
One more thing you can try is checking if you're on the latest version of both Arduino boards support and RF24*. |
Thanks, i will check with an oscilloscope after the lock down. meanwhile i have ordered another Due from a different supplier. i will give updates in due course. |
Has anyone managed to use the library with the Arduino Due successfully without making major changes to the library?
The text was updated successfully, but these errors were encountered: