I have been using a Mega as a transmitter and an ESP32 as a receiver using the nRF24L01 modules. This has been working fine. Yesterday, I wanted to follow @Robin2's tutorials for bidirectional communication and I just couldn't get the Mega to receive anything. I've seen people mention power issues and wiring and I've double checked everything but I still can't seem to get this to work. I'm trying out simple 1-way communication now where the ESP32 is the transmitter and the Mega is the receiver (the opposite works just fine). Attached below is my code.
I've tried changing the CE and CSN pins on the Mega but still nothing. I also have a 10uF cap soldered between VCC and GND on both modules (this is what had solved my initial nRF issues). For the RF module attached to the Mega, I am powering it from the 3.3 V pin and connecting the other pins directly to the Mega since I read online that those pins could tolerate 5 V. I'd really appreciate any and all advice. Thank you!
So I've run into a bit of a strange situation. Initially radio.printDetails worked for the Mega and everything looked good. The radio.write returned 0 for the ESP32. Now, radio.printDetails shows me only 0s for both devices. Tried a simple 1-way communication sketch with Mega as the transmitter and the ESP32 as the receiver and things are still working. Not sure what's causing this.
I have it in my notes here that the nRF24 boards I have crap out with anything above a 15MHz SPI clock. And since 99.99% of all these modules have been... let's say "free enterprise" versions and not the real thing for well over a decade now, I wouldn't be surprised in the least if some of them were even less able to operate at higher speeds.
TL,DR: try dropping your SPI clock frequency on the nRF24 transactions.
Go back to the library examples. Got one of those to work? Add in all the error checks you can. Still works? Add bits from your program that fails one at a time until the modified example fails too. Then the real head scratching begins.
But don't discount the possibility of a failing breadboard, bad hookup wires, or just plain iffy nRF24s.
That's what I'm doing, running through every possibility here hoping it'll be something small that I've missed.
Looking at power issues as well. I have the nRF24 adapters - I'll give those a try and try switching to independent power supply. Thanks for your assistance. I will update if and when I find a solution.
I've never used the power adapters. I've always gone with a dedicated LP2950 or L4931 (that I've bought from Digikey) with appropriate caps on input and output.
I'll look into those. I haven't so far because the 10 uF cap I soldered on made them work and I was happy with things. Hoping I'm able to resolve this soon.
It was a power issue. Many others have recommended using independent power supplies for these antennas. I powered up both antenna modules through an external power supply and that did it for me. While following @Robin2's tutorials on bidirectional comms, an issue I faced was that the Mega would initially start receiving but after 2 or 3 messages, it would fail - not sure what was causing that. I then went ahead and set up even more basic sketches and things finally worked. In case anyone's interested, I've attached my working code below.