I only want to use it to receive. When I power it from from the USB it seems fine. It also seems fine when powered from the bench PSU. But I want to power it from a LIPO and then we get intermittent problems, which shown up in the STATUS register being incorrect.
Here is the setup() code:
{
Serial.begin(9600);
pinMode(CE, OUTPUT);
pinMode(CSN, OUTPUT);
pinMode(buzzerPin, OUTPUT);
SPI.begin();
delay(200);
init_io(); // Initialize IO port
unsigned char sstatus=SPI_Read(STATUS);
Serial.println("RX_Mode Start*********");
Serial.print("status = ");
Serial.println(sstatus,HEX); // There is read the mode’s status register, the default value should be ‘E’
RX_Mode(); // set RX mode
}
Most of the time, the STATUS is correctly returned as E, but about one time in 10, it is FF.
I have put a 470uF electrolytic capacitor across the power supply but this does not solve it.
The LIPO is 380mAH; I think it ought to be able to supply enough current. I know the LIPO voltage is more than specified for the NRF24L01 but the board contains a voltage regulator so the NRF itself isn't getting too much.
Any ideas? Is there any way to catch those occasions when the register is wrong and force a reset without turning off the power?
I haven't wired anything myself apart from connecting the power and including an electrolytic capacitor
I addressed the issue about the LIPO voltage in my original post. The board contains a voltage regulator which takes the NRF voltage down to 3.3V
I can't see anything relevant in the tutorial apart from the recommendation to include a capacitor, which I already have. The schematic also shows two capacitors connected across the output of the LDO though I can't read the values, and I can see a ceramic capacitor across the power supply of the NRF.
However, the problem does seem to be hardware-based, because the issue clearly arises at switch-on, before any code is run, apart from setup() at which point it is clear that the STATUS register is wrong (sometimes).
I should maybe add that I have had the same code running on at least two dozen devices without an issue, but these were using an ATTINY84 as the MCU. This is the first time I have tried to do it using the combined NRF24L01 and Arduino pro mini board
I don't mean to be difficult but I don't know what you mean by a simple diagram - the connections are all there in the schematic I posted. I can't draw anything different.
It's a Arduino Pro-mini 3V3/8M with a Atmega328P
The voltage regulator shown in the schematic is the SPX3819. I have to admit that I haven't looked at the spec for this. It seems to have an enable pin, which maybe gives the possibility of resetting it via the arduino so as to effectively reboot the NRF. The datasheet is here.
Unfortunately the enable pin is tied permanently high according to the schematic so I would have to cut a trace to change that.
The LIPO is currently around 3.8 V - of course fully charged it would be about 4.2V. But I don't now think the LIPO is the problem since the same thing has happened with the bench supply.
robertjenkins:
I don't mean to be difficult but I don't know what you mean by a simple diagram - the connections are all there in the schematic I posted. I can't draw anything different.
it will take me time to figure out the schematic
because I don't have your hardware I might make a mistake in reading the schematic
you may have made a mistake in applying the schematic
I don't expect a work of art - just a simple drawing in the style in my tutorial but made with a pencil and paper
I know this sounds tedious, but wireless problems can be very difficult to debug. If it is any encouragement my nRF24 projects do work and I would like to hep you.
Yes I get your point - if I'd made something you'd like to see it. But I haven't made or wired anything, let alone something that I can draw.
I have bought a PCB module that contains both the arduino and the NRF24L01 module. The connections between the two, and the other components, are completely described by the schematic, assuming the manufacturers have correctly followed their own design. You can see a picture of it in the first link I posted: http://www.electrodragon.com/product/nrf24duino-arduino-mini-plus-nrf24l01-board/
That's all there is, apart from the FDTI hookup to program it. But I disconnect that once the programming is done. (And an electrolytic capacitor between the GND and VIN of the NRF module, but you don't need me to draw you that.)
I too have successfully used the NRF24L01 many times, with hookups between various arduinos (and other MCUS), and different NRF24l01 modules. This time I have bought something that integrates the two, in an attempt to speed things up. But now this specific problem has arisen to do with the STATUS registry.
Hi man
Sounds like a power issue to me, maybe try add a bigger cap on the 3v3 line as well as on the vin.
Or you can try and clear the register before reading it not sure what version of the code you are using but something like:
SPI_RW_Reg(WRITE_REG+STATUS,0xff);
should/may work
or
if(sstatus==0xff )
{
delay(500);
SPI_RW_Reg(WRITE_REG+STATUS,0xff);
delay(100);
sstatus=SPI_Read(STATUS);
Serial.println("*******************RX_Mode Start 2d attempt...****************************");
Serial.print("status = ");
Serial.println(sstatus,HEX); // There is read the mode's status register, the default value should be 'E'
}
another thing i have observed with nrf modules are that if the voltage drops below 1.6v-+ and then goes up again without completely powering it off it can become unresponsive and only recover after a complete power off.
Best of luck
robertjenkins:
I have bought a PCB module that contains both the arduino and the NRF24L01 module.
Now I understand. Sorry if I have been slow.
However that does not help me to help you. It would probably have been easier to help if you had assembled it yourself
I can't be certain from the schematic if there is a 10µF capacitor across Vcc and GND for the nRF24 but I don't think there is. If there is not then I would advise adding one. It is quite likely to solve your problem.
It looks like the circuit board has an LD1117 3.3v regulator and I'm not sure if it can work with an input voltage as low as 3.8v. I know they do work from a 5v input. Have you tried powering your project with a pack of 3 x AA cells (4.5v)?
...R
PS. It is an interesting device but it is a shame they did not make it very much smaller. I can make a smaller one with an Attiny 1634 and an nRF24L01+
Yes I've got big cap on the 3.3V but I think too big could even be a problem - it could stop the voltage dropping to zero when powered down.
For the whole code I'm basically using something you pointed me to years ago which has always worked for me.
I've tried something like your modification but am a bit confused: why do we want to write 0xFF to that register (rather than 0x0E which is what we are expecting)? In any case, whatever I write to it, when I read it in thet next line, I don't get back what I've written. I don't know whether reading it will change it?
Robin2:
Not sure where you are getting LD1117 from? The schematic I'm looking at says SPX3819. But in any case
I've been in touch with the manufacturers who say they have changed the circuit so it no longer uses that LDO (with the useful enable pin), but instead uses the XC6206. This has a dropout voltage of 250mV so I don't think that voltage drop is the issue.
No the schematic does not show a big capacitor, but I have added one myself (I have now said this four times!)
I have also made MUCH smaller versions of this, successfully, but I bought this because I wanted the extra pins.
Hello to clear the status register you need to write a 1 to bit 4,5 and 6 (01110000) (0x70) you cant write to the other bits so writing 0xff (11111111) instead is just me being lazy...
When you get a 0xE (00001110) when you read it is means all is fine and that the 4,5,6 bits in the register are cleared and that the rx and tx fifo are empty.
So writing a 0xE will do nothing since those bits are read only.
Anyway sometimes these modules just annoy the hell outta me and i end up tossing it and making another board. and the next one just works...
robertjenkins:
Not sure where you are getting LD1117 from? The schematic I'm looking at says SPX3819.
I was guessing based on the picture of the device - did not see the name on the schematic - sorry. Looking at the datasheet for the XC6206 I wonder if you are operating too close to the margin. That is easily checked by temporarily using a hgher input voltage.
I can't think of any other suggestion apart from ask the manufacturer.
And to follow up Reply #12 I have had only one faulty nRF24 in a total of about 20 - and it had a major fault, a dead short circuit between its Vcc and GND pins. Also I have accidentally abused some them without killing them.
swe-dude:
Hello to clear the status register you need to write a 1 to bit 4,5 and 6 (01110000) (0x70) you cant write to the other bits so writing 0xff (11111111) instead is just me being lazy...
When you get a 0xE (00001110) when you read it is means all is fine and that the 4,5,6 bits in the register are cleared and that the rx and tx fifo are empty.
So writing a 0xE will do nothing since those bits are read only.
swe-dude:
Hello to clear the status register you need to write a 1 to bit 4,5 and 6 (01110000) (0x70) you cant write to the other bits so writing 0xff (11111111) instead is just me being lazy...
When you get a 0xE (00001110) when you read it is means all is fine and that the 4,5,6 bits in the register are cleared and that the rx and tx fifo are empty.
So writing a 0xE will do nothing since those bits are read only.
Anyway sometimes these modules just annoy the hell outta me and i end up tossing it and making another board. and the next one just works...
I do like the board design thou.
So far your solution seems to work. I've both cleared the register at the start, and put in a loop to catch it if it's still not cleared, but - fingers crossed - it hasn't happened yet.
Thanks for your really useful and on-point advice, again.