Notifications
Clear all

Need help with nrf24L01

69 Posts
10 Users
12 Likes
5,238 Views
(@gkar2287)
Member
Joined: 2 years ago
Posts: 19
Topic starter  

@eliza Thank you Eliza I will try them in the morning. 


   
ReplyQuote
(@eliza)
Member
Joined: 2 years ago
Posts: 81
 

@gkar2287 Hi again gkar. When I posted the 2 "working" programs the bottom of the second file was cut off. I reposted that code but CodeCage helped me out and edited the original post. So, you should have good source code now. Let me know when you get that basic "radios talking" step done and we can go to the next step. Sorry about any confusion from the bad code.


   
ReplyQuote
(@gkar2287)
Member
Joined: 2 years ago
Posts: 19
Topic starter  

Hello Everyone I'm sorry for getting back to everyone late I'm working on a lot of projects at once. Ok I hooked up a new board an Elegoo 2560 and ran Eliza's sketch and and in the one picture you can see what happened. I then ran the other boards swapping out the 2 pins Bill said might be mislabeled to no avail. Now if I run in essence the transmission sketch it seems to initialize but not the receiver I've swapped programs between both boards and which ever board is programed with the transmitter it seems to work so if the antenna or adapter was bad I would assume that when I loaded the transmitter sketch onto it it wouldn't work but it does. So I'm ordering new boards tonight from another manufacturer as well as the antennas and adapters and I'll let everyone know what happens when they come in. Thank you again for everyone's help. 


   
ReplyQuote
(@eliza)
Member
Joined: 2 years ago
Posts: 81
 

Hi gkar, Are you saying that the same hardware that gives a successful init with the transmitter fails when you run receiver with those same parts? If so that seems like it must be a software problem. Have a look at the top of the 2 files and make sure that this part agrees:

#define CE 8
#define CSN 53
#define MOSI 51
#define MISO 50
#define SCK 52

This statement:

RH_NRF24 radioDriver(CE, CSN); // CE chip enable, CSN chip select)

 

Is where you tell the radio driver that chip enable is on pin 8 and chip select is pin 53" I don't know how is figures out MOSI & MISO as there is no actual reference to those values, just the #define statements. Perhaps the code in the library looks for those #define values. In case you aren't familiar with it, #define 8 means "hey compiler, every time you see CE replace it with 8" So perhaps the radio head library watches for the MOSI and MISO values.

Here is where the init takes place: The error message would appear after this line, or if it succeeds you'll see the "init OK" message which I put in the program as a check.


if (radioManager.init()) {

   
Ron reacted
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6943
 

@gkar2287 I don't understand your logic. This type of problem is a divide and conquer. You did that but your conclusion is baffling. As I understand it the transmitter works on both boards but the receiver does not. Your conclusion is that both boards are bad but only for receiving? Occam's razor suggests the receiver code is the culprit, it is common to both boards and a single failure is more likely than a dual especially a dual hardware that only affects receiving.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@gkar2287)
Member
Joined: 2 years ago
Posts: 19
Topic starter  

I  agree but since I'm using what has been said is a working sketch and since my knowledge of arduinos is very limited I figured that maybe a different board and manufacturer could possibly work. As I said I did put a new board in the mix and without changing any wiring that one wouldn't even except the sketch? Unfortunately I'm a little out of my depths when it comes to these controls and if I knew anyone near by that I could take them to I would but I figured maybe it something in the configuration of a new board that might be causing it.

This post was modified 2 years ago by gkar2287

   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6943
 

@gkar2287 Let us know what happens. 

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@gkar2287)
Member
Joined: 2 years ago
Posts: 19
Topic starter  

Thank you I will 


   
ReplyQuote
(@eliza)
Member
Joined: 2 years ago
Posts: 81
 

@gkar2287 Hi gkar. Do you see "radio init OK" when you run the transmitter sketch?

Do you see "radioManager.init OK" when you run the receiver?

If you see either of those messages then you know that you have a working NRF24-L01 and it is wired correctly.

If you see "radio init OK" when you run the transmitter then you can upload the receiver sketch to that same arduino without changing the parts or wiring and run it again and you should see "radioManager.init OK"

You could also go into the code and change the text. On the receiver sketch put "Receiver radio manager init OK" in the println statment that should be at, or near, line 60. In the transmitter change the text to "transmitter radio init OK" in the print statement that is at, or near, line 44.

The reason I thought there could possibly be a software problem is that I accidentally uploaded the transmitter code without the closing bracket, and then uploaded it again correctly. The 2 programs that I was using for my project used CE = 8 in one sketch and CE = 9 in the other.

I specifically rewrote both programs for you and made both wirings the same to avoid confusion.

If you can get either sketch to get to the "init OK" message then simply upload the other sketch and try it again. That tells you that both sketches are good, and one set of hardware is OK. Then just do the same thing with a different arduino and a different radio and you have the 2 computer system going. (Big celebration when we get to that place.)


   
Ron reacted
ReplyQuote
Page 5 / 5