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.

Problems connecting to SPP Server from Windows



I have just downloaded the bluetopia SDK and am trying to test the SPPDemo application with a Windows 7 SP1 notebook.

I am using the DK-EM2-2560B kit for the DK-LM3S9D96 evaluation board.

I am opening a SPP Server port on the stellaris side and trying to open a serial port on the PC to connect to it.

When I first did this, everything worked OK.

I managed to pair succesfully and Windows created a virtual serial port for communication:

Server>
atPINCodeRequest: 0x402cf4180c08
Respond with: PINCodeResponse

Server>pincoderesponse 65808515
GAP_Authentication_Response(), Pin Code Response Success.

Server>
atLinkKeyCreation: 0x402cf4180c08
Link Key Stored.

While opening the com port from the windows pc, the server reported

atLinkKeyRequest: 0x402cf4180c08
GAP_Authentication_Response success.

Server>
SPP Open Indication, ID: 0x0002, Board: 0x402cf4180c08.

Server>
SPP Port Status Indication: 0x0002, Status: 0x000b, Break Status: 0x0000, Length: 0x0000.

Server>
SPP Port Status Indication: 0x0002, Status: 0x000b, Break Status: 0x0000, Length: 0x0000.

I could then send data back and forth over the bluetooth link.

I then powered down the stellaris board for the night and went home.

The next day I powered it back up, and could not open the virtual com port from the PC (windows remembered the paired device, so i did not need to pair it again)

Whenever I tried to connect I only got the following response on the stellaris board:

atLinkKeyRequest: 0x402cf4180c08

GAP_Authentication_Response success.

I could never get it to connect! 

Then in desparation I removed the device from Windows and re-paired it to the stellaris board. 

When I then tried to connect it worked, and I got the following response on the stellaris side:

atLinkKeyRequest: 0x402cf4180c08

GAP_Authentication_Response success.

Server>
SPP Open Indication, ID: 0x0002, Board: 0x402cf4180c08.

Server>
SPP Port Status Indication: 0x0002, Status: 0x000b, Break Status: 0x0000, Length: 0x0000.

Server>
SPP Port Status Indication: 0x0002, Status: 0x000b, Break Status: 0x0000, Length: 0x0000.

I then looked at the code for the SPPDemo example and saw that the code behaved differently if it had the link key information for the requested connection

/* Setup the authentication information response */
/* structure. */
GAP_Authentication_Information.GAP_Authentication_Type = atLinkKey;
GAP_Authentication_Information.Authentication_Data_Length = 0;

/* Link Key information stored, go ahead and */
/* respond with the stored Link Key. */
GAP_Authentication_Information.Authentication_Data_Length = sizeof(Link_Key_t);
GAP_Authentication_Information.Authentication_Data.Link_Key = LinkKeyInfo[Index].LinkKey;

It seems that Windows will only complete the connection if the GAP_Authentication_Information.Authentication_Data.Link_Key is filled in.

My question is, is this a problem with Windows, or is the SPPDemo program doing something wrong?

(sorry for the long post)

Clive

  • Hi Clive,

    We are working on this and will get back to you.

  • Hi Clive,

    We tested this out today and we were not able to reproduce the issue you were having. After connecting once we powered down the Stellaris board, and then brought it back up. We tried connecting again with the virtual COM port and it prompts for a PIN code each time before connecting/pairing. After connecting with the PIN code we were able to communicate without any issues. Are you doing anything else apart from powering down the Stellaris board?

    Regards,

    Stonestreet One.

  • I assume the prompt you are getting is from Windows?

    When I try to connect after restarting the device I get no prompt.

    When I try to connect I get a busy cursor that eventually times out trying to connect.

    Is there a setting for Windows to prompt for a PIN on each connect failure?

    I have Windows 7 SP1 Enterprise 64 bit with all Windows required updates applied.

    What option did you choose for the PIN that windows asks for when you initially paired?

    Clive

  • Hi Clive,

    Yes I was referring to the prompt from Windows. When I open the Virtual Com Port Windows prompts me for the pincode. We are running Windows 7 Professional SP1 with the latest updates but I dont think the OS should matter. I used 0000 as my pincode for both connections. I have a copy of my Bluetooth settings attached here. Could you confirm you have the issue with the same settings? Specifically make sure that all the options in the Discovery and Connection tab are checked.

  • I have all the options set as you. I do not, however have the option to turn off the Bluetooth adapter.

    I too am using 0000 as the PIN code to connect. I never get the prompt for the PIN to connect.

    My laptop is an HP Elitebook that uses an HP 2.1+EDR Bluetooth solution.

  • Hello Clive, 

    We just responded to a similar question on another thread. I am including the same response here as I believe it is a very similar issue and may have the same cause.

    It sounds like the Link key is not present on your device but Windows has it and so Windows is not initiating a connection to this device. Try deleting the pairing information on Windows and it should work.

    In our sample application we do not store Link key to the flash so it will be lost on power cycle. This may create a case where remote device has it and local device does not. Remote device tries to authenticate and it fails as local device has lost the key. At this time, the behavior of remote device is application dependent. It can delete the link key and try connecting again and that will result in pairing process getting triggered and then the devices will be connected. 

    On the local device, the link key-Remote BDADDR combination can be saved to flash and read from it on power up to avoid this.

    Hope this helps,

    Stonestreet One.