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
on how to achieve the constant carrier output.
It succinctly states that you must:
Set PWR_UP = 1 and PRIM_RX = 0 in the CONFIG register.
Wait 1.5ms PWR_UP->standby.
In the RF register set:
CONT_WAVE = 1.
PLL_LOCK = 1.
RF_PWR
Set the wanted RF channel.
Set CE high.
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);// Read nrf24L01+ register - Interfacing - Arduino Forum
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.
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.
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.
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.
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.
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)