BLE Device automatically Disconnect

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

BLE Device automatically Disconnect

Jump to solution
2,001 Views
lukas_berger
Contributor II

Hello,

 

I´m running the wireless_uart example Program from the FRDM-KW 36. When I try to connect to the Device with the IoT Toolbox App everything works fine. But when I try to connect to the devices via an outer App the device automatically Disconnect after one or two seconds. This happens on android and iOS. 

 

With the outer App I can find the Device and can connect to it. I also can Discover Services and read the Value from the Characteristic. But after two seconds it Automatically Disconnect. I can normally connect to other BLE devices without automatic Disconnect. 

 

Because I can connect to other devices with no problem, I think the problem is in die wireless_uart Software.

 

Can some on please help me with this problem?

 

Thanks in advance.

 

Regards,

 

Lukas Berger

Labels (2)
Tags (2)
1 Solution
1,835 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

HI Lukas,

You can see the reason in the function void BleApp_StateMachineHandler(deviceId_t peerDeviceId, appEvent_t event) implement.

 case mAppExchangeMtu_c:
        {
            if (event == mAppEvt_GattProcComplete_c)
            {
                /* update stream length with minimum of maximum MTU's of connected devices */
                (void)Gatt_GetMtu(peerDeviceId, &tempMtu);
                tempMtu = gAttMaxWriteDataSize_d(tempMtu);

                mAppUartBufferSize = mAppUartBufferSize <= tempMtu ? mAppUartBufferSize : tempMtu;

                /* Moving to Service Discovery State*/
                maPeerInformation[peerDeviceId].appState = mAppServiceDisc_c;

                /* Start Service Discovery*/
                (void)BleServDisc_FindService(peerDeviceId,
                                              gBleUuidType128_c,
                                              temp.pUuidObj);
            }
            else
            {
                if (event == mAppEvt_GattProcError_c)
                {
                    (void)Gap_Disconnect(peerDeviceId);
                }
            }
        }

The board will start to find uart service from your cell phone after connect and exchange MTU, which means you need to add a wireless uart service with proper 128 bit UUID on your phone.

Regards,

Mario

View solution in original post

1 Reply
1,836 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

HI Lukas,

You can see the reason in the function void BleApp_StateMachineHandler(deviceId_t peerDeviceId, appEvent_t event) implement.

 case mAppExchangeMtu_c:
        {
            if (event == mAppEvt_GattProcComplete_c)
            {
                /* update stream length with minimum of maximum MTU's of connected devices */
                (void)Gatt_GetMtu(peerDeviceId, &tempMtu);
                tempMtu = gAttMaxWriteDataSize_d(tempMtu);

                mAppUartBufferSize = mAppUartBufferSize <= tempMtu ? mAppUartBufferSize : tempMtu;

                /* Moving to Service Discovery State*/
                maPeerInformation[peerDeviceId].appState = mAppServiceDisc_c;

                /* Start Service Discovery*/
                (void)BleServDisc_FindService(peerDeviceId,
                                              gBleUuidType128_c,
                                              temp.pUuidObj);
            }
            else
            {
                if (event == mAppEvt_GattProcError_c)
                {
                    (void)Gap_Disconnect(peerDeviceId);
                }
            }
        }

The board will start to find uart service from your cell phone after connect and exchange MTU, which means you need to add a wireless uart service with proper 128 bit UUID on your phone.

Regards,

Mario