Step-by-step: How to setup TI Wilink (WL18xx) with iMX6 Linux 3.10.53

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

Step-by-step: How to setup TI Wilink (WL18xx) with iMX6 Linux 3.10.53

62,673 Views
erezsteinberg
Contributor IV

Hello everyone,

I'm sharing my experience bringing-up a TI Wilink Module (WL18xx) on iMX6 Linux 3.10.53

You can find a lot of information here: WL18xx - Texas Instruments Wiki

And iMX6 instructions here- WL18xx First Time Getting Started Guide (IMX6) - Texas Instruments Wiki

Hardware setup -- iMX6 communicates with WL18xx over SDIO (WiFI) and UART (Bluetooth).

On iMX6, the tricky part is correct connection of the UART lines, especially the RTS/CTS lines.

In DCE mode (default) the signals should be connected as follows:

     WL18xx Module                         iMX6 Port

    [Out] Pad 50 (BT_HCI_RTS)   ---->       UART_RTS

    [In ] Pad 51 (BT_HCI_CTS)   <----       UART_CTS

    [Out] Pad 52 (BT_HCI_TX)    ---->       UART_RX

    [In ] Pad 53 (BT_HCI_RX)    <----       UART_TX

If the RTS/CTS lines are connected incorrectly, the BT driver won't be able to load.

Software setup-

You should have Linux 3.10.53 and a Root file-system ready.

