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.

CCS/CC2640: iphone can not pair with CC2640 when PTM is added

Part Number: CC2640

Tool/software: Code Composer Studio

According to 《Using Production Test Mode (PTM)》, PTM is added into simple_peripheral project . Then following another post in E2E to solve the problem of building failed . That
post can be got in "6 attachments". Configuring pairMode to GAPBOND_PAIRING_MODE_INITIATE , so that the pair request can be shown in my cellphone . However , the pair request can only be
shown android phone , instead of iphone . Where am I wrong ?

My detailed steps:

1,According to 《Using Production Test Mode (PTM)》, adding PTM into simple_peripheral project.As shown in picture 1 .《Using Production Test Mode (PTM)》can be got in "7 attachments".

picture 1

2,Following another post in E2E to solve the problem of building failed .As shown in picture 2 . That post can be got in "7 attachments".

picture 2

3,Configuring pairMode PTM_ENABLE_FLAG to TRUE, so that the PTM is opened , and CC2640 can not advertise . PTM works normally , as shown in picture 3 .

#define PTM_ENABLE_FLAG                       TRUE   /*PTM ENABLE FLAG*/

static void SimpleBLEPeripheral_init(void)
{
  ........
  if(PTM_ENABLE_FLAG)
  {
      /* Intercept NPI RX events. */
      NPITask_registerIncomingRXEventAppCB(SBP_handleNPIRxInterceptEvent, INTERCEPT);

      /* Register for Command Status information */
      HCI_TL_Init(NULL, (HCI_TL_CommandStatusCB_t) SBP_sendToNPI, NULL, selfEntity);

      /* Register for Events */
      HCI_TL_getCmdResponderID(ICall_getLocalMsgEntityId(ICALL_SERVICE_CLASS_BLE_MSG, selfEntity));

      HCI_EXT_EnablePTMCmd(); /* Inform Stack to Initialize PTM */

  }

}

picture 3

4,Configuring pairMode PTM_ENABLE_FLAG to FALSE ,  so that the PTM can be closed , and CC2640 can advertise normally . 

#define PTM_ENABLE_FLAG                       FALSE   /*PTM ENABLE FLAG*/

5,Configuring pairMode to GAPBOND_PAIRING_MODE_INITIATE , so that the pair request can be shown in my android cellphone .As shown in picture 4 .

static void SimpleBLEPeripheral_init(void)
{
    ......
    uint8_t pairMode = GAPBOND_PAIRING_MODE_INITIATE;
    .......
}

picture 4

6,However , when iphone connected to CC2640 , the pair request can never be shown . Where am I wrong ?

7.ATTACHMENTS:
(1)The link of《Using Production Test Mode (PTM)》 at simplelink_cc2640r2_sdk_1_40_00_45:
file:///C:/ti/simplelink_cc2640r2_sdk_1_40_00_45/docs/blestack/ble_user_guide/html/ble-stack-3.x/creating-a-custom-bluetooth-low-energy-application.html#using-production-test-mode-ptm

(2)the link of simple_peripheral in my computer:
C:\ti\simplelink_cc2640r2_sdk_1_40_00_45\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral

(3)simplelink_cc2640r2_sdk_1_40_00_45 can be downloader here:
dev.ti.com/.../

(4)CC2640R2 launchpad can be bought here:
www.ti.com/.../launchxl-cc2640r2

(5)The post in E2E to solve the problem of building failed can be got here:
e2e.ti.com/.../676779

(6) The link of teaching video of PTM:
training.eeworld.com.cn/.../9105

8、My Developing environment :
CCS:Code Composer Studio 7.2.0
SDK:simplelink_cc2640r2_sdk_1_40_00_45
hardware:CC26640R2 launchpad develop kit
VS: Microsoft Visual C++ 2010 Express
system:win7 64 bit

  • The reason why pairing request can never be shown in iphone is that NPITask_createTask() function has not been closed . The problem can be solved by bsing PTM_ENABLE_FLAG to close NPITask_createTask() function . 

    int main()
    {
    ...............
    
      ICall_init();
      ICall_createRemoteTasks(); /* Start tasks of external images - Priority 5 */
    
      /* Start task for NPI task */
      if(PTM_ENABLE_FLAG)
      {
          NPITask_createTask(ICALL_SERVICE_CLASS_BLE);
      }
    ...............
    }

  • 1.When using PIN_getInputValue(CC2640R2_LAUNCHXL_SPI0_SRDY) instead of PTM_ENABLE_FLAG , the code snipper is shown as followed ,  the problem that iphone cannot pair with CC2640 will appear again . The real reason why iphone cannot pair with CC2640 after adding PTM into simple_peripheral project is that SRAM is not enough . 

    /********************* main.c ********************************/
      if(PTM_ENABLE_FLAG)
      {
          NPITask_createTask(ICALL_SERVICE_CLASS_BLE);
      }
    
    /********************* main.c ********************************/
      if(PIN_getInputValue(CC2640R2_LAUNCHXL_SPI0_SRDY))
      {
          NPITask_createTask(ICALL_SERVICE_CLASS_BLE);
      }


    2.This problem can be solved by configuring the CACHE as GPRAM . The official doc in SDK named in 《Cache/GPRAM》 has shown how to configure the CACHE as GPRAM, as shown in picture 1 .Location of 《Cache/GPRAM》 is shown in attachments.

    3.Memory allocation of CC2640 can be seen from "CCS-view-memory allocation", as shown in picture 2.

  • Location of 《Cache/GPRAM》in my computer:
    file:///C:/ti/simplelink_cc2640r2_sdk_1_40_00_45/docs/blestack/ble_user_guide/html/cc2640/memory_management.html#cache-gpram