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.

BT File Transfer Issue in Android 5.0 with wl12xx



Hi All,

We are trying to bring up bluetooth on custom iMX6 Sabresd board with wl12xx chipset for Android Lollipop 5.0.
We have followed the steps below to add support for wl12xx chipset,

defconfig:

CONFIG_TI_ST=y
CONFIG_ST_HCI=y
CONFIG_OF=y
CONFIG_BT=y
CONFIG_BT_L2CAP=y
CONFIG_BT_SCO=y
CONFIG_BT_RFCOMM=y
CONFIG_BT_RFCOMM_TTY=y
CONFIG_BT_BNEP=y
CONFIG_BT_BNEP_MC_FILTER=y
CONFIG_BT_BNEP_PROTO_FILTER=y
CONFIG_BT_HIDP=y
CONFIG_BT_HCIUART=y
CONFIG_BT_HCIUART_H4=y
CONFIG_BT_HCIUART_BCSP=y
CONFIG_BT_HCIUART_LL=y
CONFIG_BT_HCIUART_3WIRE=y


Board file:

static struct ti_st_plat_data wilink_pdata = {
.nshutdown_gpio = 0,
.dev_name = "/dev/ttymxc2",
.flow_cntrl = 1,
.baud_rate = 3000000,
.suspend = plat_kim_suspend,
.resume = plat_kim_resume,
.chip_enable = plat_kim_chip_enable,
.chip_disable = plat_kim_chip_disable
};

static struct platform_device wl127x_bt_device = {
.name = "kim",
.id = -1,
.dev.platform_data = &wilink_pdata,
};

static struct platform_device btwilink_device = {
.name = "btwilink",
.id = -1,
};


init script:

chown bluetooth net_bt_stack /dev/ttymxc2
chmod 0660 /dev/ttymxc2


service uim /system/bin/uim-sysfs
class core
user bluetooth
group bluetooth net_bt_admin


After making those changes bluetooth interface is up and we are able to scan and list devices. While testing file transfer, we were able to receive files but couldn't transfer files. During file transfer, the entire system seems to be stuck and unresponsive. We are not able to get any debug information regarding this issue. We have successfully tested this combination in Android Kitkat 4.4.2. Is this issue related with the bluetooth stack(bluedroid) ?