(Make sure you don't have any uncommitted changes)

To build the WiFi drivers, follow the steps in WL18xx System Build Scripts - Texas Instruments Wiki

In the setup-env file :

TOOLCHAIN_PATH    -- Either use your iMX6 toolchain, or leave as default (it worked for me).

ROOTFS                     -- Point to your root filesystem

KERNEL_PATH           -- Point to you Linux kernel sources

KERNEL_VARIANT     -- Set to 'imx-3.10.53'  (This will apply patches to your kernel !)

Steps to build the WL18xx software:

git clone git://git.ti.com/wilink8-wlan/build-utilites.git

cd build-utilites/

cp setup-env.sample setup-env

<edit setup-env>

./build_wl18xx.sh init          (This will take a long time)

./build_wl18xx.sh patch_kernel

The last step applies several patch to your kernel. The patches include updates to the sources files, configuration files, and device tree files.

If you use a different kernel configuration than imx_v7_defconfig, make sure to make the same kernel changes to your configuration.

Also, update your device tree files according to the patches.

In your device tree, make sure to setup the BT_EN_SOC, WLAN_EN_SOC, and WL_IRQ GPIOs correctly, and provide them in the correct nodes in the device tree.

Here's an example -

    // BT and WiFI Enable [OUT]

    MX6QDL_PAD_EIM_D16__GPIO3_IO16  0x13059   // BT_EN_SOC

    MX6QDL_PAD_EIM_D17__GPIO3_IO17  0x13059   // WLAN_EN_SOC

    MX6QDL_PAD_SD3_DAT4__GPIO7_IO01 0x13059   // WL_IRQ

    wlan_en_reg: fixedregulator@2 {

        compatible = "regulator-fixed";

        regulator-name = "wlan-en-regulator";

        regulator-min-microvolt = <1800000>;

        regulator-max-microvolt = <1800000>;

        /* WLAN_EN GPIO for this board – Bank4, pin7 */

        gpio = <&gpio3 17 0>;

        /* WLAN card specific delay */

        startup-delay-us = <70000>;

        enable-active-high;

    };

    kim {

            compatible = "kim";

            nshutdown_gpio = <80>;  /* GPIO3_IO16 */

            dev_name = "/dev/ttymxc2";

            flow_cntrl = <1>;

            baud_rate = <3000000>;

    };

    btwilink {

            compatible = "btwilink";

    };

&usdhc3 {

    pinctrl-names = "default";

    pinctrl-0 = <&pinctrl_usdhc3>;

    no-1-8-v;

    keep-power-in-suspend;

    enable-sdio-wakeup;

    vmmc-supply = <&wlan_en_reg>;

    non-removable;    /* non-removable is not a variable, the fact it is */

                      /* listed is all that is used by driver  */

    cap-power-off-card;

    status = "okay";

    #address-cells = <1>;

    #size-cells = <0>;

    wlcore: wlcore@0 {

        compatible = "ti,wlcore";

        reg = <2>;

        interrupt-parent = <&gpio7>;

        interrupts = <1 0>;

        platform-quirks = <1>;

    };   

};   

   

&uart3 {

    pinctrl-names = "default";

    pinctrl-0 = <&pinctrl_uart3>;

    status = "okay";

    /* enable rts/cts usage on uart3 */

    fsl,uart-has-rtscts;   

};

Now -- build you kernel -

   make -j4 uImage modules dtbs

Install the modules in your root filesystem

    make modules_install INSTALL_MOD_PATH=<rootfs path>

Now, run the last step in the Wilink build script:

./sudo_build_wl18xx.sh update R8.5

This will build and install the Wilink drivers and software in the root filesystem.

That's it! -- it should work.   The wifi modules should load automatically when the kernel boots.

How to test?

WIFI -

>   ifconfig wlan0 up

>   iw wlan0 scan

(This should display a list of access points).

Bluetooth -

>    hciconfig hci0 up

>    hcitool scan

(This should scan for bluetooth devices).

Additional comments-

1. You can also use Linux 3.14.28, but you'll have to apply the patches manually.

2. If you have an issue with RTS/CTS, you can disable it. :

  (a) Change flow_cntrl to <0> in kim.

  (b) Change the baud rate to 115200 in kim.

  (c) Remove  fsl,uart-has-rtscts;   in the uart node.

  (d) Remove the CTS and RTS in the IOMUX

  (e) Comment out line 208 in src/uim/uim.c (in the build-utilites folder)

         ti.c_cflag |= CRTSCTS;

   NOTE 1: Without RTS/CTS you must bring up the Bluetooth driver first

   NOTE 2: You really should use RTS/CTS -- otherwise expect problems due to sync lost between host and module.

Good luck!

Labels (2)
Tags (2)
0 Kudos
22 Replies

7,828 Views
ivannikolaenko
Contributor IV

Hello Erez!

Thank you for so fast responce!

You were right - kim was mistakenly identified in the "regulators" field.

Now:

UIM SYSFS Node Found at /sys/./devices/soc0/kim.25/install

Starting uim-sysfs daemon.

uim:@ main

uim:install = /sys/./devices/soc0/kim.25/install

uim:dev_name = /sys/./devices/soc0/kim.25/dev_name

uim:baud_rate = /sys/./devices/soc0/kim.25/baud_rate

uim:flow_cntrl = /sys/./devices/soc0/kim.25/flow_cntrl

uim:install set previously...

uim:@ st_uart_config

uim: signal received, opening /dev/ttymxc4

uim:@ set_baud_rate

uim:set_baud_rate() done

uim:Setting speed to 3000000

uim:@ read_command_complete

uim: Command complete started

uim:@ read_hci_event

uim: read_hci_event

uim:Invalid response

At the end of bootlog:

uim:begin polling...

uim:poll broke due to event 10(PRI:2/ERR:8)

uim:read 0 from install

uim:@ st_uart_config

uim:Un-Installed N_TI_WL Line displine

uim:begin polling...

I thought that it might be a rfkill:

root@plaz-ilim:~# rfkill list

0: hci0: bluetooth

        Soft blocked: yes

        Hard blocked: no

root@plaz-ilim:~# rfkill unblock all

root@plaz-ilim:~# rfkill list

0: hci0: bluetooth

        Soft blocked: no

        Hard blocked: no

root@plaz-ilim:~# hci

hciattach  hciconfig  hciemu     hcitool   

root@plaz-ilim:~# hciconfig hci0 up

(stc):  chnl_id list empty :4

(stk) : st_kim_start(stk) :ldisc_install = 1uim:poll broke due to event 10(PRI:2/ERR:8)

uim:read 1 from install

uim:@ st_uart_config

uim: signal received, opening /dev/ttymxc4

uim:@ set_baud_rate

uim:set_baud_rate() done

uim:Setting speed to 3000000

uim:@ read_command_complete

uim: Command complete started

uim:@ read_hci_event

uim: read_hci_event

uim:Invalid response

(stk) :ldisc installation timeout(stk) :ldisc_install = 0

(stk) : timed out waiting for ldisc to be un-installed(stk) :ldisc_install = 1

/* = 0 and = 1 5 times*/

(stk) : timed out waiting for ldisc to be un-installedBluetooth: st_register failed -22

Can't init device hci0: Input/output error (5)

I don't know what to do with this...

Regarding the "update R8.5", I have a compilation error because it can't apply 0001-completion-remove-reinit_completion-decleration.patch and i'm forced to apply it manually,

If i do a "update R8.5", my changes overwrites by script and it is a vicious circle.

0 Kudos

298 Views
saurabh206
Senior Contributor III

Hi Erez,

Its ready explains most of the things, really helpful document.

Thanks

Saurabh

0 Kudos