This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Central Device Discovery/Establishing Connection Parameters

Hello,

I know that a number of these items within this post have been discussed elsewhere, but I have yet to find a post that adequately answers my questions.  Please feel free to refer me to posts that I may have missed.

I am designing system that has very tight power constraints.  As such I have defined the following parameters:

  • Scanning Interval 5 minutes
  • Scanning Window 6.6 seconds ( this window has the ability to catch 2 advertisements)

Scan Interval Count = ( 5 min * 60 sec/min * 1000 ms/sec ) / ( 0.625 ms/cnt ) = 480,000 à 19-bits

Since, my scan interval cannot be represented by a 16-bit count, I am using a OSAL timer to manage when I call the GAPCentralRole_StartDiscovery function.  This has worked fairly well, especially since the completion of the discovery procedure is indicated by the GAP_DEVICE_DISCOVERY_EVENT.

If the device address is known, I would like to use the GAPCentralRole_EstablishLink function with the same timing parameters.  This has been a bit more difficult, because there isn’t an event tied to the “completion” of connection establishment scan window.

So, my question to the community are

1)     How would you recommend accomplishing this if the TGAP*SCAN_INT parameters are essentially useless?

2)     How can you specify limited verse general discovery/establishment procedures?

I’ve had limited success doing the following:

SetupScanning( 6600, 300000 );

static void SetupScanning( uint32 setScanWindowMs,

                           uint32 setScanIntervalMs)

{

    scanWindowMs   = setScanWindowMs;

    scanIntervalMs = setScanIntervalMs;

 

    uint16 winCnt = (uint16) ( ( MS_PER_SEC * setScanWindowMs )

                               / (uint32) 625 );

 

    HAL_ASSERT( winCnt != 0 );

 

    // Scanning/Discovery Parameters

    GAP_SetParamValue( TGAP_GEN_DISC_SCAN,

                       scanWindowMs );

 

    GAP_SetParamValue( TGAP_LIM_DISC_SCAN,

                       scanWindowMs );

 

    GAP_SetParamValue( TGAP_CONN_SCAN_INT,

                       winCnt );

 

    GAP_SetParamValue( TGAP_CONN_SCAN_WIND,

                       winCnt );

 

    GAP_SetParamValue( TGAP_CONN_HIGH_SCAN_INT,

                       winCnt );

 

    GAP_SetParamValue( TGAP_CONN_HIGH_SCAN_WIND,

                       winCnt );

 

    GAP_SetParamValue( TGAP_GEN_DISC_SCAN_INT,

                       winCnt );

 

    GAP_SetParamValue( TGAP_GEN_DISC_SCAN_WIND,

                       winCnt );

 

    GAP_SetParamValue( TGAP_LIM_DISC_SCAN_INT,

                       winCnt );

 

    GAP_SetParamValue( TGAP_LIM_DISC_SCAN_WIND,

                       winCnt );

 

    GAP_SetParamValue( TGAP_CONN_EST_SCAN_INT,

                       winCnt );

 

    GAP_SetParamValue( TGAP_CONN_EST_SCAN_WIND,

                       winCnt );

}

Thanks for your help!

  • Hi J,

    Maybe you have understood scan window/interval or maybe not, but the way scanning and also initiating (scanning with intent to establish) works is

    |<Scan Win 5ms>        Scan Interv 15ms              >(xN)<Scan Wind 5ms>        Scan Interv 15ms              >|

    Where everything between || is the scan duration, the scan interval is the time between starting active scan and scan window is how long the scan is active.

    Unfortunately there is no timeout for the connection establishment procedure, but window/interval works the same. So I'd suggest starting an OSAL timer, which you then stop if the connection is made, or if it's triggered, you call GAP_TerminateLinkReq(..) to stop the establishment.

    BR,
    Aslak