Skip to content
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

Hanging up at radio.write #217

Closed
Ravi0li opened this issue Feb 18, 2016 · 29 comments
Closed

Hanging up at radio.write #217

Ravi0li opened this issue Feb 18, 2016 · 29 comments
Labels

Comments

@Ravi0li
Copy link

Ravi0li commented Feb 18, 2016

Hallo,

I have the problem, that the GettingStarted is hanging up, when I would transmit a packed.
This is the console output from the GettingStarted porgramme, when I push T:

RF24/examples/GettingStarted
*** PRESS 'T' to begin transmitting to the other node
*** CHANGING TO TRANSMIT ROLE -- PRESS 'R' TO SWITCH BACK
Now sending

Than i can't do anything and I must restart the Arduino.

Some facts to my setup:

  • I use the actual version of the RF24-Library from GitHub
  • I have a 220uF capacitor between 3,3V and GND
  • I build it on a perfboard (wirelenght < 5cm)
  • I use a Ardino Nano Clone (but i have the same problem with a original Arduino Uno)
  • I have checked all connections with a mulitmeter. They are right.
  • I use this board: NRF24L01 PA LNA SMA
  • I have switch between three of the NRF24L01 PA LNA SMA boards. I have at all three this problem.

Have somebody I tip for me? Or what I can do now?

p.s. sorry for my bad English 😄

@Avamander
Copy link
Member

Avamander commented Feb 18, 2016 via email

@Ravi0li
Copy link
Author

Ravi0li commented Feb 18, 2016

OK, now i use for a LM2596S Down-Stepper with two 220uF capacitors behinde. With the oscilloscope, I can only detect some +20mV peaks from the LM2596S. I thing, now its not a VCC problem?

But I have the same problem. Now with #define FAILURE_HANDLING

RF24/examples/GettingStarted
*** PRESS 'T' to begin transmitting to the other node
*** CHANGING TO TRANSMIT ROLE -- PRESS 'R' TO SWITCH BACK
Now sending
failed
Failed, response timed out.
Now sending
failed
Failed, response timed out.
Now sending
failed
Failed, response timed out.
............

And when I let read out the status every try. I become this (HEX):

E
E
F
F
...

Also he write something into the TX buffer, but don't send it. And after 3 times is the TX buffer full...

@Avamander
Copy link
Member

Triple check that the wiring is absolutely correct. Also, did you solder the capacitors (I had the best results with 800uF electrolytic ones) to the module's power pins?

@Avamander
Copy link
Member

Wait, what does the second Arduino print out?

@Ravi0li
Copy link
Author

Ravi0li commented Feb 19, 2016

I check the wiring again. It is absolut correct. And I connected GND from the Arduino to the other Power supply.
Now, I solder on both module's a 1000uF electrolytic capacitor direktly on the power pins of the module.
But this make it not better. I try both sides as Transmitter and Receiver, with the same solution:

Transmitter:

*** PRESS 'T' to begin transmitting to the other node
*** CHANGING TO TRANSMIT ROLE -- PRESS 'R' TO SWITCH BACK
Now sending
failed
Failed, response timed out.
Now sending
failed
Failed, response timed out.

Receiver:

RF24/examples/GettingStarted
*** PRESS 'T' to begin transmitting to the other node

@Avamander
Copy link
Member

Then there are two things most likely. Your library is somehow outdated or broken or you have defined the CS and CS pins wrong. If you can please attach a picture of the connection/build and your code.

@t3chguy
Copy link

t3chguy commented Feb 19, 2016

Best way to test wiring is radio.printDetails(); which (if printf is functional) will print the content of some registers, if the data that gets dumped to Serial looks like zeros or Null then something is wrong.

@Ravi0li
Copy link
Author

Ravi0li commented Feb 19, 2016

Here is a picture from the build: http://www.pic-upload.de/view-29785724/funkmodul.jpg.html
And I use exactly the same code like the GettingStarted programm.

I modified the print code a little bit, an becomme this for radio.printDetails();

STATUS = 0E
RX_ADDR_P0-1 = 0x65646F4E31 0x65646F4E32
RX_ADDR_P2-5 = C3 C4 C5 C6
TX_ADDR = 0x65646F4E31
RX_PW_P0-6 = 20 20 0 0 0 0
EN_AA = 3F
EN_RXADDR = 2
RF_CH = 4C
RF_SETUP = 3
CONFIG = E
DYNPD/FEATURE = 0 0

