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.

CC2640R2F: When i disable the "-DPTM_MODE" flag in .opt file, have any method i can change to PTM mode?

Part Number: CC2640R2F

My SDK version is : 3_40

IDE Tool: CCS 9.1.0

Using Example: examples\rtos\CC2640R2_LAUNCHXL\ble5apps\simple_serial_socket_server

Question:

Now we using the Flag:-DPTM_MODE to switch the cc2640r2f to run in PTM mode or non-PTM mode.

But now we must burn-in different files to switch PTM mode and non-PTM mode.

Does have any way that I build non-PTM mode, but can via some method to change to PTM mode?

I search in TI Forum, someone is discussing about the HCI_EXT_EnablePTMCmd. Seems if I pull-up a PTM gpio(GPIO_23), then I can send the HCI Command via UART?

Dose anyone knows the relevant information? Please share with me, thanks a lot!


 

  • Hello,

    I have assigned an expert to help with this query.

    Regards,

    Jan

  • Dear Jan:

         Thanks for your help!

         If you have any ideas or solution, please tell me~

  • Hello:

    Have any update?

    Thanks~

  • Danny,

    Please apologize for the delay.

    Does have any way that I build non-PTM mode, but can via some method to change to PTM mode?

    I don't have a ready project that performs runtime change, thus I can only give some pointers.

    Since the PTM_MODE is a #define, you would have to modify your project to instead have if clauses to actually include the specific constructs at runtime. CCS helps finding these constructs with the advanced search (Ctrl-H), which can locate the various instances and source files that reference this particular define.

    I imagine you already read the topics in our User's Guide below to include the other additional modules to your project. Like in the case above, there are a few other predefined symbols that could easily be encapsulated between if clauses to be enabled whenever needed:

    https://dev.ti.com/tirex/explore/content/simplelink_cc2640r2_sdk_4_10_00_10/docs/blestack/ble_user_guide/html/ble-stack-3.x/creating-a-custom-bluetooth-low-energy-application.html#using-production-test-mode-ptm

    I will keep looking for any additional details that may help with this migration and report back in case I find anything relevant.

    Hope this helps,

    Rafael

  • Hi desouza:

    Thank you very much for the advice you gave me, I'm ongoing to implement following your advice.
    But now I suffer a very strange problem, and I want to consult you.

    Now I always set DPTM_MODE in the .opt file. I use a static global variable, and the value which is getting from the PIN_ID(6) by the API PIN_getInputValue();
    When I running ptm_mode, I will pull high PIN_ID(6) first. When I running non-ptm_mode, I will pull low PIN_ID(6).
    I use this variable to decide whether to run the SPP_doEnablePTMMode(). And i think the function SPP_doEnablePTMMode() is the key point whether can run into ptm_mode.

    But I suffer a strange problem.
    there are three situations, and I describe as bellow:
    1. I pull high PIN_ID(6), and expect to run into ptm_mode. After I testing using HCI command, and HCI command can work. And the xxx.hex size we burn-in is 278KB.
    2. I pull low PIN_ID(6), and expect can run into non-ptm_mode. I testing non-ptm_mode is fail. And the xxx.hex size we burn-in is 278KB.


    3. I direct using judge statement if(0), and the code will not running SPP_doEnablePTMMode(). I testing non-ptm_mode is successful. And the xxx.hex size we burn-in is 264KB


    Whether the strange problem is because my code size exceeds the "total nonvolatile memory"? cc2640r2f datasheet write total nonvolatile memory is 275KB.

    BR

    by Danny

  • Danny,

    I can't necessarily tell why your logic is not working, but since I never saw a development that dynamically switched between PTM and non-PTM modes, I wonder if it is necessary to reset the device to make this switch. I will consult with some colleagues. 

    The one aspect about .hex files is that their size on disk is not a reflection on their size in the device's memory. Hex files are text files in nature with additional characters such as the initial colon (:) sign, as well as CR/LF, etc.

    So, to know the size of the binary, you can refer to the linker .map file and see the usage as shown below.

    Regards,

    Rafael

  • Hi desouza:

    Thanks for your reply for correcting the flash allocation knowledge. About the PTM_MODE switch, if you have any news, please inform me.

    Thanks!

    BR by Danny.

  • Dear desouza:

         In PTM Mode, we want to use the HCI command via UART to set BLE. We have to do RF testing.

         In non-PTM Mode, we want to connect to Mobile Phone via BLE, and we hope we can send some specific command between cc2640r2f and Mobile Phone.

         According to your cognition, can you give me some suggestions, what kind of Flag is not necessary and I can remove it? 

         My project has the following Flag:

    -DCC2640R2DK_4XS
    -DCC26XX
    -DCC26XX_R2
    -DDeviceFamily_CC26X0R2
    -DICALL_EVENTS
    -DICALL_JT
    -DICALL_LITE
    -DICALL_MAX_NUM_ENTITIES=6
    -DICALL_MAX_NUM_TASKS=4
    -DICALL_STACK0_ADDR
    -DNPI_USE_UART
    -DNPI_FLOW_CTRL=0
    -DMAX_NUM_BLE_CONNS=1
    -DPTM_MODE
    -DRF_SINGLEMODE
    -DSTACK_LIBRARY
    -DTBM_ACTIVE_ITEMS_ONLY
    -DUSE_ICALL
    -DUSE_RCOSC

    Thanks a lot.

    BR by Danny.

  • Danny,

    I consulted with some colleagues and they mentioned it should be alright to make the switch between the modes. I then found the thread below that describes a very similar scenario.Take a look at it and see if it brings some ideas.

    https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/903540/ccs-cc2640r2f-ptm-in-ble5_simple_peripheral_cc2640r2lp_app

    At this point, I would double check to see if anything in the file mentioned in the thread above (icall_hci_tl.c) has to be modified to make the PTM mode to be dynamically switched.

    I will keep looking for additional resources, but please give these a try.

    Hope this helps,

    Rafael

  • Dear Rafael:

         I check the stack and heap status by using the ROV plug-in. But all looks good. So up to now, I don't know why I cannot switch PTM and non-PTM.

        Do you have any good news about how to modify the thread (icall_hci_tl.c)?

        Thanks!

    BR by Danny

  • Dear Rafael:

    We found some "#ifndef PTM_MODE" in  icall_hci_tl.c. I think these should be marked If we want to dynamic switch PTM and non-PTM.

    Now we mark these "#ifndef PTM_MODE",and rebuild the project. But we meet the following situation.

    The size of .cinit is over the max hole:0x1000. Are there any files can adjust to fix this problem?

    Another question: Are there documents for describing the flag functionality? If yes, can you offer me the documents?

    Thanks!

    BR Danny

  • Dear desouza:

         Have any update about this?

         Thanks!