SparkFun Forums 

Where electronics enthusiasts find answers.

All things pertaining to wireless and RF links
By dizzey
#46957
Hi i have made a some nrf24l01 boards and im having troble with reciving data.
I can read/write all the registers of the nrf and the txfifo gets cleard if i disable autoack.
i have tested on a distance of less than 5mm but i still cant se any incoming packets in the statusregister on the reciver.

-------- sender code-----------------------
Code: Select all
void NRF24l01_init()
{
	unsigned char kaka,kaka2,data[6];
	NRF_PORT = (1 << NRF_CS);// | (1 << NRF_CE);

	NRF_write_reg(NRF_CONFIG,NRF_CONFIG_DEFAULT_VAL);
	NRF_write_reg(NRF_EN_AA,NRF_EN_AA_DEFAULT_VAL);
	NRF_write_reg(NRF_EN_RXADDR,NRF_EN_AA_ENAA_P0);
	NRF_write_reg(NRF_SETUP_AW,NRF_SETUP_AW_4BYTES);
	NRF_write_reg(NRF_SETUP_RETR,NRF_SETUP_RETR_DEFAULT_VAL);
	NRF_write_reg(NRF_RF_CH,NRF_RF_CH_DEFAULT_VAL);
	NRF_write_reg(NRF_RF_SETUP,NRF_RF_SETUP_DEFAULT_VAL);

	data[0]=192;
	data[1]=168;
	data[2]=0;
	data[3]=3;

	NRF_write_adr(NRF_RX_ADDR_P0,data,4);
	NRF_write_adr(NRF_TX_ADDR,data,4);
	NRF_read_adr(NRF_RX_ADDR_P0,data,4);
	write_hex_buff(data,4);
	NRF_write_reg(NRF_RX_PW_P0,0x02); //2byte
	NRF_write_reg(NRF_CONFIG,NRF_CONFIG_EN_CRC | NRF_CONFIG_PWR_UP | NRF_CONFIG_PRIM_RX);
	//NRF_write_data(0xa0,data,2);
	NRF_PORT |= (1 << NRF_CE);
	//DDRD=0x03;	
	//while( (PIND & (1 << 2) ) == 1);
	while(uart_getchar() != 'p')
	write_hex_8(NRF_read_reg(NRF_STATUS));	




	LED_PORT |= (1 << LED3);
}
--------------------------------------------------------

on the reciver i have just changed to
--------------reciver-------------------------------
Code: Select all
NRF_write_reg(NRF_CONFIG,NRF_CONFIG_EN_CRC | NRF_CONFIG_PWR_UP | NRF_CONFIG_PRIM_RX);
	NRF_PORT |= (1 << NRF_CE);
	while(uart_getchar() != 'p')
	write_hex_8(NRF_read_reg(NRF_STATUS));	
----------------------------------------------------

all the register defs are from brennens code and to not make this post to long
the full code and eagle files can be found @http://www.ing.umu.se/~dizzey/nrf24l01/
By dizzey
#46963
oh yes but actuly i did not i did the stupid mistake and pasted the rx code twice when i made the post javascript:emoticon(':oops:'). sorry here is the correct tx code
Code: Select all
unsigned char kaka,kaka2,data[6];
	NRF_PORT = (1 << NRF_CS);

	NRF_write_reg(NRF_CONFIG,NRF_CONFIG_DEFAULT_VAL);
	NRF_write_reg(NRF_EN_AA,0x01);
	NRF_write_reg(NRF_EN_RXADDR,NRF_EN_RXADDR_ERX_P0);
	NRF_write_reg(NRF_SETUP_AW,NRF_SETUP_AW_4BYTES);
	NRF_write_reg(NRF_SETUP_RETR,NRF_SETUP_RETR_DEFAULT_VAL);
	NRF_write_reg(NRF_RF_CH,NRF_RF_CH_DEFAULT_VAL);
	NRF_write_reg(NRF_RF_SETUP,NRF_RF_SETUP_DEFAULT_VAL);

	data[0]=192;
	data[1]=168;
	data[2]=0;
	data[3]=3;

	NRF_write_adr(NRF_RX_ADDR_P0,data,4);
	NRF_write_adr(NRF_TX_ADDR,data,4);
	NRF_read_adr(NRF_RX_ADDR_P0,data,4);
	write_hex_buff(data,4);
	NRF_write_reg(NRF_RX_PW_P0,0x02); //2byte
	NRF_write_reg(NRF_CONFIG,NRF_CONFIG_EN_CRC | NRF_CONFIG_PWR_UP);

	while(uart_getchar() != 'p')
	{
	NRF_write_reg(NRF_STATUS,0x70);
	write_buffer("NRF Status TX:",14);
	write_hex_8(NRF_read_reg(NRF_STATUS));
	uart_putchar('\n');
	NRF_write_data(0xa0,data,2);
	write_buffer("NRF Observe TX:",15);
	write_hex_8(NRF_read_reg(NRF_OBSERVE_TX));	
	uart_putchar('\n');
	write_buffer("NRF FIFO:",9);
	write_hex_8(NRF_read_reg(NRF_FIFO_STATUS));
	uart_putchar('\n');
	}
