nrf24l01 fails when on PCB

Summary
I've been banging my head on this for weeks. I'm trying to use a nrf24l01 on a PCB, but it's failing. The radio.begin() returns false when the radio is on the PCB. The exact same code with the exact same hardware works if I'm using it through prototype boards off the PCB.

Setup
I've included images of the schematic, pcb layout, and an image of the setup. At this point, I'm excluding all the components from the PCB except the DIP switch where the ATMEGA328 would go, the LD1117V33 for the 3.3v power, the 5v power supply (can supply up to 4amps), and header pins for the nrf24. I've made boards with just these components to try to narrow down any issues.

I'm not putting an ATMEGA in the dip switch, I've switch to an external arduino nano connecting the necessary digital pins to the dip switch along with connecting ground between the two.

Trials
I've tried many things to narrow down what the issue is, which is why I'm down to just these components on the board.

If I have everything on a breadboard connected via wires, supply power to the LD1117V33 from the external 5v power supply going to the radio, then the radio starts up fine.

Now lets move those components to the PCB, same nrf is on the pcb, power is from the 5v on the board, going through the LD1117V33 to the nrf24, and the chip doesn't start (radio.begin() returns false)

Now keep everything exactly the same, except unplug the 5v power and power the nrf24 through the 3v supply on the nano, and it magically starts working (that's the yellow wire in my picture).

When powered via the board power, I've checked the voltages from the LD1117V33 to the nrf24 on the board, and I'm seeing a consistent 3.25 volts. I've triple checked there are no shorts between any pads, and that power is reaching the nrf24.

Closing
I'm at my wits end trying to figure out why everything works on prototype boards, but once it's on a PCB, the radio won't even start. I thought maybe I damaged the LD1117V33 during soldering, so I tried another board where I just put it in and tape it down for a decent connection, but that doesn't work either.

Any help would be greatly appreciated!

Appendix
I don't think it matters, but here's the code that it's running. When it's failing, it just always prints "Waiting for radio to start".

#include <nRF24L01.h>
#include <RF24.h>

const int CE_PIN = 9;
const int CSN_PIN = 10;

const rf24_datarate_e RADIO_DATA_RATE = RF24_1MBPS;
const rf24_pa_dbm_e RADIO_POWER_LEVEL = RF24_PA_LOW;
const rf24_crclength_e CRC_LENGTH  = RF24_CRC_8;

RF24 radio(CE_PIN, CSN_PIN);

void setup() {
    Serial.begin(9600);

    Serial.println("Starting receiver");
    configureRadio(radio);
}



void configureRadio(RF24 &radio) {
    boolean success = false;
    while (!success) {
        radio.failureDetected = false;
        boolean radioBegan;
        boolean chipConnected;
        while (!(radioBegan = radio.begin())) {// || !(chipConnected = radio.isChipConnected())) {
            Serial.print(millis() / 1000);
            Serial.print(" Waiting for radio to start ");
            if (!radioBegan) {
                Serial.print(" Radio did not Begin ");
            }
            if (!chipConnected) {
                Serial.print(" Chip not connected ");
            }
            Serial.println(" ");
            radio.printPrettyDetails();
            // radio.printDetails();
            delay(500);
        }
        radio.setPALevel(RADIO_POWER_LEVEL);
        radio.setChannel(CHANNEL);
        radio.setCRCLength(CRC_LENGTH);
        radio.setAutoAck(true);


        if (!radio.setDataRate(RADIO_DATA_RATE)) {
            Serial.println("Could not set the data rate");
            radio.failureDetected = true;
        } else {
            radio.openWritingPipe(sendAddress);
            radio.openReadingPipe(1, sendAddress);
            radio.startListening();
            success = true;
        }
    }
    Serial.println("Radio configured");
}

BottomLayer.png

TopLayer.png

BottomLayer.png

TopLayer.png

Nice job posting everything.
Why 22pF on VCC, AVCC? 0.1uF would be better.
Should also have one on ACS712.

Have not fired up nrf24L01 myself (just got a pair recently), no help to offer there.

Is your board single sided or double? Any vias that did not get plated through? Check all traces for continuity, end to end. Check for 3.3 volts at the NRF pins.
Paul

CrossRoads:
Why 22pF on VCC, AVCC? 0.1uF would be better.
Should also have one on ACS712.

I actually do use 0.1uF on vcc and AVCC, I just miss-copy-pasted for those. I can look at adding one on the ACS712 once everything else is working. Hopefully I don't just throw this all away before I get to that point.

Paul_KD7HB:
Is your board single sided or double? Any vias that did not get plated through? Check all traces for continuity, end to end. Check for 3.3 volts at the NRF pins.
Paul

Double sided. And the vias aren't even on this part of the circuit. I checked for continuity between all pins being used for this mini circuit, and they are all good.
And ya, I was checking 3.3 on the pins actually on the nrf module.

Just a thought, try removing the power supply and connecting via wires to the board. I am just taking a SWAG but it is possible the power supply is killing your signal from the 24L01. Another check would be the voltage to the 24L01 when transmitting. Overall you did a good job.

I would try bigger caps on 3.3v and maybe on 5v too just in case, try 50uf+, on the 3v3 side you can just solder it directly on the nrf pins.

also add a bit of a delay before starting the nrf i usually add a 1000 delay

Best of luck

You should have a 10µF capacitor between Vcc and GND for the nRF24 - but I think its absence would only be noticeable when you try to transmit and not when you are just initialising the device.

For testing try powering the nRF24 with a pair of AA alkaline cells (3v) with the battery GND connected to the Arduino GND.

...R
Simple nRF24L01+ Tutorial

Your voltage regulator is missing its input (100n) and output (10u) capacitor.

Have a look at the typical application in the data sheet.

Thanks everyone for the input. I tried many of them but had no success. But I still do have good news, I think I resolved it!

I was planning on just tossing all this and switching to ESP8266 boards. During that process, I was thinking whether I want desolder all the power adapters I put on my boards, or purchase new ones. In that process, I saw some boards actually have separate pins for AC line and AC neutral, but my power brick is just labeled "AC" for both. So I thought, what the hell, lets try switching the two. And who would have thought it, it worked!

I have no idea why though. All my voltage measurements show the same regardless of which way I connect the AC.

I've just done a mini test of starting the radio so far, but it actually passed "begin" which is further than before. I'll give it a deeper dive later today after I finish work.

And now, i gotta figure out what to do with all these ESP8266 boards that I already ordered. I kinda want to use them now as there are some really nice mesh networking libraries out there. But I should probably use all the pcb boards I already made for the arduino version.

You should still add the voltage regulator capacitors.

Like you need for an 78xx part Why Capacitor need to use with IC 78XX Series Voltage Regulators?

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.