Maybe, I have damaged the boards with some test before?

@wmarkow
Copy link
Contributor

wmarkow commented Feb 19, 2016

I have built the test environment that contains two boards: Arduino Uno and NodeMCU (with ESP8266). I'm sure that both boards and chips RF24L01 are correctly wired. After uploading the exact same sketches to both boards and making one of them to transmitter (by sending 'T' in the terminal) I must say that It doesn't work; transmitter sends the data but it doesn't receive any. So I confirm the version of @Ravi0li.

But - after some source code investigations I've figured out that both boards flashed with the exact same code have the radioNumber variable set to zero/false and the write/read pipes are set only once in the setup() method. These pipes are not reconfigured later when you set one board to the transmition state and the packet is sent to an incorrect address.

As a fix I suggest to get rid of that radioNumber variable and just relay on what role says and reconfigure the pipes correctly according when changing from receiver to transmitter (and from transmitter to receiver). It will simplify the getting started scenario as both boards will be flashed withe same code.

I can provide a pull request.

wmarkow added a commit to wmarkow/RF24 that referenced this issue Feb 19, 2016
@wmarkow
Copy link
Contributor

wmarkow commented Feb 19, 2016

@Ravi0li, can you please retest if that fix works with your boards?

@Ravi0li
Copy link
Author

Ravi0li commented Feb 19, 2016

Thx wmarkow, but it is not better.
And the tests before, i have change the radioNumber for the two arduinos.

I see the problem at the transmission, because no time come one of this Flags in the Status Register: TX_DS or MAX_RT.
Alltimes I fall in this Line: https://github.com/TMRh20/RF24/blob/master/RF24.cpp#L803
And I measure the CE-Level. This goes to 4,6V for every transmittion try.

@wmarkow
Copy link
Contributor

wmarkow commented Feb 19, 2016

Ok @ravioli, I thought you have put the same software on two boards without changing the radioNumber.
Take a look at your posted radio.printDetails():

RX_PW_P0-6 = 20 20 0 0 0 0

Correct me if I'm wrong: does it mean that there are 32 bytes of data available in RX pipes? If so then your chip has received something. It may be a clue.

Morever, the line 803 relates to the writing method which send the data to second device. It send the data and waits until bits TX_DS or MAX_RT are set to 1 by the chip.
When AUTO_ACK bit is set (which is by default in the GettingStarted example) then TX_DS is set by the chip only when ACK is received. If second device is broken or not correctly wired up or not correctly configured then no ACK will arrive and you may have the timeout in line 802.
MAX_RT is set to 1 when all packet retransmission will fail.
In your case looks like the while loop is waiting for more than 85ms for either TX_DS or MAX_RT, then it fails in line 803.

If the MAX_RT is set then this bit must be cleared in chip programatically in order to perform further communication (as the datasheets states). When FAILURE_HANDLING is defined then the code never clears the bit MAX_RT (notice the return 0 statement) in the line 813.

You can extend the timeout and temporary remove that return 0 (you can use delay(100) instead) to see if that helps. If not then you have some wiring or configuration problems. Or not? I'm just giving some ideas.

@Avamander
Copy link
Member

It again seems an issue caused by clone modules. If possible try getting your hands on another set (of non PA LNA) originals.

@Ravi0li
Copy link
Author

Ravi0li commented Feb 19, 2016

does it mean that there are 32 bytes of data available in RX pipes?

I read in the datasheet, that this mean: You can receive 32 bytes at this pipe.
The RX_FIFO is free, what I can see at the STATUS register with the Value E.
-> RX_P_NO -> Bits 3:1 -> 111 -> RX FIFO Empty

I think, that i destroy my PA & LNA Chip. The NRE24L01+ work and answer on all SPI-Calls. But he can't send or recieve anything over the amplifier.

@wmarkow Thank you for the good explanation from TX_DS and MAX_RT!
@Avamander I order new modules. Some Orginal, and some with PA LNA

@phillipgreenii
Copy link

Was the ultimate source of the problem being cloned components? I'm seeing a similar problem with mysetup where I can get one "ping" and "pong" to work, but then the second cycle hangs on write. This sounds similar to the problem mentioned above. I am using a base module which includes a capacitor.

