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.

TM4C129XNCZAD: SPPDEMO Bluetooth is Advertising But not Pairing

Part Number: TM4C129XNCZAD
Other Parts Discussed in Thread: CC2564MODA, CC2564,

Hi,

I am using CC2564MODA Bluetooth module in my Project, From CC2564_Bluetopia Stack I am using SPPDEMO Profile, Everything is correct. After loading the code to my kit, the Bluetooth is advertising but its not Pairing the device, I don't know what happened suddenly, Can you please help me anyone on this. How to solve this issue. I hop you people will help on this. I am waiting for your quick response.

Thanks in advance.

  • Hi Jansi, in order to better help you and understand your issue could you provide logs using these tools WILINK-BT per the instructions: Bluetooth Logger and Link Quality Monitor (LQM) Tools (Rev. D) (ti.com). Also please let us know more information about your set-up i.e. host device, patch version, etc. 

  • Hi,

    My patch version is CC2564MODA and I am not sure which host device you are asking. Can you please help. In my Project I am using SPPDEMO profile from that I have declared device name and I called device name in openstack function, but its advertising the name not pairing with mobile Bluetooth also.

    Thanks in advance.

  • Hi Jansi, when I say patch version I am referring to the files at this link: CC256XB-BT-SP Driver or library | TI.com, these are necessary init files that fix bugs and help configure CC2564MODA. Also, I am assuming based on the name of the ticket the host device, the device in charge of communicating with CC2564MODA via UART/HCI is TM4C129XNCZAD. 

    In order to change the name broadcasted, please see the SetLocalName() function in SPPDemo.c. Particularly of interest in that function is the GAP_Set_Local_Device_Name from the SDK which should set the local device's name.

  • Hi Daniel, 

    Thanks for the reply.

    I have to use GAP_Set_Local_Device_Name this function under SetLocalName() right. If I call means my function will advertise and pairing will happen correct. 

    In my prohecr CC2564MODA via HCI only not in UART.

    Thanks in advance

  • Yeah I Have Called GAP_Set_Local_Device_Name(BluetoothStackID,  DEFAULT_LOCAL_DEVICE_NAME); under the Openstack function but still its advertising the device name but not pairing into any device. Please help me on this. How to solve this issue.

    Thanks in advance

  • Hi,

    I will share my log in below attachment.

  • Hi Jansi, the GAP_Set_Local_Device_Name function will only change the name that the device advertises, it will not pair the device, that is a separate function.

    It might help you to go through this document alongside the demo: SPPDemo Tutorial.pdf 

    At the end of the document it describes each of the General Access Profile(GAP) functions used within the demo. For example, following the demo's instructions: after inquiry to see which bluetooth devices are visible, the demo calls the below function which takes the bluetooth address of the target device.

    int BTPSAPI SPP_Open_Remote_Port(unsigned int BluetoothStackID, BD_ADDR_t BD_ADDR, unsigned int ServerPort, SPP_Event_Callback_t SPP_Event_Callback, unsigned long CallbackParameter);

  • Hello Daniel,

    If I want to pair the device what is that seperate function I have to use, Please help me on this.

  • Can you please give me that how to set the passcode and also which function I have to use to pair the device. Please help me on this, I am stuck on this last one week. I am waiting for your quick response.

    Thanks in advance.

  • Hi,

    Whatever document you provided I referred that and then I implemented the below two functions , but still not pairing. Please help me which function I have to use for pairing the device using sppdemo profile.

    GAP_Set_Local_Device_Name(BluetoothStackID, "MyDeviceName");

    GAP_Authentication_Response(BluetoothStackID, BD_ADDR,(uint32_t *) &Passkey);

  • Hi Jansi, within that document you referred to,

    GAP_Initiate_Bonding(BluetoothStackID, BD_ADDR, BondingType, GAP_Event_Callback, (unsigned long)0);

    Is the function that starts the pairing process. Please implement this function and let me know if it works.

  • Hello Daniel Oils,

    The above I have mentioned in my code, but still I am not getting what is the issue, why its not pairing the device.

    static int Pair(ParameterList_t *TempParam) {
        int Result;
        int ret_val;
        GAP_Bonding_Type_t BondingType;
        Display(("pair------1685"));
        /* First, check that valid Bluetooth Stack ID exists.                */
        if (BluetoothStackID) {
            /* Next, make sure that we are not already connected.             */
            if (!Connected) {
                /* There are currently no active connections, make sure that   */
                /* all of the parameters required for this function appear to  */
                /* be at least semi-valid.                                     */
                if ((TempParam) &&(TempParam->NumberofParameters > 0)
                        && (TempParam->Params[0].intParam)
                        && (NumberofValidResponses) &&(TempParam->Params[0].intParam
                                <= NumberofValidResponses)
                        && (!COMPARE_BD_ADDR(
                                InquiryResultList[(TempParam->Params[0].intParam - 1)],
                                NullADDR))) {
                    /* Check to see if General Bonding was specified.           */
                    if (TempParam->NumberofParameters > 1)
                        BondingType =
                                TempParam->Params[1].intParam ?
                                        btGeneral : btDedicated;
                    else
                        BondingType = btDedicated;
    
                    /* Before we submit the command to the stack, we need to    */
                    /* make sure that we clear out any Link Key we have stored  */
                    /* for the specified device.                                */
                    DeleteLinkKey(
                            InquiryResultList[(TempParam->Params[0].intParam - 1)]);
    
                    /* Attempt to submit the command.                           */
                    Result = GAP_Initiate_Bonding(BluetoothStackID,
                            InquiryResultList[(TempParam->Params[0].intParam - 1)],
                            BondingType, GAP_Event_Callback, (unsigned long) 0);
    
                    /* Check the return value of the submitted command for      */
                    /* success.                                                 */
                    if (!Result) {
                        /* Display a messsage indicating that Bonding was        */
                        /* initiated successfully.                               */
                        Display(
                                ("GAP_Initiate_Bonding(%s): Success.\r\n", (BondingType == btDedicated)?"Dedicated":"General"));
    
                        /* Flag success to the caller.                           */
                        ret_val = 0;
                    } else {
                        /* Display a message indicating that an error occured    */
                        /* while initiating bonding.                             */
                        DisplayFunctionError("GAP_Initiate_Bonding", Result);
    
                        ret_val = FUNCTION_ERROR;
                    }
                } else {
                    /* One or more of the necessary parameters is/are invalid.  */
                    DisplayUsage(
                            "Pair [Inquiry Index] [0 = Dedicated, 1 = General (optional)]");
    
                    ret_val = INVALID_PARAMETERS_ERROR;
                }
            } else {
                /* Display an error to the user describing that Pairing can    */
                /* only occur when we are not connected.                       */
                Display(("Only valid when not connected.\r\n"));
    
                ret_val = FUNCTION_ERROR;
            }
        } else {
            /* No valid Bluetooth Stack ID exists.                            */
            ret_val = INVALID_STACK_ID_ERROR;
        }
    
        return (ret_val);
    }
    
    
    I will attach my code , can you please go through once.

    static int Pair(ParameterList_t *TempParam) {
    int Result;
    int ret_val;
    GAP_Bonding_Type_t BondingType;
    Display(("pair------1685"));
    /* First, check that valid Bluetooth Stack ID exists. */
    if (BluetoothStackID) {
    /* Next, make sure that we are not already connected. */
    if (!Connected) {
    /* There are currently no active connections, make sure that */
    /* all of the parameters required for this function appear to */
    /* be at least semi-valid. */
    if ((TempParam) &&(TempParam->NumberofParameters > 0)
    && (TempParam->Params[0].intParam)
    && (NumberofValidResponses) &&(TempParam->Params[0].intParam
    <= NumberofValidResponses)
    && (!COMPARE_BD_ADDR(
    InquiryResultList[(TempParam->Params[0].intParam - 1)],
    NullADDR))) {
    /* Check to see if General Bonding was specified. */
    if (TempParam->NumberofParameters > 1)
    BondingType =
    TempParam->Params[1].intParam ?
    btGeneral : btDedicated;
    else
    BondingType = btDedicated;

    /* Before we submit the command to the stack, we need to */
    /* make sure that we clear out any Link Key we have stored */
    /* for the specified device. */
    DeleteLinkKey(
    InquiryResultList[(TempParam->Params[0].intParam - 1)]);

    /* Attempt to submit the command. */
    Result = GAP_Initiate_Bonding(BluetoothStackID,
    InquiryResultList[(TempParam->Params[0].intParam - 1)],
    BondingType, GAP_Event_Callback, (unsigned long) 0);

    /* Check the return value of the submitted command for */
    /* success. */
    if (!Result) {
    /* Display a messsage indicating that Bonding was */
    /* initiated successfully. */
    Display(
    ("GAP_Initiate_Bonding(%s): Success.\r\n", (BondingType == btDedicated)?"Dedicated":"General"));

    /* Flag success to the caller. */
    ret_val = 0;
    } else {
    /* Display a message indicating that an error occured */
    /* while initiating bonding. */
    DisplayFunctionError("GAP_Initiate_Bonding", Result);

    ret_val = FUNCTION_ERROR;
    }
    } else {
    /* One or more of the necessary parameters is/are invalid. */
    DisplayUsage(
    "Pair [Inquiry Index] [0 = Dedicated, 1 = General (optional)]");

    ret_val = INVALID_PARAMETERS_ERROR;
    }
    } else {
    /* Display an error to the user describing that Pairing can */
    /* only occur when we are not connected. */
    Display(("Only valid when not connected.\r\n"));

    ret_val = FUNCTION_ERROR;
    }
    } else {
    /* No valid Bluetooth Stack ID exists. */
    ret_val = INVALID_STACK_ID_ERROR;
    }

    return (ret_val);
    }

  • Hi Jansi, correct me if I'm wrong but your code, save for Display(("pair------1685")); is exactly identical to the sample code.

    Have you made any other changes to the demo? If not, the demo should work exactly as described in the document I provided if you follow the instructions in order. Please let me know what the function returns when you call it as it should contain an error code helpful for debugging.

    Otherwise, in order to better help understand your issue, I'll ask you to collect logs as I did in my initial message. I've attached the instructions to the Logger software for your benefit. Bluetooth® Logger and Link Quality Monitor (LQM) Tools.pdf

  • Hi Daniel Oils,

    Thanks for your reply.

    As you mentioned, the demo code is working fine and also its pairing successfully, But In demo code I have added my custom code, after adding custom code the pairing is not happening, only device name is advertising but not at all pairing. The error is showing as "Could not Pairing". Please help me on this.

    I don't know how to send logs, can you please help me how to collect the logs. 

    Thanks in advance.

  • Hello Daniel,

    I have shared my logs in below attachment. kindly go through it, please help me on this.

  • Hi Jansi,

    What you've attached is a screenshot of a very small portion of the log, typically a log contains thousands of lines. Please attach the log file itself so that I may open it in the software on my end and go through it.

  • Yeah Daniel ,

    How to share the log file to you. Can you please tell me how to upload the log files

  • Hi Jansi, please save the file on your local computer, then on E2E when writing a post, click Insert > Image/Video/File, Upload to choose the log, then hit okay.

  • Hi Daniel, 

    I have tried to upload the log file, click Insert > Image/Video/File, But I am unable to load the file, while loading the log file its not loading. Can you please tell me any alternate way

  • Hi Jansi, I sent you a message on E2E DM, if you click the chat box icon in the top right of the page you should be able to see my message.

    Afterwards, I'll post the log you send here for others to see and we can continue debugging.

  • Yeah Sure. I have sent mail. Can you please go through it and let me know the solution for my problems.