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.

CC2650: SPP Client

Part Number: CC2650


I am looking at flashing a CC2650 with the SPP client code, i want to change the settings so that i can connect it to another server (rather than another board), is this possible and if so how?

I thought it would be just a matter of changing the server name for the client to try and connect to and passcode in the settings however i cannot find these settings.

  • Hey Jake,

    You're on the right track. The SPP Client example has a SPPBLEClient_autoConnect() function that is enabled by default. It connects to a preset bdAddress (i.e. 0x000102030405), which is what the SPP Server example was set to.

    To connect to a different device, you can change the device address in the autoConnect() function and enter the device you want to connect to. As you've mentioned, remember that the server needs to share the same passcode and pairing settings, so be sure to update those as well. Most of the defines are at the top of the spp_ble_client.c file.

    Another option may be to disable the CLIENT_AUTO_CONNECT feature by setting it to FALSE.
  • Hi Ammar,

    Thank you so much, this is what i have needed, i have come across an issue however.

    I am currently stuck on changing the address of the target, i have found the autoconnect function however cannot work out where to put the new address into (the following code is from the spp_client.c file):



    * @fn SPPBLEClient_autoConnect
    *
    * @brief Client automatically connects to hardcoded address
    *
    * @return none
    */
    void SPPBLEClient_autoConnect(void)
    {
    uint8_t addrType;
    uint8_t peerAddr[6];

    // connect to hardcoded device address i.e. 0x050403020100
    int x = 0;
    for(x = 0; x<6; x++)
    {
    peerAddr[x] = x;
    }

    addrType = ADDRTYPE_PUBLIC;

    DEBUG("Auto connecting..."); DEBUG_NEWLINE();

    GAPCentralRole_EstablishLink(DEFAULT_LINK_HIGH_DUTY_CYCLE,
    DEFAULT_LINK_WHITE_LIST,
    addrType, peerAddr);

    }





    which part do i input my new device address into?

    Thanks,
    Jake
  • Hey Jake,

    You'll want to remove the for loop as this generates the array we use for the spp_server. It should look like this:

    * @fn SPPBLEClient_autoConnect
    *
    * @brief Client automatically connects to hardcoded address
    *
    * @return none
    */
    void SPPBLEClient_autoConnect(void)
    {
    uint8_t addrType;
    uint8_t peerAddr[6];
    
    // connect to hardcoded device address i.e. 0x050403020100
    peerAddr = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 };
    
    addrType = ADDRTYPE_PUBLIC;
    
    DEBUG("Auto connecting..."); DEBUG_NEWLINE();
    
    GAPCentralRole_EstablishLink(DEFAULT_LINK_HIGH_DUTY_CYCLE,
    DEFAULT_LINK_WHITE_LIST,
    addrType, peerAddr);
    
    }

    Make sure to take note of the endianness. The actual address in the example above is 0x050403020100. Be sure to change the device address to the device you'd like to auto connect to.

  • Thank you for your quick response!

    Just to clarify, am i correct that the code would look like this if i was trying to connect to 0x050403020100 (for example):

    peerAddr = { 0x050403020100 };
  • could i put the mac address directly in like

    peerAddr= { mac address }

    or do i need to convert the address to hex first? specifically is it a base16 integer i need to convert it to?
  • or do i need to convert each section of the mac address to hex like 0x00, then separate with a comma?
  • No matter what i try in peerAddr = i keep getting error #138 expression must be a modifiable value, #19 extra text after expected end of number, and #29 Expected an expression
  • got it working with uint8_t peerAddr[6] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 };