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

      

  • 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();
        }
      }  
    }

  • This is a restriction with gazell and gzp.

    There is only one device that can be used for an encrypted pipe. If you allow two devices to connect and request the "Host ID", the former will be overwritten.

  • Thanks for your support. I am using more than two pairs of host and device. Let me explain again, I named them as D1 and D2 to two devices and H1 and H2 to two hosts. There is buttons on host and devices for pairing. Now, If I want to pair H1 with D1 then I will press the buttons on H1 and D1 and same for H2 and D2. 

    If I will press buttons on H1 and D2 then they will get paired and H1 and D1 will get free.

    Please suggest some solutions and ideas if any.

    It will be appreciable.

  • Hi,

     

    Nitesh Dubey said:
    If I will press buttons on H1 and D2 then they will get paired and H1 and D1 will get free.

    H1 and D2 can pair because they share the same configuration, just like H2 and D1 does as well.

    Gazell was designed for desktop usages (keyboard, mice, remotes etc) in such a way that your devices should be able to re-pair again, if the user wanted this.

    You can have a check in your application, where you set a variable when a host_id has been accepted, and afterwards reject any incoming HostID requests. However; this method needs added logic in case you really want to re-pair the host and the device further down the line. I would recommend doing specific tests on this, to understand what gazell can offer, and what it does not offer, in your specific scenario.

     

    Kind regards,

    Håkon

Reply Children
No Data
Related