The FRDM-KW36 can't connect with smart phone

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

The FRDM-KW36 can't connect with smart phone

1,656 Views
sihanchen
Contributor III

Hello All ~

             I have used the button to config the FRDM-KW36 as a peripheral device for to connect to the smart phone. Although the smart phone can find the FRDM-KW36 and allow it to connect, but the connection will disconnect immediately when FRDM -KW36 was connected to the phone.

     I tried to find the problem and it seems like the service can't be found .... During this connection process, The FRDM-KW36 will try to find out the corresponding service several times and will disconnect the connection when the service can't be found. 

      Can anyone to tell me how to solve this problem or please provide some suggestion to me.

Many thanks.

Here are some debug log to show as follows : 

pastedImage_1.png

Labels (2)
7 Replies

1,282 Views
sihanchen
Contributor III

Hello ~ 

Update the root cause : 

The problem is that the central device uses the UUID16 primary service, and the BleApp_ServiceDiscoveryCallback() API only stores UUID128 type. Can anyone tell me how to add UUID16 related services and how to obtain the detailed of primary service of the central device, so I can customize it.

Thanks. 

0 Kudos

1,282 Views
Sebastian_Del_Rio
NXP Employee
NXP Employee

Hi Sihan, I hope you're doing well!

 

You're probably getting disconnected immediately because the Wireless UART example is programmed to look for the Wireless UART service on the connected device upon connection, and if the service is not found, it initiates a disconnection immediately. This can be seen in the BleApp_StateMachineHandler function, found in the wireless_uart.c source file.

 

To get around this, the Gap_Disconnect() line after the connection and MTU exchange can be erased so the missing service doesn't trigger a disconnection, or you can also try adding the missing UART service to your other device with its corresponding UUID (for Wireless UART, it's "01ff0100-ba5e-f4ee-5ca1-eb1e5e4b1ce0"). This could ensure that, when the KW36 looks for the Wireless UART service, it finds it and it doesn't trigger the disconnection.

 

Also, could you please take a look at the BLE Application Developer's Guide? It has some additional information about the 16-bit UUIDs, which could also be useful:

<…\SDK_2.2.2_FRDM-KW36 - MCUXpresso\docs\wireless\Bluetooth\Bluetooth Low Energy Application Developer Guide.pdf>

 

Please let me know if you need any more information.

 

Best regards,

Sebastian

1,282 Views
sihanchen
Contributor III

HI Sebastian, 

           Thank for your help, I will take some time to study the BLE Application Development's Guide, and will try to add 16-bit UUIDs to the SDK. 

     I have some questions for UUID, Our product is also used 128bits-UUID (4D029ABB0000418A8FA5464F9B799A6B) and it can be connected with the smart phone, I try to modify the NXP's 128bit-UUID to make it the same as ours but it still can't connect with the smart phone. Does this mean that I should add the corresponding services of the smart phone to the NXP's SDK ? 

Thanks. 

0 Kudos

1,282 Views
Sebastian_Del_Rio
NXP Employee
NXP Employee

Hi Sihan,

 

The two triggers for disconnection during the connection procedure happen in the BleApp_StateMachineHandler, the issue could be because of one of the following conditions:

  • When the devices are exchanging their MTU, if the process fails, the State machine triggers a disconnection.
  • When discovering services, if the event is mAppEvt_ServiceDiscoveryFailed_c, then it also triggers a disconnect; if it's mAppEvt_ServiceDiscoveryNotFound_c, it triggers a service discovery retry.
  • Finally, if it fails service discovery again, this also causes the state machine to trigger a disconnection.

This can be found in the wireless_uart.c source file.

 

The KW36Z is looking for the corresponding services in the device it connects to, so if the device does not have the correct service, the disconnection is triggered. Could you please check to see if the phone has the same Wireless UART UUID for the service that the KW36Z has?

 

Please let me know if you need any more information.

 

Best regards,

Sebastian

1,282 Views
sihanchen
Contributor III

HI Sebastian, 

        Thank for your help, I use nRF_UART v2.0 and nRF_Toolbox APP to test. These APPs should support UART profile and 1800 (Generic attributes) service. but FRDM-KW36 still can't connect with them. Maybe for a specific test purpose, Does the default SDK of NXP has been configured to only supports NXP_IOT_Toolbox APP ?

Many thanks.

0 Kudos

1,282 Views
Sebastian_Del_Rio
NXP Employee
NXP Employee

Hi Sihan,

The examples were designed to be tested with our IOT Toolbox mobile application, available to download for iOS and Android.

Could you please try connecting to this application to see if the issue persists?

Please let me know if you need any more information.

Best regards,

Sebastian

0 Kudos

1,283 Views
urban_sharon
Contributor III

Hi,

I am experiencing the same behaviour when connecting to a device running the WUART example via mobile app using this BLE library:

FlutterBleLib/REFERENCE.md at master · Polidea/FlutterBleLib · GitHub 

I see that the device is unable to discover the mobile app as WUART and disconnects from it and I am not sure as of how setting the mobile side to declare itself as such should be done...

Your kind help would be appreciated