nrf24L01+ Arduino- trying to get Constant carrier wave output for testing

Hi All Newbie question

I have a n NRF24Lo1+ being controlled by a atmega328p. The Arduino complier I have been using has the libraries of maniacbug (RF24) and Aaron (MIRF). Neither has a CONT_WAVE function and I have not been able to edit them successfully to include one.

There are instructions in Appendix C of the Nordic semiconductor datasheet

http://www.nordicsemi.com/eng/Products/2.4GHz-RF/nRF24L01

on how to achieve the constant carrier output. It succinctly states that you must:

  1. Set PWR_UP = 1 and PRIM_RX = 0 in the CONFIG register.
  2. Wait 1.5ms PWR_UP->standby.
  3. In the RF register set: CONT_WAVE = 1. PLL_LOCK = 1. RF_PWR
  4. Set the wanted RF channel.
  5. Set CE high.
  6. Keep CE high as long as the carrier is needed.

I have tried many approaches to get this to work. I compiles and uploads but I don't see the carrier wave on my Spectrum analyzer.

Here are some of my most recent attempts: (full disclosure- I am not very hexidecimal/binary literate but I try my best)

Mirf.configRegister(CONFIG, mirf_CONFIG | ( (PWR_UP==1) | (PRIM_RX==0) ) ); delay(600); digitalWrite(8,LOW);//puts radio in standby delay(600); Mirf.configRegister(RF_SETUP,0b01111001);// http://forum.arduino.cc/index.php?topic=18379.0 delay(400); // Mirf.configRegister(RF_SETUP,(0x04, 0b00010000));//PLL_lock=1, this is //'d out and I assume //covered above along with the CONT_WAVE=1 command. I have tried both separately but no //success. delay(200); radio.setPALevel(RF24_PA_HIGH );//rfpower delay(200); radio.setChannel(5); delay(200); pinMode(8,OUTPUT); delay(200); digitalWrite(8,HIGH); delay(100);

Would GREATLY appreciate any hints or suggestions or demo code (dream big!) Thanks!!

Hello i have done some experimenting with nrf24l01 myself and this is the code i use as a starting point most times. It gives a lot easier access to all registers and its easy to add whatever u need. Just change the pins in nrf24l01.h to whatever you are using now and edit in void TX_Mode(void) to set the right registers. The rest should be pretty straightforward.

SPI_RW_Reg(WRITE_REG + CONFIG, 0x0e);

For example this writes 0x0e (B00001110)to the config register. i usually use binary instead a lot easier when you read from the data sheet.

if you need to write to a register not in the api file you can do this too

SPI_RW_Reg(WRITE_REG + 0x00, 0x0e); (writes to register 0x00…)

give it a try and if you get stuck write a line and i will take a closer look at it.

Best of luck man.

nRF24l01_softSpi.zip (7.93 KB)

Many thanks Amigo! I got it working. Here is how:

1) use the instructions in ver1.0 of the data sheet not 2.0

2) use this code- It did not work when I used binary so I tried hexi and it worked!

void TX_Mode(void) {

SPI_RW_Reg(WRITE_REG + CONFIG,0x0a); // .Set PWR_UP = 1 and prim_rx=0 in the CONFIG register other values at default 1 delay(1500); digitalWrite(CEq, 0); delay(50); SPI_RW_Reg(WRITE_REG + RF_SETUP,0x93);//fcontwave and pll=1//3 delay(10); SPI_RW_Reg(WRITE_REG + RF_SETUP, 0x07); // TX_PWR:0dBm, Datarate:2Mbps, LNA:HCURR//3 delay(10); SPI_RW_Reg(WRITE_REG + RF_CH,5); // Select RF channel 5 delay(10); digitalWrite(CEq, 1); delay(5); }

Im looking for that, would you give me a code . I would be very appreciate.

that's amazing that it works. I wish mine did.

You have turned constant wave on with SPI_RW_Reg(WRITE_REG + RF_SETUP,0x93); and then turned it off again with SPI_RW_Reg(WRITE_REG + RF_SETUP, 0x07);

Good work people, I am not sure what is to be done in "Void loop()" in order to get a constant carrier wave for_ever. Would anyone mind helping me out with a code snippet for the same?

suryeah: Good work people, I am not sure what is to be done in "Void loop()" in order to get a constant carrier wave for_ever. Would anyone mind helping me out with a code snippet for the same?

This is a very old Thread.

Why do you need a constant carrier wave? It has never occurred to me that it might be useful.

Have a look at this Simple nRF24L01+ Tutorial.

The examples are as simple as I could make them and they have worked for other Forum members.

...R

Well, This is used to test the range and also for other Research purposes. I am using a Spectrum Analyzer in this case. I was able to detect the transmission of data but I need a constant carrier wave.

Also, I came across this LIBRARY online: https://people.ece.cornell.edu/land/courses/eceprojectsland/STUDENTPROJ/2015to2016/djk289/nrf24l01/nrf24l01/html/index.html

not sure how to use it in Arduino IDE.

All of the capabilities of the nRF24L01+ are listed in the Nordic datasheet.

If you study the source code for the TMRh20 RF24 library you will see how to write to the nRF24 registers for any case where there is not a function in the library.

...R

I got it working in an easy way with minor changes in RF24.h library.

*******This is ONLY for Development purpose, I am not responsible if your device dies ********

  • Modify Your RF24 library as you may not be able to access the below-given function as this is kept under the PROTECTED part of CLASS RF24**.** If you don’t want to mess up your original library you may use the one that I have attached.
uint8_t write_register(uint8_t reg, uint8_t value);
  • Download my Source code and Make the modification as per your requirement.
  • I have used Arduino UNO, nRF24L01+ chipset and Spectrum Analyser to check the output.

nrf24l01.h (21.7 KB)

CONT_CARRIER_WAVE.ino (785 Bytes)

RF24_MOD.h (25.2 KB)

suryeah: Download my Source code and Make the modification as per your requirement.

When you make changes to a library it is good practice to give the file(s) a new name so that they are not easily confused with the standard version.

The fact that the TMRh20 RF24 library has the same name as the similar ManiacBug RF24 library (from which it is derived) is a real PITA.

...R

swe-dude: Hello i have done some experimenting with nrf24l01 myself and this is the code i use as a starting point most times. It gives a lot easier access to all registers and its easy to add whatever u need. Just change the pins in nrf24l01.h to whatever you are using now and edit in void TX_Mode(void) to set the right registers. The rest should be pretty straightforward.

SPI_RW_Reg(WRITE_REG + CONFIG, 0x0e);

For example this writes 0x0e (B00001110)to the config register. i usually use binary instead a lot easier when you read from the data sheet.

if you need to write to a register not in the api file you can do this too

SPI_RW_Reg(WRITE_REG + 0x00, 0x0e); (writes to register 0x00....)

give it a try and if you get stuck write a line and i will take a closer look at it.

Best of luck man.

Thanks dude!

This is how it worked for me (by replacing the TX_Mode() function of swe-dude's code)

void TX_Mode(void)
{
  SPI_RW_Reg(WRITE_REG + CONFIG, 0x0a);
  delay(1500);
  SPI_RW_Reg(WRITE_REG + RF_SETUP, 0x9a);
  delay(10);
  SPI_RW_Reg(WRITE_REG + RF_CH, 5);
  delay(10);
  digitalWrite(CEq, 1);
  delay(5);

So I suppose that there are two possible versions depending on your module, because hard2tell's version didn't work for me.