:oops:
By brennen
#46965
Your code would have been *considerably* easier to read if you would have just ported my library to your own code (if it didn't fit in your code space, you could have simply removed some of the unnecessary functions).

Where is the function call in your TX code that actually sends the data? Are you getting the TX_DS interrupt after sending the packet? This is the best way to determine if and when you have successfully sent a packet or not for both AA enabled and disabled.

If I were you, I would start out trying to get my tutorial 1 working (or at least the absolute simplest code you can get). Use all the defaults you possibly can, especially with addresses and payload widths. Once you get that code working, slowly incorporate different settings (preferrably one at a time), and test at each setting change. Start as small as is reasonable, and build up by testing very frequently along the way.
By dizzey
#46967
NRF_write_data(0xa0,data,2);
is the code where the data gets sent.

ok i will try your tutorial code i just found it kind of massive.
ill get back later thanx

and i did not want to paste the whole files in the forum so i pasted a link where the whole code tree is acessible from the web
Code: Select all
http://www.ing.umu.se/~dizzey/nrf24l01/
By dizzey
#47206
So i ported your code but still no luck.
i added so the status reg got printed on the uart and it looks fin on the transmitter.
Code: Select all
g
exec_cmd status:0x0E
exec_cmd status:0x2E
status:
0x2Eexec_cmd status:0x2E
exec_cmd status:0x0E
exec_cmd status:0x0E
exec_cmd status:0x0E
?
exec_cmd status:0x0E
exec_cmd status:0x0E
it only gives me a ? so it dosen't give me anything back from the reciver.
I have added my port of brennen's code to.
http://www.ing.umu.se/~dizzey/nrf24l01/

i suspect some kind of hardware error maby but it's a bit hard to test maby il haveto build a nother device? or is there some kind of raw mode just to test the reciver
By brennen
#47218
It could very well be an issue with the RX unit. Since you have my functions working, write a simple main function for your TX and RX units to dump the contents of all the registers immediately after you call the initialization functions. If possible, copy those into a post so I can take a look at your settings. Also, check with a multimeter or a scope to verify that the CE line on the RX is activated once the initialization function is called.
By dizzey
#47228
I have found a big bug on my hardware design that migth be the source.
'i will resolder at a later time to test. the flaw is that vdd_pa should have C3 and C4 connected to ground. and then be connected to ANT1 via L2.

I have connected VDD_PA to ANT1 via L2 and then put C3 and C4 via GND to
ANT1. i havent callulated anything but i suspect that this migth put the output power to nearly zero.

So i will resolder those and then try it again, i suspect that this is why it is not working.

i have also orderd two nr24l01 cards from sparkfun to have som reference.
and hey you can never get to many radio transcivers =)
By dizzey
#47875
So i have gotten two modules from sparkfun one had miso and mosi solderd together so i havent played with that one yet. but sparkfun is fixing the issue. one of my homemade modules work and one dosent.

on thing that i know is wrong is tha inductor for the matched antenna network i used a 3.9mh instead of 3.3 it could be that or another cold solder.

i have communication kind of working now execpt that i dont get the same data back that i send. could be that there is alot of disturbance here im going to try som different channels later,