SparkFun Forums 

Where electronics enthusiasts find answers.

All things pertaining to wireless and RF links
By jele
#41962
hi everybody :lol:
1) I test tutorial 2 (from diyembedded.com )i send data package(100 byte) but it return is 98 byte and data not sure , Why?.

2) I test tutorial 3(Multiple pipe) i ping each pipe and data is loss and i change position is faraway ([Remote] ---------------10 m-------------[Local]) it can ping about 10 % and some pipe ,Why?

MCU p18F8720 , clock 40 MHz PLL ,Wireless DCBT-24N(chip nrf24l01) , boudrate 9600 bps, and good toturial from www.diyembedded.com

Thank you all!
By brennen
#41967
In RF in general, you're going to lose some packets, mainly due to other RF interference, physical objects between receiver and transmitter, or not enough TX power for the distance that seperates the transmitter and receiver. 2.4 GHz is a bit notorious for not being able to go through walls, etc.

The easiest and cheapest way to get around dropped packets with the 24L01 is to use the auto-acknowledge and auto-retransmit features that are built into the hardware. This costs virtually nothing in terms of software, except that you have to make sure that the packet that you tried to send was actually received on the other end.

Other ways to help with dropped packets are to use antennas with higher gain (whip antennas will generally perform far better than chip antennas) or even to go as far as to use an external power amplifier (Nordic has an app note for adding a PA to a 2401A, but this could easily be modified to be used with the 24L01).
By jele
#42072
Hi

When i send data package >3 Byte data is change position

I sent 1234567890
but it recceive is 9012345678

or
Sent 12345
Receive 45123

This my code
LOCAL::
while(1)//main program loop
{
data = 0;
if(DataRdy1USART( ))
{
data = getc1USART();

nrf24l01_write_tx_payload(&data, 1, true);
while(Busy1USART( ));
while(!(nrf24l01_irq_pin_active() && nrf24l01_irq_tx_ds_active()));

nrf24l01_irq_clear_all();
}

ToggleLED(); //toggle the on-board LED as visual indication that the loop has completed

}//While(1)..
nrf24l01_initialize(nrf24l01_CONFIG_DEFAULT_VAL | nrf24l01_CONFIG_PWR_UP, //1 byte CRC, powered up
true, //enable CE
nrf24l01_EN_AA_ENAA_NONE, //Disable auto-ack on all pipes
nrf24l01_EN_RXADDR_DEFAULT_VAL, //enable receive on all pipes
nrf24l01_SETUP_AW_DEFAULT_VAL, //5-byte addressing
nrf24l01_SETUP_RETR_DEFAULT_VAL, //not using auto-ack, so use default
nrf24l01_RF_CH_DEFAULT_VAL, //RF channel 3
nrf24l01_RF_SETUP_DEFAULT_VAL, //2 Mbps, 0 dBm
NULL, //nrf24l01_RX_ADDR_P0_DEFAULT_VAL(E7:E7:E7:E7:E7)
NULL, //nrf24l01_RX_ADDR_P1_DEFAULT_VAL(C2:C2:C2:C2:C2)
nrf24l01_RX_ADDR_P2_DEFAULT_VAL, //(C2:C2:C2:C2:[C3])
nrf24l01_RX_ADDR_P3_DEFAULT_VAL, //(C2:C2:C2:C2:[C4])
nrf24l01_RX_ADDR_P4_DEFAULT_VAL, //(C2:C2:C2:C2:[C5])
nrf24l01_RX_ADDR_P5_DEFAULT_VAL, //(C2:C2:C2:C2:[C6])
NULL, //default TX address(E7:E7:E7:E7:E7)
1, //1 byte paylaod width on pipe 0
nrf24l01_RX_PW_P1_DEFAULT_VAL, //0x00
nrf24l01_RX_PW_P2_DEFAULT_VAL, //0x00
nrf24l01_RX_PW_P3_DEFAULT_VAL, //0x00
nrf24l01_RX_PW_P4_DEFAULT_VAL, //0x00
nrf24l01_RX_PW_P5_DEFAULT_VAL); //0x00


REMOTE::
while(TRUE)
{

//wait until a packet has been received
while(!(nrf24l01_irq_pin_active() && nrf24l01_irq_rx_dr_active()));

nrf24l01_read_rx_payload(&data, 1); //read the packet into data
nrf24l01_irq_clear_all(); //clear all interrupts in the 24L01
putc1USART(data);

ToggleLED(); //toggle the on-board LED as visual indication that the loop has completed
} // While True ....
nrf24l01_initialize(nrf24l01_CONFIG_DEFAULT_VAL | nrf24l01_CONFIG_PWR_UP | nrf24l01_CONFIG_PRIM_RX, //1 byte CRC, powered up, RX
true, //enable CE
nrf24l01_EN_AA_ENAA_NONE, //disable auto-ack on all pipes
nrf24l01_EN_RXADDR_ERX_ALL, //enable receive on all pipes
nrf24l01_SETUP_AW_DEFAULT_VAL, //5-byte addressing
nrf24l01_SETUP_RETR_DEFAULT_VAL, //not using auto-ack, so use default
nrf24l01_RF_CH_DEFAULT_VAL, //RF channel 3
nrf24l01_RF_SETUP_DEFAULT_VAL, //2 Mbps, 0 dBm
NULL, //nrf24l01_RX_ADDR_P0_DEFAULT_VAL(E7:E7:E7:E7:E7)
NULL, //nrf24l01_RX_ADDR_P1_DEFAULT_VAL(C2:C2:C2:C2:C2)
nrf24l01_RX_ADDR_P2_DEFAULT_VAL, //(C2:C2:C2:C2:[C3])
nrf24l01_RX_ADDR_P3_DEFAULT_VAL, //(C2:C2:C2:C2:[C4])
nrf24l01_RX_ADDR_P4_DEFAULT_VAL, //(C2:C2:C2:C2:[C5])
nrf24l01_RX_ADDR_P5_DEFAULT_VAL, //(C2:C2:C2:C2:[C6])
NULL, //default TX address(E7:E7:E7:E7:E7)
1, //1 byte paylaod width on all 6 pipes
1, //""
1, //""
1, //""
1, //""
1); //""