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.

LAUNCHXL-CC2640R2: Implementing PTM errors?

Part Number: LAUNCHXL-CC2640R2
Other Parts Discussed in Thread: CC2640R2F, CC2640

Hi,

   I am following the PTM Guide doc at simplelink_cc2640r2_sdk_1_30_00_25. I am encountering these errors below. I followed the PTM Guide as is. I triple checked everything I did. I also did clean rebuild and also rebuild index. But, still same errors. Please provide advice how to resolve these errors. 

identifier "appTaskID" is undefined icall_hci_tl.c

identifier "hciExtSignCounter" is undefined icall_hci_tl.c

identifier "hciTranslationTable" is undefined icall_hci_tl.c

identifier "IRK" is undefined icall_hci_tl.c

identifier "out_msg" is undefined icall_hci_tl.c

identifier "rspBuf" is undefined icall_hci_tl.c

identifier "SRK" is undefined icall_hci_tl.c

- It seems that this is caused by not including HCI_TL_FULL or HCI_TL_PTM at predefined symbols. There is no mention at PTM guide to add HCI_TL_FULL or HCI_TL_PTM to predefined symbols. Do I add the HCI_TL_FULL  or HCI_TL_PTM to predefined symbols?

expected a ")" simple_peripheral.c

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

  

I do not get where at the HCI_TL_Init() code line where the ")" is needed.

Warnings:

"HCI_TL_CommandStatusCB" declared implicitly icall_hci_tl.c

"HCI_TL_Init" declared implicitly simple_peripheral.c

"HCI_TL_SendToStack" declared implicitly simple_peripheral.c

     Where is the header file for these 3 HCI C API's above. 

        
