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.

which pins should be used as UART in DTM?

Other Parts Discussed in Thread: CC2541, CC2540

details about BLE Stack 1.2 Released:

http://e2e.ti.com/support/low_power_rf/f/538/t/166931.aspx

The article referred:

- Support for "Production Test Mode" has been added, allowing a BLE application in a "single-chip" configuration to temporarily expose the HCI over the UART interface when triggered externally to do so (e.g. hold a GPIO pin low during power up). This allows the device to be connected to a Bluetooth tester in order to run direct test mode (DTM) commands on a production line using the final release firmware, while leaving the UART GPIO pins available for the application to use at all other times

1) Which pins(CC2541) shoulod be used as UART in DTM? Or which pins you will recommend to be used as UART in DTM?

2) "(e.g. hold a GPIO pin low during power up). " Which GPIO pin should be used?

Thanks.

  • Yes!  Same problem here!

    The README.txt of BLE Stack 1.2 mentions:

    - Support for "Production Test Mode" has been added, allowing a BLE application
      in a "single-chip" configuration to temporarily expose the HCI over the UART
      interface when triggered externally to do so (e.g. hold a GPIO pin low during
      power up). This allows the device to be connected to a Bluetooth tester in
      order to run direct test mode (DTM) commands on a production line using the
      final release firmware, while leaving the UART GPIO pins available for the
      application to use at all other times

    We are going to do the Qualification Test to our product at Bluetooth Qualification Test Facilities (BQTF).

    Does this new feature help?  How do we use it exactly?

    Best regards,

    Jeff

  • Hi,

    Assuming that you are familiar with our BLE stack, the SW needs modification at applications layer to support PTM testing even though PTM is built in for BLEv1.2. We don’t have PTM documented yet, but the code below can be used in (for example) simpleBLEPeripheral.c  to show of how the application checks whether an MT8852B tester is connected during startup. It works by checking whether GPIO P0.4 is held low, and if it is then the application will enable PTM. Anritsu has implemented software in the MT8852B that will hold that line low to signal to the CC2540 (Pin P0.4 is exposed on the DB-9 header connecting to the MT8852B). The other pins are the normal pins used for the HCI interface when using a network processor build.
    Essentially, all PTM does is allows you to expose the physical UART HCI interface in a single-chip build, only when triggered by some action during initialization. In the case of the sample code, the action is pin P0.4 being held down by the MT8852B. On the production line when the MT8852B is connected, the device will initialize into PTM. Under all other circumstances (such as when the end-user powers up the device as a final product), the GPIO will not be held low, so the device will initialize as normal. The HCI interface is not exposed to the physical UART interface, and those GPIO pins can be used by the application for anything. This allows one single software build to be used for both production testing as well as the final application.
    Add following to constant declaration
    //-----------------------------------------------------------
    // TI BLE CC254x Production Test Mode
    #define PTM                   4
    #define RDY                   5
    #define PDUP0                 5
    #define P0ICON                0
    #define TESTER_CONNECTED()    (P0_4==0)?TRUE:FALSE
    //-----------------------------------------------------------
    Define and use the following function to setup the interface;
    //-----------------------------------------------------------
    /*******************************************************************************
     * @fn          llSetupPTMTestPort
     * @brief       This routine is application sample code that shows how to setup
     *              two GPIOs used as the RS232 flow control pins for the Production
     *              Test Mode header interface. This interface assumes UART0, Alt 1.
     *              The RTS is mapped as a pulled-up input and is used to determine
     *              if a Tester connector is attached to the PTM header. If RTS is
     *              asserted (low), then the connector is attached and PTM can be
     *              enabled; otherwise the application can boot normally. 
     *
     *              Note: The DUT's RTS is de-asserted. If PTM is enabled, then when
     *                    this pin is configured as part of the UART flow control,
     *                    its value will be asserted, which indicates to the Tester
     *                    that the DUT is ready.
     */
    void llSetupPTMTestPort( void )
    {
      // ready UART0, Alternative 1 for the application to monitor
      P0SEL &= (~BV(PTM) & ~BV(RDY)); // GPIO
      P0DIR &= ~BV(PTM);              // input; this is Tester's RTS
      P0DIR |=  BV(RDY);              // output; this is Tester's CTS
      P0    |=  BV(RDY);              // de-assert Tester's CTS
      P0INP &= ~BV(PTM);              // pull-up/pull-down depending on P2INP
      P2INP &= ~BV(PDUP0);            // pull-up
      return;
    }  
    //-----------------------------------------------------------
    Add the following to the Init function (Ex. SimpleBLEPeripheral_Init) and put the previous content in the else case
    //-----------------------------------------------------------
      llSetupPTMTestPort();
      
      // check if Tester's RTS is asserted
      if ( TESTER_CONNECTED() )
      {
        // it is, so enable PTM
        // Note: It is assumed when the Tester is finished, the connector will be
        //       removed from the DUT's header, and the DUT will be reset/power cycled.
        
        osal_pwrmgr_device( PWRMGR_ALWAYS_ON );
        
        HCI_EXT_EnablePTMCmd();
      }
      else
      {
        //moved here due to PTM test
        osal_pwrmgr_device( PWRMGR_BATTERY ); 
        //Copy and Past the original init content here
      }
    I hope this helped you to understand PTM further.
    Br
  • Hello Nick,

     

    Already tried incorporating the mentioned changes and did see the GPIO P0.4 is held low by MT8852B but still failed to perform test.

    Which EUT control shall be selected from the Anritsu tester application?  the baudrate to use?

     

    thank you

     

  • Hello Nick,

    Thanks for the great detail!

    Our Bluetooth Qualification Test Facilities uses the BITE T1111 RF Test System.
    I need to confirm how the pins connect to RS232 when I use your PTM code.

    CC2540  <<<=======>>>  Tester

    UART0, Alt 1.                          RS232C
    ----------------------------------------
    P0.2:RX    <<<==========  TX
    P0.3:TX    ==========>>>  RX
    P0.4:CT    <<<==========  RTS
    P0.5:RT    ==========>>>  CTS
    ----------------------------------------

    Are these connections correct?  
    Do I have to connect all these four pins?
    Are there other pins I should connect to RS232?

    And, what baudrate should I use?

    Thanks for your help!

    Jeff

  • Hi Jeff,

    I have not run the BITE system myself but I do know some of our customers does so it should work fine!

    Connect all 4 pins as you have shown. The set-up opf the instrument should be:

    Baudrate -> 57600

    Databits -> 8

    Stop bits -> 1

    Parity -> None

    Protocol -> None

    Let me know if it works!

     

    -Per

  • Hi,

    I have updated some information regarding DTM/PTM on our wiki: 

    http://processors.wiki.ti.com/index.php/PTM

    Have a look there and see if you've missed anything.

    Br

    http://processors.wiki.ti.com/index.php/PTM

  • Hello Nick,

    Still not able to make it work...
    From the wiki you mentioned that the DUT's RTS will be asserted, which indicates to the Tester that the DUT is ready.  But P05 remains high even after EnablePTM.
     
    I also tried using BTool to issue the HCIExt_EnablePTM to a cc2541 with CC2541_SmartRF_HostTestRelease_All.hex firmware.  
    I got an unknown hci command status.


    12] : <Tx> - 03:03:41.047
    -Type  : 0x01 (Command)
    -Opcode  : 0xFC0E (HCIExt_EnablePTM)
    -Data Length : 0x00 (0) byte(s)
    Dump(Tx):
    01 0E FC 00

    ------------------------------------------------------------------------------------------------------------------------
    [13] : <Rx> - 03:03:41.109
    -Type  : 0x04 (Event)
    -EventCode : 0x0E (HCI_CommandCompleteEvent)
    -Data Length : 0x04 (4) bytes(s)
     Packets  : 0x01 (1)
     Opcode  : 0xFC0E (HCIExt_EnablePTM)
     Status  : 0x01 (Unknown HCI Command)
    Dump(Rx):
    04 0E 04 01 0E FC 01

    any idea what i've done wrong?

    tnx, J

  • Hi J,

    Did you follow the code examples in the "How to Use PTM from an Application Point of View" section? Have you connected the Anritsu correct?

    As for the HCIExt_EnablePTM it says in the TI BLE Vendor Specific HCI Guide: 

    This command is used to enable 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. This command is only available when the BLE Controller is built without external access to the Controller (i.e. when no transport interface such as RS232 is permitted). This mode will remain enabled until the device is reset. Please see the related application note for additional details. Note: This command is only allowed as a direct function call, and is only intended to be used by an embedded application.
    So you cant use the HCIExt_EnablePTM command over a serial connection. You could use HCI_LE_Transmitter_Test instead, as described on the wiki.
    Br 
  • hello nick,

    yes, did follow the sample code snippet. and did verifiy the function was called by setting a break point.

    i was able to run the anritsu tester with the cc2540 module running the CC2540_SmartRF_HostTestRelease_All.hex.  EUT control set to rs232 with 57600 baudrate.

    but for this PTM, regardless whether i set the EUT control to RS232 or bi-wire, it doesnt work.  how do i know whether cc2540 is really running in test mode?

     

    thanks

    regards, J

  • J, 

    Make sure that you do have HCI_DISABLE_UART defined. To check if the HCI_EXT_EnablePTMCmd was successful, make sure that the return value is 0x00. 

    Br

  • Hello Nick,

     

    there is no HCI_DISABLE_UART in the list of preprocessor defined symbols and i did get a 0x00 from calling HCI_EXT_EnablePTMCmd.

     

    Regards,

    J

  • Hi Nick,

      I have two questions on your description.

      1. Does HCI_EXT_EnablePTMCmd only work with UART_0?  We just need to understand if UART_1 can be used due to some constraints with our pin assignments.

      2. For UART_0, can HCI_EXT_EnablePTMCmd only work with alternative 2?  That is, can we use (P1.5, P1.4, P1.3, P1.2) as UART_0 for DTM/PTM?

  • Hi Chi-wen,

    I have updated the wiki (http://processors.wiki.ti.com/index.php/PTMhttp://processors.wiki.ti.com/index.php/PTM) with further information on this matter. Please have a second look. The UART config is fixed in the library file so you would have to use UART 0 for DTM/PTM.

    Best Regards

  • Hi Nick,

      Thanks.

      Could you also answer my 2nd question in the previous post?

       2. For UART_0, can HCI_EXT_EnablePTMCmd only work with alternative 2?  That is, can we use (P1.5, P1.4, P1.3, P1.2) as UART_0 for DTM/PTM?

  •  

    Hello Nick,

     

    so following the updated wiki, I have made sure that the HCI_DISABLE_UART, HAL_UART, and HAL_DMA=TRUE are defined in the project options.

    and i noticed that there is this "f0 50 10 d0" data coming from cc254x on power up from the uart port.  may i know what is this 4 byte data conveying?

     

     

    thank you

    j

  • Hi, 

    I saw that print as well. You can ignore it, I believe it's a confirmation of some sort. It will be removed in later stack releases. PTM should be working for you at this point, can you confirm that?

    Br

  •  

    Hello Nick,

     

    Actually, after getting the "f0 50 10 d0 from cc254x, i tried to issue DTM command using a terminal program, but was not able to get any response.

    So still not working...Any idea? thanks

     

    regards, J

  • Hi J,

    May I know if the problem solved yet? Can you send a test command from a terminal program?

    Thanks,

    James

  • Hello James,

     

    No, tried sending the standard BLE DTM command from a terminal program, but was not able to get response from cc254x.

    Have you tried such test procedure? Is it working?

     

    thanks & regards,

    J

  • Hi J,

    Same case here, I followed the procedure still cannot get any response. I tested 2540, 2541 and also 2540 + SmartRF05 EVK, all fail to get any response from the UART. I may try to connect it with a Bluetooth tester later. The only thing I can do is using the HostTestApp.

    Nick,

    Can you help here, since  without the PTM we are holding up the production line with unnecessary processes and this are going to increase the fail rate.

    Thanks,
    James

     

  • Try connecting to the device using 115,200 baud, not 57,600 baud. That worked for me, using 1.2.1 stack. The clue was looking with a scope at those four unknown bytes emitted by the device on entry to PTM. It's not four bytes, it's eight, at twice the expected baud rate. I don't know why this is because all the TI documentation says the rate should be 57,600 baud, but it is not. I have confirmed this by stepping through the (assembly) code with the debugger (TI does not supply source code for PTM to my knowledge). HCI_EXT_EnablePTMCmd() calls hciInitTransport() which calls HalUARTOpen() with a config parameter (a struct) that has the baudRate field set to HAL_UART_BR_115200.
  • hello Matthew,

     

    thank you for sharing with us your findings.  it did work @ 115200. able to accept and respond to HCI test commands.

     

    regadrs,

    j

  • Thanks Matthew, it's working now.

  • Hello all,

    I want to test PTM, but i don't have BLE tester. Can i test PTM with SmartRF05 board + CC2541EM, CC2540 USB dongle and USB to serial adapter?

    please tell me how to do, Thanks.

  • Hi Per,

     

    Can I use PTM by UART0 but without RTS/CTS? Thanks much.

     

    -LSY