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

Query related to pairing NRF24 Device to HOST using button.

Dear all,

Greetings!!!

I am using the NRF24LE1E module. I want to pair my device with host using a button. Button is available on device side. Please help me to do it. Please share the solution links related to this task.

Parents
  • Thank you very much . This helped me a lot. Now I am confused about how to set the id of Host and Device. Now I am stuck at this point. If any support is provided, I will be grateful. 

    Thanks again,

    Nitesh Dubey

  • Hi,

     

    In nRFgo SDK, under docs, there's a documentation file nrf_sdk.chm.

    Here you can find detailed information about how both Gazell and GZP works, under modules ->firmware -> RF protocol -> Gazell Pairing Library.

    Here it is, in case you don't have it:

    0121.docs_nrfgo_sdk_v2.3.0.10040.zip

    Nitesh Dubey said:
    Now I am confused about how to set the id of Host and Device. Now I am stuck at this point. If any support is provided, I will be grateful. 

    Which ID? Is there anything specific that is unclear?

     

    Kind regards,

    Håkon

      

  • I want to give a unique ID to each device (multiple hosts and multiple devices). If I will press buttons on host and device simultaneously, then they will get paired using this unique ID. Once they will get paired, only these two will communicate and other will get restricted.

  • The device sends a request, as per the functions in my first post.

    The host, can choose to accept this, like this:

        // If Host ID request received
        if(gzp_id_req_received())
        {
          // Always grant request
          gzp_id_req_grant();
        }
     

     

    If you do not want to disable new pairing entries, you can disable the pairing pipe on the host using the function gzp_pairing_enable()

     

    Kind regards,

    Håkon

  • Thanks for your support. But, still the problem is same. Two or more deices getting paired with on host. This causes the out to fluctuate.

    #include "gzll_mcu.h"
    #include "gzll.h"
    #include "gzp.h"
    
    #ifdef GZP_CRYPT_DISABLE
    #error This example project uses gzp_crypt, please remove the definition "GZP_CRYPT_DISABLE".
    #endif
    
    void main(void)
    {
      bool send_crypt_data = false;
      bool tx_success = false;
      gzp_id_req_res_t id_req_status;
      uint8_t payload[GZLL_MAX_PAYLOAD_LENGTH];
      
      mcu_init();
      
      // Initialize Gazell Link Layer
      gzll_init();
      
      // Initialize Gazell Pairing Library
      gzp_init();
    
      EA = 1;
    
      for(;;)
      {      
        payload[0] = P0;
        
        // Send every other packet as encrypted data  
        
        if(send_crypt_data)
        {
          // Send encrypted packet using the Gazell pairing library
          tx_success = gzp_crypt_data_send(payload, GZP_ENCRYPTED_USER_DATA_MAX_LENGTH);
        }
    
        else
        
        {
          // Send packet as plaintext on pipe 2
          gzll_tx_data(payload, GZLL_MAX_FW_PAYLOAD_LENGTH, 2);   
          while(gzll_get_state() != GZLL_IDLE){
          }
          tx_success = gzll_tx_success();
        }
        send_crypt_data = !send_crypt_data;
    
        // If data transfer failed
        if(!tx_success)
        {
          // Send "system address request". Needed for sending any user data to Host.
          gzp_address_req_send();
          
          // Send "Host ID request". Needed for sending encrypted user data to host.
          id_req_status = gzp_id_req_send();
        }
    
        // If waiting for Host to grant or reject ID request
        if(id_req_status == GZP_ID_RESP_PENDING)
        {
          // Send new ID request for fetching response
          id_req_status = gzp_id_req_send();
        }
      }  
    }

    //program for device
    
    #include "gzll_mcu.h"
    #include "gzll.h"
    #include "gzp.h"
    
    #ifdef GZP_CRYPT_DISABLE
    #error This example project uses gzp_crypt, please remove the definition "GZP_CRYPT_DISABLE".
    #endif
    
    void main(void)
    {
      bool send_crypt_data = false;
      bool tx_success = false;
      gzp_id_req_res_t id_req_status;
      uint8_t payload[GZLL_MAX_PAYLOAD_LENGTH];
      
      mcu_init();
      
      // Initialize Gazell Link Layer
      gzll_init();
      
      // Initialize Gazell Pairing Library
      gzp_init();
    
      EA = 1;
    
      for(;;)
      {      
        payload[0] = P0;
        
        // Send every other packet as encrypted data  
        
        if(send_crypt_data)
        {
          // Send encrypted packet using the Gazell pairing library
          tx_success = gzp_crypt_data_send(payload, GZP_ENCRYPTED_USER_DATA_MAX_LENGTH);
        }
    
        else
        
        {
          // Send packet as plaintext on pipe 2
          gzll_tx_data(payload, GZLL_MAX_FW_PAYLOAD_LENGTH, 2);   
          while(gzll_get_state() != GZLL_IDLE){
          }
          tx_success = gzll_tx_success();
        }
        send_crypt_data = !send_crypt_data;
    
        // If data transfer failed
        if(!tx_success)
        {
          // Send "system address request". Needed for sending any user data to Host.
          gzp_address_req_send();
          
          // Send "Host ID request". Needed for sending encrypted user data to host.
          id_req_status = gzp_id_req_send();
        }
    
        // If waiting for Host to grant or reject ID request
        if(id_req_status == GZP_ID_RESP_PENDING)
        {
          // Send new ID request for fetching response
          id_req_status = gzp_id_req_send();
        }
      }  
    }