- kel

  • Hi Markel,

    In the Explicitly Enable PTM and Configure HCI Transport Layer section, you define HCI_TL_PTM in the opt file. The opt file is pulled in during compilation to define the symbol.

    The highlighting was missing in the code section, but add #include "icall_hci_tl.h" // To allow ICall HCI Transport Layer
    to simple_peripheral.c to get rid of the warnings.

    Hope this helps!
    Rebel
  • Hi,

       I repeated the same steps at my Home PC. I added the #include "icall_hci_tl.h" // at simple_peripheral.c. I define the HCI_TL_PTM in the opt file. Here are my changes to the opt file.

    /* Include Transport Layer (Full or PTM) */
    /* -DHCI_TL_NONE Comment this line */
       -DHCI_TL_PTM 
    /* -DHCI_TL_FULL */

    I did a clean rebuild of both stack and app project. I got these errors below. I will try the same at CC2640R2 SDK 1.0.0 and see if I get the same results.

    - kel

  • Hi,

       I tried the PTM procedure at CC2640R2 SDK 1.0.0 at my Home PC but I encountered problems at CCS. See, below.

        

       However, I tried the PTM Procedure at CC2640R2 SDK 1.0.0 at my Work PC and I got pass the errors at my first post. But, I have new errors. How do I resolve these errors?

    - kel

  • Hi Kel,

    Discovered the issue, the following changes need be made to the PTM guide -

    When adding includes to CCS, in addition add C:\ti\simplelink_cc2640r2_sdk_1_30_00_25\source\ti\blestack\npi\src

    Lastly, instead of using FlashROM - use the stack library build. This means use FlashROM_Stacklibrary for the application project, and use FlashROM_library for the stack project in CCS.

    Regards,
    Rebel
  • Hi A. Rebel.

    Thanks, that worked.

    My concern now is for On-Chip OAD. Here are my questions below.

    1. To generate Image B for On-Chip OAD I am using simple_peripheral_cc2640r2lp_app_oad_onchip as base program. It does not have a configuration option for FlashROM_Stacklibrary. What do I do about that to include PTM?

    2. The stack used for On-Chip OAD is oad_target_cc2640r2lp_stack. It is not a stack library. Would PTM work if I use oad_target_cc2640r2lp_stack as stack for On-Chip OAD?

    - kel
  • Hi A. Rebel,

    Your fix works for CC2640R2 SDK 1.0 but not for CC2640R2 SDK 1.30.

    - kel
  • Hi Markel,

    1. Same steps. But read info below.

    2. Yes, a stack project is a stack project. The procedure to enable PTM on the stack side is the same.

    At the moment there's no support for PTM on non-stacklibrary configurations. I've already let the team know that this is an issue - I'm unsure when they'll get to it though.

    A potential workaround is to eliminate all the functions that cause the errors to occur in icall_hci_tl.c

    I haven't had a chance to test this - this seems to be the only feasible workaround at the moment.

    Regards,
    Rebel
  • Hi A.Rebel,

    I have generated PTM app hex file. The simple peripheral stack library has no option to generate hex file. So I use the simple peripheral stack hex file.

    I program the PTM app hex file and simple peripheral stack hex file to CC2640R2F Launchpad. But, I do not see my CC2640R2F Launchpad at SensorTag App. Is that expected because this is running in PTM mode?

    Best Regards,
    Markel

  • Hi Markel,

    Interesting, the fix worked on both versions on my end CC2640R2 SDK 1.0 and CC2640R2 SDK 1.3

    Regarding the hex files, yes only the application hex is needed when using stack library build configuration.

    And the lack of advertisements, depends on where and when you inserted the code. There's a controller reset, so if GAPRole configuration is before the call to enable PTM, then yes it's possible not to see any advertisements. A better check is to try sending HCI commands.

    Regards,

    Rebel

  • Hi A.Rebel,

        I will try again at CC2640R2 SDK 1.3. This is my code below at SimpleBLEPeripheral_init(). The call to enable PTM is before VOID GAPRole_StartDevice(). At this setup I do not see my CC2640R2 Launchpad at SensorTag App.

      // Intercept NPI RX events.
      NPITask_registerIncomingRXEventAppCB(SBP_handleNPIRxInterceptEvent, INTERCEPT);
    
      // Register for Command Status information
      HCI_TL_Init(NULL, (HCI_TL_CommandStatusCB_t) SBP_sendToNPI, selfEntity);
    
      // Register for Events
      HCI_TL_getCmdResponderID(ICall_getLocalMsgEntityId(ICALL_SERVICE_CLASS_BLE_MSG, selfEntity));
    
      // Inform Stack to Initialize PTM
      HCI_EXT_EnablePTMCmd();
    
      // Start the Device
      VOID GAPRole_StartDevice(&SimpleBLEPeripheral_gapRoleCBs);
    
      // Start Bond Manager
      VOID GAPBondMgr_Register(&simpleBLEPeripheral_BondMgrCBs);
    
      // Register with GAP for HCI/Host messages
      GAP_RegisterForMsgs(selfEntity);
    
      // Register for GATT local events and ATT Responses pending for transmission
      GATT_RegisterForMsgs(selfEntity);
    
      //This should be included only if 4.2 length extension feature is enable....
      //HCI_LE_ReadMaxDataLenCmd();

    - kel

  • Hi Markel,

    You should probably have PTM mode enabled only when required. (In other words, only call the PTM related functions when say a GPIO is held down or when the application does not need to be used)

    Ideally, PTM mode should only be used on it's own when needed, not along side the application. Else you're better off using host_test or Simple network processor.

    Regards,
    Rebel
  • Hi,

    For PTM, it seems Slave BD Address is needed. Because, we tried to read Slave BD Address using our PTM tester and it only shows 0xFFFFFFFF. So, I think it would be a good idea to mention that in the documents.

    - kel
  • That's definitely a supported command - I'd recommend checking the UART/SPI lines to verify that it is indeed 0xFFFFFFFF

    It may be an issue with the tester - I haven't personally had a chance to test that particular command

    Regards,
    Rebel
  • A. Rebel said:
    You should probably have PTM mode enabled only when required. (In other words, only call the PTM related functions when say a GPIO is held down or when the application does not need to be used)

    Yes, that is mentioned in the docs. But, at the moment we just want to make the PTM work first with our tester.

    - kel

  • A. Rebel said:

    Regarding the hex files, yes only the application hex is needed when using stack library build configuration.

    I just want to clarify what you said to above. Do you mean that I should only program the app hex fie to CC2640R2 Launchpad for PTM mode? 

    What I did was I program the app hex files and the simple peripheral stack hex file. We are not able to receive any UART output going to our PTM tester. Is there anything that I am doing wrong? I followed the procedure as is. We connect our PTM Tester to CC2640R2 Launchpad UART Lines DIO2 and DIO3.

    - kel

  • Do you mean that I should only program the app hex fie to CC2640R2 Launchpad for PTM mode?

    Correct - when using a stack library build configuration, the stack is pulled in as a library. In other words, there is no stack hex file. Only an application hex file.

    So if you're building a stack library configuration application project AND flashing some stack hex file, then that will certainly cause errors.

    Note: There is no stack library configuration for R1 Devices.

    Regards,

    Rebel

  • Hi A.Rebel,

    Thanks for the advice. I will try that tomorrow at work.

    - kel
  • Hi,

       I failed with PTM mode. I only programmed the app hex file that is in the FlashROM_StackLibrary folder. Here is my setup below.

    As you can see we are using Anritsu MT8852B Bluetooth Tester. I have read from this wiki that Anritsu MT8852B Bluetooth Tester is used for Direct Test Mode.

    In Direct Test Mode, I need to program host test example program according to ""Configuring the CC2640 for Bluetooth® Direct Test Mode"" document below.

    So, what is the recommended test type to do, Is it PTM or DTM? At CC2640R2 Docs only PTM is mentioned. But, I am unable to do PTM using Anritsu MT8852B Bluetooth Tester. Our company has made CC254XX base products before so our test team have experience doing either DTM or PTM before. But we are new to TI CC2640R2F and unable to do PTM following the document guide.

    Our company is based in Ipoh, Perak, Malaysia. There is TI Malaysia in Kuala Lumpur, Malaysia. Do you have TI FAE's there that can go to our company and help us with the TI CC2640R2F Production Test Mode? If there are no TI FAE's there, I will just continue to ask help here at TI E2E Forum.

    - kel

  • Hi Kel,

    DTM mode is supported through the host_test application as you mentioned. Effectively a network processor configuration, where commands are taken through HCI commands along a transport layer. This is included in the SDK along side simple_peripheral and other example projects.

    Try connecting via UART to a launchpad running host_test. Let me know if you see similar results.

    DTM vs PTM mode is described in the wiki you referenced. One just happens to have the application along side it which optionally be toggled to.

    Regards,

    Rebel

  • Kel,

    Attached is the PTM changes applied to simple_peripheral - everything works as expected. (for both IAR and CCS)

    I tested with the HCI tester TI tool, which simply sends HCI commands over UART.

    Can you do a diff with your project settings? It's most likely a configuration error.

    Regards,

    Rebel

    (UPDATED 4/3/17)

    8015.ptm_simple_peripheral.zip

  • Hi A. Rebel,

       Thanks for helping me with PTM.

        I diff the project settings and your app project does not have these below set at Predefined Symbols. Also, your NPI files are excluded from build. I am using CCSV7.

       NPI_USE_UART

       NPI_FLOW_CTRL=0

       ICALL_MAX_NUM_TASKS=4

       I will try DTM and PTM later. I already have the hex file for DTM mode. It is from the host_test example program. I removed some predefined symbols according to the procedure.

    - kel

  • Hi,

       I program a TI CC2640R2 Launchpad with DTM hex file. I program another TI CC2640R2 Launchpad with PTM hex file.

       The TI CC2640R2 Launchpad with DTM hex file, works with our BLE Tester Anritsu (MT8852B). I was able to get Bluetooth Device Address and do some testing.

       The TI CC2640R2 Launchpad with PTM hex file, did not work with our BLE Tester Anritsu (MT8852B). Is this Anritsu (MT8852B) will only work on DTM Mode according to this wiki below? But, it seems it should work because the Anritsu (MT8852B) is communicating through UART same with DTM. By any chance can you give me a hex file that is PTM Program, so I can test it with our BLE Tester Anritsu (MT8852B)

         I move these code lines to the bottom of SimpleBLEPeripheral_init(), but I get failed results as mentioned above.

      // Intercept NPI RX events.
      NPITask_registerIncomingRXEventAppCB(SBP_handleNPIRxInterceptEvent, INTERCEPT);
      
      // Register for Command Status information
      HCI_TL_Init(NULL, (HCI_TL_CommandStatusCB_t) SBP_sendToNPI, selfEntity);
      
      // Register for Events
      HCI_TL_getCmdResponderID(ICall_getLocalMsgEntityId(ICALL_SERVICE_CLASS_BLE_MSG, selfEntity));
      
      // Inform Stack to Initialize PTM
      HCI_EXT_EnablePTMCmd();

    - kel

  • Hi Kel,

    You may have been looking/diffing the wrong application build configuration, the only configuration I modified (and currently supported with PTM) is the stacklibrary application configuration.

    Here's the hex file (renamed to allow upload): (UPDATED: 4/3/17)

    6165.simple_peripheral_cc2640r2lp_app.txt

    As mentioned earlier, there appears to be a project configuration issue. Just make sure to follow the steps on stacklibrary configuration + the errata here: http://processors.wiki.ti.com/index.php/PTM_cc2640

    Regards,

    Rebel

  • Hi A. Rebel,

    Thanks, I will try the hex file next week Monday.

    - kel
  • Hi A.Rebel.

        I program your simple_peripheral_cc2640r2lp_app.hex (PTM mode) to my CC2640R2 Launchpad. I connect the CC2640R2 Launchpad to Anritsu (MT8852B) BLE Tester same connection as I did with DTM Mode. It did not work. I was not able to get Bluetooth Device Address. Using SmartRF Flash Programmer 2, I program a Secondary MAC Address 0x112233445566. I try again using the Anritsu (MT8852B) BLE Tester and it did not work. I tried several times.

        The DTM mode works.

       I do not doubt that you have done the PTM at TI side with your testing equipment. But, we need to make the PTM mode work using Anritsu (MT8852B). So, I would like to request help from TI to make the PTM mode work for our Anritsu (MT8852B).

       I have followed your document guide to integrate PTM mode to simple_peripheral and it did not work using Anritsu (MT8852B). I believe this issue can be duplicated at TI side if you have Anritsu (MT8852B) for testing and also using simple peripheral example program from CC2640R2 SDK 1.00.00.22.

    - kel

  • Hi kel,

    I suggest doing a bench test with HCI Tester or BTool to send the HCI commands before connecting to the BTLE tester. We do have an app note "Configuring the CC2640 for Bluetooth® Direct Test Mode" which might help with the setup.

    Best wishes

  • Hi JXS,

    I have read this document before. This is the guide I use to make the DTM(Direct Test Mode) to work with our Anritsu (MT8852B) BLE Tester.

    But, I need the PTM(Production Test Mode) to work with our Anritsu (MT8852B) BLE Tester, which I have not made to work using your document guide and even using hex file from A.Rebel.

    - kel
  • Hi there,

    First of all, I am so sorry for interrupting your talkings.

    Even though my thinking could be wrong, I hope you to find out any resolutions through my bothering you.

    As I know, the PTM using HCI I/F is different from the DTM using 2-wire UART I/F, not HCI I/F.

    The PTM using HCI I/F has some vendor specific commands of TI along with the existing HCI commands set Bluetooth specification mentions.

    And my guess is the PTM can make it easier for us to implement and enable the PTM featues on the general BLE application running with a specific dedicated option like PIN driving.

    But the DTM is not convienient to enter the mode during our general BLE application because this DTM is for direct control over the BLE Controller not through the Host BLE application. Usually, external approach like PC terminal using UART I/F is being used or Bluetooth Tester you are saying for RF qulification or else.

    So, different approach is being used and the DTM  is almost standarized according to the Bluetooth spec like below.

    And the Bluetooth tester could support the both I/F of them, but usually 2-wire UART I/F is general, as I know.

    So, if your testing codition works well with DTM, maybe, the tester configuration is set to the DTM using 2-wire UART mode now.

    And my guess is that the tester is generating the 2-byte commands set and have response events. Please refer to the command sets on page 178 & 179.

    Is the tester supporting the HCI I/F too ?

    Without the Bluetooth tester, you can test the commands and responses through PC terminal application like 'real term'.

    Again, I hope you to solve your issue as soon as possible.

    BR,

    Ji Won

  • it seems that the Bluetooth RF tester cannot support the HCI mode as CC2640R2 is supporting only BLE mode, not dual mode.

    So, TI's HCI commands set couldn't be matched with the Tester as the TI HCI commands set are longer than 2-byte format DTM can recognize.

    If you need to use the HCI approach like TI suggests, I think that you need to create your own HCI commands set matching with the standard DTM commands.

    When they are ready by you, you can use simply it along with the Tester.

  • Hi Ji Won Lee,

    Thank you for providing useful inputs. I just started working with TI CC2640R2 a few months ago and not knowledgeable yet.

    From your reply the Anritsu (MT8852B) does not support PTM using HCI I/F. Can anyone from TI confirm this?

    The document guide from CC2640R2 SDK "Using Production Test Mode (PTM)" did not mention what Bluetooth Tester can be used with PTM, so we thought that Anritsu (MT8852B) would work.

    Hi JXS,

    I would like to know what testing equipment we need to do PTM testing?

    - kel
  • Hello,

    As described on the PTM wiki, the PTM configuration is a means to run DTM as well as select TI vendor specific HCI commands (e.g., modem test commands for regulatory testing) using HCI formatted packets. The HCI format is the same as in the Host_Test configuration. If you can run Host_Test and perform DTM, then your HCI setup is correct, HW wise. If PTM is not working then perhaps you are not enabling PTM at runtime. I would use the debugger to confirm you are entering PTM as a first step.

    Best wishes
  • Hi JXS,

    I am not at work so I am not able to do debug and check if PTM is not enabled at runtime. However, the procedure I followed to enable the PTM is base from CC2640R2 SDK 1.30 Document. As you can see from this post I had good help from A. Rebel to help me build the PTM CCS project. If the PTM does not enable at runtime that means the document procedure is false. Even A. Rebel PTM hex file did not work with Anritsu Tester.

    I have to explain this to my colleagues because we are nearing production date. At least Ji Won Lee provided good inputs. For now I recommended to do DTM for testing because there is an issue with PTM using our Anritsu Tester.

    - kel
  • Hi Kel,

    Can you re-download the Hex I provided? I had mistakenly uploaded the wrong hex.

    Regards,
    Rebel
  • Hi A. Rebel and JXS.

    The hex file you provided works. I already made the PTM to work using simple_peripheral from CC2640R2SDK 1.30.

    My earlier troubles are from making the PTM work using simple_peripheral from CC2640R2SDK 1.00.

    - kel
  • Hi,

    Regarding my concern about adding PTM to simple_peripheral_cc2640r2lp_app_oad_onchip, there is no configuration option for "FlashROM_StackLibrary".

    So, If possible please provide me a procedure how to add PTM to simple_peripheral_cc2640r2lp_app_oad_onchip.

    - kel