This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF24L01+ -> nRF24LU1+ RF communication.

HI.

I want to send data from nRF24L01 + to RF communication and receive it from nRF24LU1 +. The nRF24L01 + is connected to the STM32. The settings are as follows.

nRF24L01+ code

#if (DEMO_TX_SINGLE)

// The transmitter sends a 5-byte packets to the address '0xE7 0x1C 0xE3' without Auto-ACK (ShockBurst disabled)

// Disable ShockBurst for all RX pipes
nRF24_DisableAA(0xFF);

// Set RF channel
nRF24_SetRFChannel(2);

// Set data rate
nRF24_SetDataRate(nRF24_DR_1Mbps);

// Set CRC scheme
nRF24_SetCRCScheme(nRF24_CRC_1byte);

// Set address width, its common for all pipes (RX and TX)
nRF24_SetAddrWidth(5);

// Configure TX PIPE
static const uint8_t nRF24_ADDR[] = { 0xE7,0xE7,0xE7,0xE7,0xE7 };
nRF24_SetAddr(nRF24_PIPETX, nRF24_ADDR); // program TX address

// Set TX power (maximum)
nRF24_SetTXPower(nRF24_TXPWR_0dBm);

// Set operational mode (PTX == transmitter)
nRF24_SetOperationalMode(nRF24_MODE_TX);

// Clear any pending IRQ flags
nRF24_ClearIRQFlags();

// Wake the transceiver
nRF24_SetPowerMode(nRF24_PWR_UP);


// The main loop
j = 0;
payload_length = 4;

  
while (1) {
    // Prepare data packet

	for (i = 0; i < payload_length; i++) {
		nRF24_payload[i] = j++;
		if (j > 0x000000FF) j = 0;
	}

  
	// Print a payload
	UART_SendStr("PAYLOAD:>");
	UART_SendBufHex((char *)nRF24_payload, payload_length);
	UART_SendStr("< ... TX: ");

	// Transmit a packet
	tx_res = nRF24_TransmitPacket(nRF24_payload, payload_length);
	switch (tx_res) {
		case nRF24_TX_SUCCESS:
			UART_SendStr("OK");
                            UART_SendInt(nnum);
                            nnum++;
			break;
		case nRF24_TX_TIMEOUT:
			UART_SendStr("TIMEOUT");
			break;
		case nRF24_TX_MAXRT:
			UART_SendStr("MAX RETRANSMIT");
			break;
		default:
			UART_SendStr("ERROR");
			break;
	}
	UART_SendStr("\r\n");

	// Wait ~0.5s
	Delay();
}

The nRF24LU1 + code received the nAN-22 from the Nordic website. www.nordicsemi.com/.../nRF24LU1P

nRF24LU1+ code

void main()
{
	// Enable radio SPI
	 RFCTL = 0x10;
	
	// Enable the radio clock
  RFCKEN = 1;

		  // Enable RF interrupt
  RF = 1;

  // Enable global interrupt
  EA = 1;

  // Initialize RF device
  rf_init(); 

  //en_aa disable
	hal_nrf_open_pipe(HAL_NRF_PIPE1, false);
	
	//ARC 0x00; to diable enhanced shockbuck
	//hal_nrf_set_auto_retr(HAL_NRF_PIPE0,0x0000);
	
	// Set RF channel
	hal_nrf_set_rf_channel(2);
	
	// Set data rate
	hal_nrf_set_datarate(HAL_NRF_1MBPS);
	
	
	// Set CRC scheme
	hal_nrf_set_crc_mode(HAL_NRF_CRC_8BIT);
	
	// Set address width
		hal_nrf_set_address_width(HAL_NRF_AW_5BYTES);
		
	// Set pipe address
  hal_nrf_set_address(HAL_NRF_PIPE1, default_pipe_address);

	
	// Set TX power for Auto-ACK (maximum, to ensure that transmitter will hear ACK reply)
	//hal_nrf_set_output_power(HAL_NRF_0DBM);
	
	
	// Set payload width to 4 bytes
  hal_nrf_set_rx_payload_width(HAL_NRF_PIPE1, 4);
	
		// Set operational mode (PRX == receiver)
	hal_nrf_set_operation_mode(HAL_NRF_PRX);
	
    // Power up radio
  hal_nrf_set_power_mode(HAL_NRF_PWR_UP);
	
	delay_us(150);
	
	// Enable receiver
  CE_HIGH();
	
	delay_us(130);

while(true) { }
}
  • To receive data from the nRF24LU1 + via RF communication, should I send data via USB?

I just want to receive the data, so I set it as follows app_state = APP_SEARCHING;

However, nRF24LU1 + does not pass to APP_CONNECTED.

hal_nrf_set_crc_mode
hal_nrf_set_address
hal_nrf_set_address_width
hal_nrf_set_rf_channel

Even though I applied the same function above to the main function, it doesn't work either.

I want to know what went wrong. Thank you.

Parents
  • Thanks for updating the case, the address setting was much different before the update.

    From the configuration you sent I can't find anything wrong with that.

    My suggestions are:

    • Try to test with no CRC. This is to check if there is lots of interference or if the radio on the nRF24LU1 was not good. Have you tried to use 2 nRF24LU1/LE1 to talk to each other ?

    • Read the radio configuration register on the L01 and compare with the register on the LU1. This is to verify that the writing from the STM to the L01 was correct. And so that we can reproduce here.

  • I turned off CRC, It worked really well !!

    Thank you so much.

    You were a great help to me

    Are you a genius? or you must be a saviour of mankind.

    If you don't mind, could you tell me how to figure out the solution?

    It said "The CRC is the error detection mechanism in the packet." in the datasheet. What role does it play in communication?

    Again, Thank you so much and I really appreciate for your help.

Reply
  • I turned off CRC, It worked really well !!

    Thank you so much.

    You were a great help to me

    Are you a genius? or you must be a saviour of mankind.

    If you don't mind, could you tell me how to figure out the solution?

    It said "The CRC is the error detection mechanism in the packet." in the datasheet. What role does it play in communication?

    Again, Thank you so much and I really appreciate for your help.

Children
No Data
Related