@Avamander
Copy link
Member

The thing with nRF24L01+ modules is that there are many clones that work but not exactly as specified in the documentation. So when these kinds of issues arise and for others the same thing has been tested to work, the hardware side is most likely the issue and should be triple checked from any faults.

Now I'd try if I were you I'd check if the CE and CSN pins aren't switched (and are right) plus make sure there aren't any bad connections (bad solder joints for example).

Avamander added a commit that referenced this issue Feb 20, 2016
Fix for #217 GettingStarted enhancement.
@Ravi0li
Copy link
Author

Ravi0li commented Feb 21, 2016

I have read a little more over the PA-LNA Moduls in the www and found some interesting informations. I try now some things and write than my result.

But one question I have for you: When delete the nRF24L01+ modul something from the TX-FIFO? When he send the packege, or not before he come into TX_DS/MAX_RT?

@TotoGe
Copy link

TotoGe commented Feb 21, 2016

Hello. The same trouble. regular NRF24l01+ connect to mini pro, and 2 modules were talking. I connect them to their place NRF24L01+PA+LNA and the problems begin. Communication is, but it is very unstable and at a short distance. It seems to me that the PA does not work. It may be that the library does not include the PA?
Incidentally, the current consumption of 30 mA , instead of 100 mA,
radio.setPALevel(RF24_PA_MAX);
the power supply is connected separately, not through the Arduino, lipo battery 3.3V linear regulator through

@Avamander
Copy link
Member

PA should not affect the way the library works. Your description sounds like bad connection (wiring) or power supply issues. Make sure you connect Arduino's ground and LiPo's ground.

@Ravi0li
Copy link
Author

Ravi0li commented Feb 21, 2016

I have found out, that the CE-Pin was not connected with the NRF24L01 and the amplifier.
Now I have repair this PCB-Fail. I have the same fails now, but the TX-FIFO have no more a overflow.
I'm looking for further errors 😄

EDIT: I measure everytime 0V at the VDD_PA. I think my moduls are damaged...

@TotoGe
Copy link

TotoGe commented Feb 21, 2016

soldered to the inputs nrf + pa modules 2 capacitors, tantalum to 10 microfarads and a barrel of 50 microfarads. Communication has become stable at 20m 5 concrete walls :). But still it is not enough. Most of all I do not like that 30mA current, instead of 100 mA consumption nrf + pa

@TotoGe
Copy link

TotoGe commented Feb 21, 2016

Example "Getting Started". baud rate defaults to 1 MB? decrease - will be on longer distance?
and yet it is not clear why the consumption of 30 mA. corrected radio.setPALevel(RF24_PA_MAX); Or 100mA - it pulses during transmission, that is very short? Maybe that's why the meter shows just 30mA?

@TMRh20
Copy link
Member

TMRh20 commented Feb 21, 2016

@TotoGe Also using 250KBPS via radio.setDataRate(RF24_250KBPS); should give max range and longer transmit period, making it easier to test with a meter.

@TotoGe
Copy link

TotoGe commented Feb 21, 2016

TMRh20 ,you have a lot of experience, please tell me what the real distance for Chinese NRF + pa? And then maybe I want a lot of them? )
I read your library several times, now studying examples. Thank you for your hard work

@TotoGe
Copy link

TotoGe commented Feb 21, 2016

Ravi0li . Yes, your link is also at the maximum consumption should be up to 140mA. But I do not understand, it is a constant current consumed nrf + pa, or only during the transfer? Can I see these 140mA multimeter or oscilloscope only?

@Avamander
Copy link
Member

Most likely a oscilloscope, the modules are actually quite fast.

@TMRh20
Copy link
Member

TMRh20 commented Feb 21, 2016

The short answer is I don't really know.

The long answer is that wireless is & can be directional and largely
affected by the environment. In a perfect testing environment, or very
rural area, results should be much better than in a city apartment block so
mileage will vary. Take a look at
http://n8henrie.com/2015/03/range-testing-for-wireless-arduino-projects-rf-433-mhz-and-nrf24l01/
for a good summary & testing.

@TotoGe
Copy link

TotoGe commented Feb 21, 2016

TMRh20 thank you very much again. and the library, and what is the time to newbies.
All understood, I will seek

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants