Chinaunix首页 | 论坛 | 博客
  • 博客访问: 798736
  • 博文数量: 124
  • 博客积分: 1927
  • 博客等级: 上尉
  • 技术积分: 932
  • 用 户 组: 普通用户
  • 注册时间: 2010-08-31 14:06
文章分类

全部博文(124)

文章存档

2018年(5)

2017年(2)

2016年(6)

2015年(4)

2014年(24)

2013年(7)

2012年(11)

2011年(13)

2010年(52)

我的朋友

分类: LINUX

2016-09-08 09:07:35

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

由  于 2015-7-3 创建的讨论
由Krishna Prasad于2016-7-9提供 

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: 

And iMX6 instructions here- 

 

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 

 

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

./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=

 

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!

阅读(2036) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~