Reply
  • Thanks for your support. But, still the problem is same. Two or more deices getting paired with on host. This causes the out to fluctuate.

    #include "gzll_mcu.h"
    #include "gzll.h"
    #include "gzp.h"
    
    #ifdef GZP_CRYPT_DISABLE
    #error This example project uses gzp_crypt, please remove the definition "GZP_CRYPT_DISABLE".
    #endif
    
    void main(void)
    {
      bool send_crypt_data = false;
      bool tx_success = false;
      gzp_id_req_res_t id_req_status;
      uint8_t payload[GZLL_MAX_PAYLOAD_LENGTH];
      
      mcu_init();
      
      // Initialize Gazell Link Layer
      gzll_init();
      
      // Initialize Gazell Pairing Library
      gzp_init();
    
      EA = 1;
    
      for(;;)
      {      
        payload[0] = P0;
        
        // Send every other packet as encrypted data  
        
        if(send_crypt_data)
        {
          // Send encrypted packet using the Gazell pairing library
          tx_success = gzp_crypt_data_send(payload, GZP_ENCRYPTED_USER_DATA_MAX_LENGTH);
        }
    
        else
        
        {
          // Send packet as plaintext on pipe 2
          gzll_tx_data(payload, GZLL_MAX_FW_PAYLOAD_LENGTH, 2);   
          while(gzll_get_state() != GZLL_IDLE){
          }
          tx_success = gzll_tx_success();
        }
        send_crypt_data = !send_crypt_data;
    
        // If data transfer failed
        if(!tx_success)
        {
          // Send "system address request". Needed for sending any user data to Host.
          gzp_address_req_send();
          
          // Send "Host ID request". Needed for sending encrypted user data to host.
          id_req_status = gzp_id_req_send();
        }
    
        // If waiting for Host to grant or reject ID request
        if(id_req_status == GZP_ID_RESP_PENDING)
        {
          // Send new ID request for fetching response
          id_req_status = gzp_id_req_send();
        }
      }  
    }

    //program for device
    
    #include "gzll_mcu.h"
    #include "gzll.h"
    #include "gzp.h"
    
    #ifdef GZP_CRYPT_DISABLE
    #error This example project uses gzp_crypt, please remove the definition "GZP_CRYPT_DISABLE".
    #endif
    
    void main(void)
    {
      bool send_crypt_data = false;
      bool tx_success = false;
      gzp_id_req_res_t id_req_status;
      uint8_t payload[GZLL_MAX_PAYLOAD_LENGTH];
      
      mcu_init();
      
      // Initialize Gazell Link Layer
      gzll_init();
      
      // Initialize Gazell Pairing Library
      gzp_init();
    
      EA = 1;
    
      for(;;)
      {      
        payload[0] = P0;
        
        // Send every other packet as encrypted data  
        
        if(send_crypt_data)
        {
          // Send encrypted packet using the Gazell pairing library
          tx_success = gzp_crypt_data_send(payload, GZP_ENCRYPTED_USER_DATA_MAX_LENGTH);
        }
    
        else
        
        {
          // Send packet as plaintext on pipe 2
          gzll_tx_data(payload, GZLL_MAX_FW_PAYLOAD_LENGTH, 2);   
          while(gzll_get_state() != GZLL_IDLE){
          }
          tx_success = gzll_tx_success();
        }
        send_crypt_data = !send_crypt_data;
    
        // If data transfer failed
        if(!tx_success)
        {
          // Send "system address request". Needed for sending any user data to Host.
          gzp_address_req_send();
          
          // Send "Host ID request". Needed for sending encrypted user data to host.
          id_req_status = gzp_id_req_send();
        }
    
        // If waiting for Host to grant or reject ID request
        if(id_req_status == GZP_ID_RESP_PENDING)
        {
          // Send new ID request for fetching response
          id_req_status = gzp_id_req_send();
        }
      }  
    }

Children
Related