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: PER Test Sample Code?

Part Number: CC2640R2F


Hi,

    Where can I get a PER Test sample code for CC2640R2F. How do I get the number of packets after calling HCI_LE_ReceiverTestCmd()?

- kel

  • Hello,

    Please see the "Using Production Test Mode (PTM)" on the TI BLE Wiki. This has an overview of DTM which is used to perform PER testing. The format and response data, including # of received packets, from the DTM test commands is described in the Bluetooth specification with a reference in the wiki article.

    Best wishes
  • Hi JXS,

        Following the PTM and DTM guide there are lots that needs to be set. Is it possible to do the PER test using a much simpler way and then wait for the results at complete event stack message? Here is my code below. But, after executing HCI_LE_TestEndCmd() or HCI_LE_ReceiverTestCmd(), the program sort of goes somewhere and I can not debug step anymore?

    Initialization:

    HCI_EXT_EnablePTMCmd();

    C Function to Start and Stop PER Test.

    void TestApp__PERTest(BYTE state)  
    {
        if (state == 0)
        {
          HCI_LE_TestEndCmd();  // need to be called in main task    
        }
        else if (state == 1)
        {
          HCI_LE_ReceiverTestCmd(39); // need to be called in main task
        }
        else
        {
          UartApp__WriteString("INV PER TEST VALUE\r\n");
        }  
                
    }

    After calling HCI_LE_TestEndCmd(), wait for Command Complete Event and then get the number of packets

    // Process HCI Command Complete Event
              case HCI_COMMAND_COMPLETE_EVENT_CODE:
              {
                  // Parse Command Complete Event for opcode and status
                  hciEvt_CmdComplete_t* command_complete = (hciEvt_CmdComplete_t*)pMsg;
                  uint8_t status = command_complete->pReturnParam[0];
    
                  //find which command this command complete is for
                  switch (command_complete->cmdOpcode)
                  {
                      case HCI_LE_RECEIVER_TEST:
                      {
                          if (status == SUCCESS)
                          {
                              numPackets[0] = command_complete->pReturnParam[7];
                              numPackets[1] = command_complete->pReturnParam[8];
                              
                              sprintf(numPacketsString, "0x%x%x", numPackets[0], numPackets[1]);
        
                              UartApp__WriteString((BYTE *)numPacketsString);
                              UartApp__WriteString("\r\n");
                              UartApp__WriteString("Read Packets DONE.\r\n"); 
                              
                          }
                      }
                  }