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/CC2640R2F: PTM in ble5_simple_peripheral_cc2640r2lp_app

Part Number: CC2640R2F

Tool/software: Code Composer Studio

In the project of ble5_simple_peripheral_cc2640r2lp_app,the PTM can be accessed by right-click triggering, but I want to execute "SimplePeripheral_doEnablePTMMode(1);" in SimplePeripheral_init function to access PTM. After opening with btool, the reset command has no response, and the other HCI commands cannot be used to control Bluetooth. What is the cause of this?How to enter PTM directly after the equipment startup?

  • Hello User,

    Did you read and follow the description in the users guide:

    http://dev.ti.com/tirex/explore/content/simplelink_cc2640r2_sdk_4_10_00_10/docs/ble5stack/ble_user_guide/html/ble-stack-5.x/creating-a-custom-bluetooth-low-energy-application-cc2640.html?highlight=ptm#production-test-mode-ptm 

    This mode is used by the customer during assembly of their product to allow limited access to the BLE Controller for testing and configuration. The commands available in PTM mode can be found in icall_hci_tl.c:

    #elif defined (PTM_MODE)
    static hciEntry_t hciTranslationTable[] =
    {
    #ifndef LEGACY_CMD
      // Controller and Baseband Commands
      HCI_TRANSLATION_ENTRY(HCI_RESET,                                     IDX_CAST IDX_HCI_ResetCmd,                                 HNP,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP),
    #endif // LEGACY_CMD
    
      // LE Commands - Direct Test Mode
      HCI_TRANSLATION_ENTRY(HCI_LE_RECEIVER_TEST,                          IDX_CAST IDX_HCI_LE_ReceiverTestCmd,                       HU8,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP),
      HCI_TRANSLATION_ENTRY(HCI_LE_TRANSMITTER_TEST,                       IDX_CAST IDX_HCI_LE_TransmitterTestCmd,                    HU8,     HU8,     HU8,     HNP,     HNP,     HNP,     HNP,     HNP),
      HCI_TRANSLATION_ENTRY(HCI_LE_TEST_END,                               IDX_CAST IDX_HCI_LE_TestEndCmd,                            HNP,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP),
      HCI_TRANSLATION_ENTRY(HCI_EXT_MODEM_TEST_TX,                         IDX_CAST IDX_HCI_EXT_ModemTestTxCmd,                       HU8,     HU8,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP),
      HCI_TRANSLATION_ENTRY(HCI_EXT_MODEM_HOP_TEST_TX,                     IDX_CAST IDX_HCI_EXT_ModemHopTestTxCmd,                    HNP,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP),
      HCI_TRANSLATION_ENTRY(HCI_EXT_MODEM_TEST_RX,                         IDX_CAST IDX_HCI_EXT_ModemTestRxCmd,                       HU8,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP),
      HCI_TRANSLATION_ENTRY(HCI_EXT_ENHANCED_MODEM_TEST_TX,                IDX_CAST IDX_HCI_EXT_EnhancedModemTestTxCmd,               HU8,     HU8,     HU8,     HNP,     HNP,     HNP,     HNP,     HNP),
      HCI_TRANSLATION_ENTRY(HCI_EXT_ENHANCED_MODEM_HOP_TEST_TX,            IDX_CAST IDX_HCI_EXT_EnhancedModemHopTestTxCmd,            HU8,     HU8,     HU8,     HNP,     HNP,     HNP,     HNP,     HNP),
      HCI_TRANSLATION_ENTRY(HCI_EXT_ENHANCED_MODEM_TEST_RX,                IDX_CAST IDX_HCI_EXT_EnhancedModemTestRxCmd,               HU8,     HU8,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP),
      HCI_TRANSLATION_ENTRY(HCI_EXT_END_MODEM_TEST,                        IDX_CAST IDX_HCI_EXT_EndModemTestCmd,                      HNP,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP),
      HCI_TRANSLATION_ENTRY(HCI_EXT_SET_DTM_TX_PKT_CNT,                    IDX_CAST IDX_HCI_EXT_SetDtmTxPktCntCmd,                    HU16,    HNP,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP),
    
      // LE Commands - General
      HCI_TRANSLATION_ENTRY(HCI_READ_BDADDR,                               IDX_CAST IDX_HCI_ReadBDADDRCmd,                            HNP,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP),
      HCI_TRANSLATION_ENTRY(HCI_EXT_SET_BDADDR,                            IDX_CAST IDX_HCI_EXT_SetBDADDRCmd,                         HAB,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP),
      HCI_TRANSLATION_ENTRY(HCI_EXT_SET_TX_POWER,                          IDX_CAST IDX_HCI_EXT_SetTxPowerCmd,                        HU8,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP),
      HCI_TRANSLATION_ENTRY(HCI_EXT_SET_MAX_DTM_TX_POWER,                  IDX_CAST IDX_HCI_EXT_SetMaxDtmTxPowerCmd,                  HU8,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP),
      HCI_TRANSLATION_ENTRY(HCI_EXT_EXTEND_RF_RANGE,                       IDX_CAST IDX_HCI_EXT_ExtendRfRangeCmd,                     HNP,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP),
      HCI_TRANSLATION_ENTRY(HCI_EXT_HALT_DURING_RF,                        IDX_CAST IDX_HCI_EXT_HaltDuringRfCmd,                      HU8,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP),
      HCI_TRANSLATION_ENTRY(HCI_READ_TRANSMIT_POWER,                       IDX_CAST IDX_HCI_ReadTransmitPowerLevelCmd,                HU16,    HU8,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP),
      HCI_TRANSLATION_ENTRY(HCI_EXT_BUILD_REVISION,                        IDX_CAST IDX_HCI_EXT_BuildRevisionCmd,                     HU8,     HU16,    HNP,     HNP,     HNP,     HNP,     HNP,     HNP),
      HCI_TRANSLATION_ENTRY(HCI_LE_READ_TX_POWER,                          IDX_CAST IDX_HCI_LE_ReadTxPowerCmd,                        HNP,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP),
      HCI_TRANSLATION_ENTRY(HCI_LE_READ_RF_PATH_COMPENSATION,              IDX_CAST IDX_HCI_LE_ReadRfPathCompCmd,                     HNP,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP),
      HCI_TRANSLATION_ENTRY(HCI_LE_WRITE_RF_PATH_COMPENSATION,             IDX_CAST IDX_HCI_LE_WriteRfPathCompCmd,                    HU16,    HU16,    HNP,     HNP,     HNP,     HNP,     HNP,     HNP),
    
      // LE Commands - Production Test Mode
      HCI_TRANSLATION_ENTRY(HCI_EXT_ENABLE_PTM,                            IDX_CAST IDX_HCI_EXT_EnablePTMCmd,                         HNP,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP),
      HCI_TRANSLATION_ENTRY(HCI_EXT_SET_FREQ_TUNE,                         IDX_CAST IDX_HCI_EXT_SetFreqTuneCmd,                       HU8,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP),
      HCI_TRANSLATION_ENTRY(HCI_EXT_SAVE_FREQ_TUNE,                        IDX_CAST IDX_HCI_EXT_SaveFreqTuneCmd,                      HNP,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP),
      HCI_TRANSLATION_ENTRY(HCI_EXT_RESET_SYSTEM,                          IDX_CAST IDX_HCI_EXT_ResetSystemCmd,                       HU8,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP,     HNP),
    
    };

  • You need HCI_TL_FULL for it to work with BTool.

  • Hi, Eirik:

    I have read the document.We need to use PTM on the production line. I activated FlashROM_StackLibrary_PTM. In the project. In this compilation configuration, -DPTM_MODE is used, and-DHCI_TL_FULL cannot be configured at the same time. The compiled program can only enter PTM by right button triggering. After entering PTM, the device can be controlled by BTool using HCI command. However, it is unable to enter PTM directly after the equipment is started. The problem is: how to enter PTM directly after the equipment is started?

    Another problem is: using the compiled configuration of FlashROM_StackLibrary_PTM, when there is no access to PTM, the bluetooth device can only establish a connection, but cannot pair and transmit data.

  • Hello Henry,

    1)

    This mode will remain enabled until the device is reset. How will you revert back to normal operation when PTM is not needed?

    You can call SimplePeripheral_doEnablePTMMode() in SimplePeripheral_taskFxn() after SimplePeripheral_init().

    2)

    There is limited Flash/RAM on the C2640R2F and the BLE5 examples require more resource than the BLE3 examples. You might have Heap/stack issues:

    http://dev.ti.com/tirex/explore/content/simplelink_cc2640r2_sdk_4_10_00_10/docs/ble5stack/ble_user_guide/html/ble-stack-5.x-guide/debugging-index.html#debugging-memory-problems 

    Increase RAM Size on the CC2640R2F Bluetooth low energy Wireless MCU (Rev. A)

    PS:

    For certain PHY testing in BLE qualification you do not need to test all devices, but specific devices you can load with HostTest (DHCI_TL_FULL). 

    http://www.ti.com/lit/swra601 

  • Hi, Eirik:

    Now the product firmware can be triggered by the right button to enter the PTM. When the device is restarted, the device can also pair and transmit data.I had the wrong configuration before. We are going to use the HCI command on the production line to test all the devices . Now, the PTM can basically meet the production test the devices by triggering the right button, and the devices is not required to start up and enter the PTM directly for the time being.

    Thank you very much for your support!

    Best Regards, Henry Yang