AnsweredAssumed Answered

how to nRF24L01 using kl25z?

Question asked by Gabriel Takaoka Nishimura on Nov 13, 2014
Latest reply on Nov 15, 2014 by Gabriel Takaoka Nishimura

Hey guys I'm trying to implement a simple transmitter using the KL25Z and the Nordic nRF24L01.

The KL25Z is the transmitter and a Arduino is a receiver (which I've successfuly got it working arduino x arduino) :

Arduino x KL25Z is not working well though. I'm using this tutorial and configuring the sender like this:

 

#define PAYLOAD_SIZE 8  /* number of payload bytes, 0 to 32 bytes */
#define CHANNEL_NO   76  /* communication channel */
static const uint8_t TADDR[5] = {0x0F, 0x0F, 0x0F, 0xD2, 0xD2}; /* device address */
static const uint8_t RADDR[5] = {0x0f, 0x0f, 0x0f, 0x0f, 0xd1}; /* device address */
static uint8_t payload[PAYLOAD_SIZE]; /* buffer for payload */


 

RF_Init(); /* set CE and CSN to initialization value */

  RF_WriteRegister(RF24_RF_SETUP, RF24_RF_SETUP_RF_PWR_0|RF24_RF_SETUP_RF_DR_1000);
  RF_WriteRegister(RF24_RX_PW_P0, PAYLOAD_SIZE); /* number of payload bytes we want to send and receive */
  RF_WriteRegister(RF24_RX_PW_P1, PAYLOAD_SIZE); /* number of payload bytes we want to send and receive */
  RF_WriteRegister(RF24_RF_CH, CHANNEL_NO); /* set channel */

  /* Set RADDR and TADDR as the transmit address since we also enable auto acknowledgment */
  RF_WriteRegisterData(RF24_RX_ADDR_P0, (uint8_t*)TADDR, sizeof(TADDR));
  RF_WriteRegisterData(RF24_TX_ADDR, (uint8_t*)TADDR, sizeof(TADDR));
  RF_WriteRegisterData(RF24_RX_ADDR_P1, (uint8_t*)RADDR, sizeof(RADDR));

  /* Enable RX_ADDR_P0 address matching */
  RF_WriteRegister(RF24_EN_RXADDR, RF24_EN_RXADDR_ERX_P0 | RF24_EN_RXADDR_ERX_P1); /* hoping that P0 and P1 are enabled by now */

/* clear interrupt flags */
  RF_ResetStatusIRQ(RF24_STATUS_RX_DR|RF24_STATUS_TX_DS|RF24_STATUS_MAX_RT);

RF_WriteRegister(RF24_EN_AA, RF24_EN_AA_ENAA_P0); /* enable auto acknowledge. RX_ADDR_P0 needs to be equal to TX_ADDR! */
  RF_WriteRegister(RF24_SETUP_RETR, RF24_SETUP_RETR_ARD_750|RF24_SETUP_RETR_ARC_15); /* Important: need 750 us delay between every retry */
  TX_POWERUP();  /* Power up in transmitting mode */
  CE_ClrVal();   /* Will pulse this later to send data */


 

Now for the problems.

1) Is this the right way to configure channels?

  RF_WriteRegister(RF24_RF_CH, CHANNEL_NO); /* set channel */


 

2) How should I enable P0 AND P1 (if I need to receive)?

  RF_WriteRegister(RF24_EN_RXADDR, RF24_EN_RXADDR_ERX_P0 | RF24_EN_RXADDR_ERX_P1); /* hoping that P0 and P1 are enabled by now */

 

3) Is there any bad choice of pins? I tried the same as the tutorial. (but when trying to implement in MBED they said to avoid PTD1 - Blue LED)

 

4) How do I know if the message was successfuly sent? In arduino there's a function that returns true if success

Outcomes