Have anyone faced any issue similar to this?

  • Hi,

    Since Bluedroid runs in the userspace, it's unlikely to be the source of the "entire system freeze".
    Perhaps the UART driver is the issue (Tx). But without logs, it's hard to tell.

    Regards,
    Gigi Joseph.
  • Hi Gigi,

    With Debug messages enabled in driver, we were not able to locate the issue as they are inconsistent. Is there any other way to debug it ?
    While working on this issue, we back-traced the source of the problem. We suspect that the following thread goes into lock state and causes the system to hang.

    FILE: external/bluetooth/bluedroid/gki/ulinux/gki_ulinux.c

    UINT16 GKI_wait (UINT16 flag, UINT32 timeout){
    .......................................
    pthread_cond_wait(&gki_cb.os.thread_evt_cond[rtask], &gki_cb.os.thread_evt_mutex[rtask]);
    ........................................
    }

    Thanks,
    Saravana
  • Hi Saravana,

    Probably, please raise the issue on some Bluedroid forum (external) as we don't support the bluedroid stack.

    Regards,
    Gigi Joseph.
  • Hi Gigi,
    Have you tested wl12xx in android lollipop? if so could you please tell the steps that has to be followed for porting?

    I've followed the steps given in
    1) processors.wiki.ti.com/.../WL18xx_First_Time_Getting_Started_Guide_(IMX6)
    2) processors.wiki.ti.com/.../Bringing_Up_Bluedroid_on_Android_for_WL18xx

    In the second link which i have listed they have mentioned "This has been validated on pre device tree kernels " and described the steps to be followed for kernels having device tree.

    Thanks ,
    Saravana
  • Hi Saravana,

    The porting guide explains the steps to integrate (bring up) bluedroid stack with the WL18xx shared transport drivers. The stack itself is not altered and not supported.

    Regards,
    Gigi Joseph.
  • Hi Gigi,

    Even i am facing exactly  the same issue as mentioned above.

    Any solution for this. If anybody has any solution please share the same.

    Regards,

    Shilpa

  • Hi,

    We have a assigned your question to the relevant POC that may be able to help.
    Please expect a followup reply.

    BR,
    Eyal
  • Hi all,

    I am also facing the same issue with wl18xx on iMX6  Android Lollipop 5.0. Bluetooth bring up and scan remote devices with no issue. But transfer files to remote device would failed and system crash then reboot.

    Please see attached log and logcat.

    Is this issue from NXP?

    BR,

    Wayneandroid_5.0_bt_opp_logcat.txt

    android5.0_bt_opp_kernel.txt

  • On your kernel log it seems like the crash is related to the SDHCI controller and not BT.
    See the mmc3 timeout below:

    mxc_sdc_fb fb.33: MXCFB_WAIT_FOR_VSYNC: timeout 0
    mmc3: Timeout waiting for hardware interrupt.
    ------------[ cut here ]------------
    WARNING: at drivers/mmc/host/sdhci.c:996 sdhci_send_command+0xc7c/0xe14()
    Modules linked in: wlcore_sdio(O) wl18xx(O) wlcore(O) mac80211(O) cfg80211(O) compat(O)
    CPU: 3 PID: 0 Comm: swapper/3 Tainted: G O 3.10.53-88204-g4f0dd92-dirty #13
    [<80013fc8>] (unwind_backtrace+0x0/0xf8) from [<800118f4>] (show_stack+0x10/0x14)
    [<800118f4>] (show_stack+0x10/0x14) from [<8002da30>] (warn_slowpath_common+0x4c/0x68)
    [<8002da30>] (warn_slowpath_common+0x4c/0x68) from [<8002da68>] (warn_slowpath_null+0x1c/0x24)
    [<8002da68>] (warn_slowpath_null+0x1c/0x24) from [<80584948>] (sdhci_send_command+0xc7c/0xe14)
    [<80584948>] (sdhci_send_command+0xc7c/0xe14) from [<80585744>] (sdhci_timeout_timer+0x70/0xb4)
    [<80585744>] (sdhci_timeout_timer+0x70/0xb4) from [<80039cc8>] (call_timer_fn.isra.21+0x24/0x84)
    [<80039cc8>] (call_timer_fn.isra.21+0x24/0x84) from [<80039efc>] (run_timer_softirq+0x1d4/0x20c)
    [<80039efc>] (run_timer_softirq+0x1d4/0x20c) from [<8003465c>]

    Is mmc3 the controller used for wl18xx (wlan)?
    In case it is can you try limiting the sdio frequency and see if it helps?

    You can limit the sdio frequency in the .dts file inside the mmc3 node :

    sdhci@xxxxxxx {
    compatible = "sdhci";
    ...
    max-frequency = <10000000>;
    ...
    }

    In this example we limit the sdio to 10Mhz.
    If it helps then the issue may be related to the sdio bus signal integrirty and needs to be looked at with the board designer.

    BR,
    Eyal
  • Hi,
    Can we close this thread already?
    BR,
    Eyal
  • Hi Eyal,

    We have still not got the solution. My log doesnt throw any error as given above related to mmc.

    The board just hangs and WDOG reset is happening.

    The log is as showm below. Kindly provide some solution for the same. Let me know which area of the code i need to look in.



    ------------------------------------------

    W/AudioTrack( 437): AUDIO_OUTPUT_FLAG_FAST denied by client
    I/audio_hw_primary( 140): start_output_stream... 1980462848, device 2
    W/audio_hw_primary( 140): card 0, port 0 device 0x2
    W/audio_hw_primary( 140): rate 44100, channel 2 period_size 0xc0
    I/bt_vendor( 1545): vendor op - 7
    I/bt_vendor( 1545): vendor op - 7
    I/bt_vendor( 1545): vendor op - 7
    W/ContextImpl( 1066): Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1321 android.content.ContextWrapper.sendBroadcast:376 com.android.settings.bluetooth.DevicePickerFragment.sendDevicePickedIntent:144 com.android.settings.bluetooth.DevicePickerFragment.onDevicePreferenceClick:111 com.android.settings.bluetooth.DeviceListPreferenceFragment.onPreferenceTreeClick:145
    V/BluetoothDiscoveryReceiver( 1066): Received: android.bluetooth.adapter.action.DISCOVERY_FINISHED
    D/LocalBluetoothManager( 1066): setting foreground activity to null
    W/OrientationEventListener( 1411): Cannot detect sensors. Not enabled
    E/BufferQueueProducer( 133): [SurfaceView] dequeueBuffer: can't dequeue multiple buffers without setting the buffer count
    I/GLRootView( 1411): GLObject has changed from com.google.android.gles_jni.GLImpl@24093def to com.google.android.gles_jni.GLImpl@29368855
    E/BufferQueueProducer( 133): [Toast] dequeueBuffer: can't dequeue multiple buffers without setting the buffer count
    W/BtOppService( 1545): updateShare() called for ID 1 with null URI
    D/BtOppService( 1545): insertShare parsed URI: file:///storage/emulated/0/bluetooth/IMG_20160905_104827.jpg@31a5f1af
    D/BluetoothOppUtility( 1545): getSendFileInfo: uri=file:///storage/emulated/0/bluetooth/IMG_20160905_104827.jpg@31a5f1af
    I/GLRootView( 1411): onSurfaceChanged: 1280x735, gl10: com.google.android.gles_jni.GLImpl@29368855
    W/ResourceType( 1411): No package identifier when getting value for resource number 0x00000000
    W/PackageManager( 1411): Failure retrieving resources for com.android.bluetooth: Resource ID #0x0
    W/BtOppService( 1545): updateShare() called for ID 1 with null URI
    W/BluetoothAdapter( 1545): getBluetoothService() called with no BluetoothManagerCallback
    D/BTIF_SOCK( 1545): service_uuid: 00001105-0000-1000-8000-00805f9b34fb
    I/bt_vendor( 1545): vendor op - 7
    W/bt-btif ( 1545): info:x10
    D/ ( 1545): remote version info [64:09:80:ce:2e:68]: 6, 1d, 7d3
    I/bt_vendor( 1545): vendor op - 7
    I/bt_vendor( 1545): vendor op - 7
    I/bt_vendor( 1545): vendor op - 7
    I/bt_vendor( 1545): vendor op - 7
    I/bt_vendor( 1545): vendor op - 7
    I/bt_vendor( 1545): vendor op - 7
    I/bt_vendor( 1545): vendor op - 7
    I/bt_vendor( 1545): vendor op - 7
    I/bt_vendor( 1545): vendor op - 7
    I/bt_vendor( 1545): vendor op - 7
    I/bt_vendor( 1545): vendor op - 7
    I/bt_vendor( 1545): vendor op - 7
    I/bt_vendor( 1545): vendor op - 7
    W/bt-sdp ( 1545): process_service_search_attr_rsp
    I/bt_vendor( 1545): vendor op - 7
    I/bt_vendor( 1545): vendor op - 7
    I/bt_vendor( 1545): vendor op - 7
    I/bt_vendor( 1545): vendor op - 7
    I/bt_vendor( 1545): vendor op - 7
    I/bt_vendor( 1545): vendor op - 7
    I/bt_vendor( 1545): vendor op - 7
    I/bt_vendor( 1545): vendor op - 7
    I/bt_vendor( 1545): vendor op - 7
    I/bt_vendor( 1545): vendor op - 7
    W/bt-btif ( 1545): new conn_srvc id:26, app_id:1
    W/bt-btif ( 1545): bta_dm_pm_ssr conn_srvc id:26, app_id:1
    W/bt-btif ( 1545): bta_dm_pm_ssr:2, lat:1200
    I/bt_vendor( 1545): vendor op - 7
    I/bt_vendor( 1545): vendor op - 7
    D/BtOppObexClient( 1545): Start!
    D/BluetoothOppUtility( 1545): getSendFileInfo: uri=file:///storage/emulated/0/bluetooth/IMG_20160905_104827.jpg@31a5f1af
    I/bt_vendor( 1545): vendor op - 7
    W/BtOppService( 1545): updateShare() called for ID 1 with null URI
    D/BtOppObexClient( 1545): Create ClientSession with transport com.android.bluetooth.opp.BluetoothOppRfcommTransport@323d65a8
    I/bt_vendor( 1545): vendor op - 7
    D/BtOppObexClient( 1545): OBEX session created
    W/BtOppService( 1545): updateShare() called for ID 1 with null URI
    W/BtOppService( 1545): updateShare() called for ID 1 with null URI
    D/ ( 1545): PORT_WriteData

    U-Boot 2014.04-08648-g9d7bf9b-dirty (Sep 26 2016 - 16:17:10)

    CPU: Freescale i.MX6D rev1.5 at 792 MHz
    CPU: Temperature 51 C, calibration data: 0x5774e869
    Reset cause: WDOG
    Board: MAGIK2
    I2C: ready
    DRAM: 1 GiB
    MMC: FSL_SDHC: 0, FSL_SDHC: 1
    No panel detected: default to TIANMA-TYP-WXGA
    Display: TIANMA-TYP-WXGA (1280x800)
    In: serial
    Out: serial
    Err: serial
    Found PFUZE100 deviceid=10,revid=21
    check_and_clean: reg 0, flag_set 0
    Fastboot: Normal
    flash target is MMC:1
    Net: Phy not found
    PHY reset timed out
    FEC [PRIME]
    Warning: failed to set MAC address

    Normal Boot
    Hit any key to stop autoboot: 0



    -----------------------------------------------------------

    Regards,

    Shilpa
  • Hi,

    I don't see anything here.
    What does the corresponding kernel log show? What happens before the board reboot?

    BR,
    Eyal
  • HI Eyal,

    We have developed a customised board with imx6q processor . We have Android 5.0 ported on to it. We then applied the patch for wilink8 module for wifi , BT from the link processors.wiki.ti.com/.../WL18xx_First_Time_Getting_Started_Guide_(IMX6)

    With wilink8 ( Android 5.0+ imx6q ), we are able to enable BT, scan and pair. BT file tranfer from other device to DUT is also successful. But when we try to transfer any file from DUT to any other device, the system hangs and reboots. The above log was captured when we tried to do BT transfer from DUT.


    Regards,
    Shilpa
  • Hi Shilpa,

    I understand that but what I don't see in the log is the reason for the reboot.
    Didn't see any kernel crash that can explain it.
    Did you check both logcat as well as dmesg or /proc/kmesg?
    I would have expected to see something wrong going on with the uart before the reboot.

    BR,
    Eyal
  • Hi Eyal,

    That is what even we are facing. Not able to get any logs further. The device just hangs and then reboots. 

    we are using UART2 of i.MX6 dual processor in DCE mode. We are also suspecting the UART driver/interface.

    If anybody has logged any isues with UART2 port on imx6 being used for bluetooth usage, even that thread will be useful.

    Kindly suggest if any known issues are logged or captured.

    Regards,

    Shilpa

  • Hi ,

    Finaly we were able to fix the issue.

    The issue was with the serial driver (imx.c) in kernel 3.10.53. 

    After porting the serial driver from Android 5.1, (kernel 3.14), BT transfer started working.

    Regards,

    Shilpa

  • Glad it works :)


    BR,

    Eyal