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.

Linux/AM4378: WiFi on Custom Board

Part Number: AM4378
Other Parts Discussed in Thread: WL1831, , SYSCONFIG, AM4372, WL1835

Tool/software: Linux

Hello,

I have a custom board based on the AM437x EVM, and I am using TI-SDK version 4.3.0.5. I am trying to get WiFi up and running on my board, and I am using the WL1831 WiFi/BT combo module. The WiFi pins are hooked up to MMC2 on the AM4378.

Initially in my dts file I had an mmc2 node because I am using MMC2 but it wasn't working, and I noticed the EVM also uses MMC2 to hook up the WiFi chip, but it has the node labeled mmc3 in the dts file. I also remembered for mmc0 I had to label it mmc1 in the dts file.

So I changed the node to be labeled mmc3 in my dts file, but now the boot hangs during U-Boot when it tries doing something with MMC. Here is the boot log:

U-Boot SPL 2018.01-00558-g8617e02-dirty (Apr 19 2019 - 09:32:41)
Trying to boot from MMC1
SPL: Please implement spl_start_uboot() for your board
SPL: Direct Linux boot not active!


U-Boot 2018.01-00558-g8617e02-dirty (Apr 19 2019 - 09:32:41 -0500)

CPU : AM437X-GP rev 1.2
Model: TI AM437x UTI BOARD
DRAM: 512 MiB
PMIC: NONE
NAND: 0 MiB
MMC:

I looked at the code in CCS and saw that it fails in the function omap_hsmmc_init_setup(), at the line writel(readl(&mmc_base->sysconfig) | MMC_SOFTRESET, &mmc_base->sysconfig);

Any ideas on what could be going wrong? Here are the relevant sections of my device tree:

wlan_en_reg: fixedregulator@2 {
compatible = "regulator-fixed";
regulator-name = "wlan-en-regulator";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
startup-delay-us = <70000>;

/* WLAN_EN GPIO for this board - Bank0, pin31 */
gpio = <&gpio0 31 GPIO_ACTIVE_HIGH>;
enable-active-high;
};

mmc3_pins_default: mmc3_pins_default {
pinctrl-single,pins = <
AM4372_IOPAD(0x88c, PIN_INPUT_PULLUP | MUX_MODE3) /* (A12) gpmc_clk.mmc2_clk */
AM4372_IOPAD(0x888, PIN_INPUT_PULLUP | MUX_MODE3) /* (B12) gpmc_csn3.mmc2_cmd */
AM4372_IOPAD(0x844, PIN_INPUT_PULLUP | MUX_MODE3) /* (C5) gpmc_a1.mmc2_dat0 */
AM4372_IOPAD(0x848, PIN_INPUT_PULLUP | MUX_MODE3) /* (C6) gpmc_a2.mmc2_dat1 */
AM4372_IOPAD(0x84c, PIN_INPUT_PULLUP | MUX_MODE3) /* (A4) gpmc_a3.mmc2_dat2 */
AM4372_IOPAD(0x878, PIN_INPUT_PULLUP | MUX_MODE3) /* (A3) gpmc_be1n.mmc2_dat3 */
>;
};

/* Optional sleep pin settings. Must manually enter values in the below skeleton. */
mmc3_pins_sleep: mmc3_pins_sleep {
pinctrl-single,pins = <
AM4372_IOPAD(0x88c, PIN_INPUT_PULLDOWN | MUX_MODE7) /* (A12) gpmc_clk.mmc2_clk */
AM4372_IOPAD(0x888, PIN_INPUT_PULLDOWN | MUX_MODE7) /* (B12) gpmc_csn3.mmc2_cmd */
AM4372_IOPAD(0x844, PIN_INPUT_PULLDOWN | MUX_MODE7) /* (C5) gpmc_a1.mmc2_dat0 */
AM4372_IOPAD(0x848, PIN_INPUT_PULLDOWN | MUX_MODE7) /* (C6) gpmc_a2.mmc2_dat1 */
AM4372_IOPAD(0x84c, PIN_INPUT_PULLDOWN | MUX_MODE7) /* (A4) gpmc_a3.mmc2_dat2 */
AM4372_IOPAD(0x878, PIN_INPUT_PULLDOWN | MUX_MODE7) /* (A3) gpmc_be1n.mmc2_dat3 */
>;
};

wlan_pins_default: wlan_pins_default {
pinctrl-single,pins = <
AM4372_IOPAD(0x85c, PIN_INPUT_PULLDOWN | WAKEUP_ENABLE | MUX_MODE7) /* (F6) gpmc_a7.gpio1[23] WLAN_IRQ*/
AM4372_IOPAD(0x870, PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* (A2) gpmc_wait0.gpio0[30] BT_ENABLE */
AM4372_IOPAD(0x874, PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* (B3) gpmc_wpn.gpio0[31] WLAN_ENABLE */
>;
};

wlan_pins_sleep: wlan_pins_sleep {
pinctrl-single,pins = <
AM4372_IOPAD(0x85c, PIN_INPUT_PULLDOWN | WAKEUP_ENABLE | MUX_MODE7) /* (F6) gpmc_a7.gpio1[23] WLAN_IRQ*/
AM4372_IOPAD(0x870, PIN_OUTPUT_PULLUP | MUX_MODE7) /* (A2) gpmc_wait0.gpio0[30] BT_ENABLE */
AM4372_IOPAD(0x874, PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* (B3) gpmc_wpn.gpio0[31] WLAN_ENABLE */
>;
};

/* WiFi/Bluetooth Module */
&mmc3 {
status = "okay";
/* these are on the crossbar and are outlined in the
xbar-event-map element */
dmas = <&edma 30 0 2>,
<&edma 31 0 3>;
dma-names = "tx", "rx";
vmmc-supply = <&wlan_en_reg>;
bus-width = <4>;
pinctrl-names = "default", "sleep";
pinctrl-0 = <&mmc3_pins_default>;
pinctrl-1 = <&mmc3_pins_sleep>;
ti,non-removable;
cap-power-off-card;
keep-power-in-suspend;

#address-cells = <1>;
#size-cells = <0>;
wlcore: wlcore@0 {
compatible = "ti,wl1835";
reg = <2>;
interrupt-parent = <&gpio1>;
interrupts = <23 IRQ_TYPE_LEVEL_HIGH>;
};
};

  • Looking into the U-Boot code some more in CCS, I can see that the correct value for MMC2 base address is loaded into the mmc_base variable. I can see in the datasheet that MMC2 base address is 0x47810000, which is what is loaded into mmc_base. But it looks like when it tries to read from the sysconfig register, it is failing for some reason.
  • H,
    MMC 'x' node is enumerated as 'x+1' in dts file. Do you see wlan_en getting asserted ?

    Saurabh
  • No, when I change it to &mmc3 in my .dts file U-Boot crashes when it tries to initialize MMC2. In the function omap_hsmmc_init_setup() it tries to read the value of the sysconfig register and crashes.

    I can see in the memory browser that the memory at the location it is trying to read is all ????.
  • Apparently the version of U-Boot that I was using caused the crash when I changed to &mmc3. I reverted back to an older verison of U-Boot and now it does not crash anymore, but I still don't get any WiFi functionality. wlan_en is not being asserted.
  • Hi , what kernel version are you running ? Do you see system finding SDIO card during system bootup - "new high speed SDIO card at address 0" ?

    Saurabh
  • My kernel version is 4.9.69. And no, I do not see that message during boot. But there is an mmc1 folder in /sys/class/mmc_host/.
  • I noticed that if I change the &edma to &edma_xbar in the mmc3 node, wlan_enable goes high for a split second but then goes back low. Could my issue be related to that? I just copied the values 30, 0, 1, etc, from the EVM but I'm not really sure what they mean.
  • Hi , I am not sure why xbar was missing in first place. pls consult the following dts and make sure wifi related settings are same except for board specific changes .
    github.com/.../am437x-gp-evm.dts

    Saurabh
  • Yeah I have been consulting the EVM .dts file and I am pretty sure everything is exactly the same. I'll post the WiFi related parts of my .dts file again. I can't find anything that is different so if you see anything please let me know.

    vmmcwl_fixed: fixedregulator-mmcwl {
    compatible = "regulator-fixed";
    regulator-name = "vmmcwl_fixed";
    regulator-min-microvolt = <1800000>;
    regulator-max-microvolt = <1800000>;

    // WLAN_EN GPIO for this board - Bank0, pin31
    gpio = <&gpio0 31 GPIO_ACTIVE_HIGH>;
    enable-active-high;
    };

    wlan_pins_default: wlan_pins_default {
    pinctrl-single,pins = <
    AM4372_IOPAD(0x85c, PIN_INPUT | WAKEUP_ENABLE | MUX_MODE7) /* (F6) gpmc_a7.gpio1[23] WLAN_IRQ*/
    AM4372_IOPAD(0x870, PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* (A2) gpmc_wait0.gpio0[30] BT_ENABLE */
    AM4372_IOPAD(0x874, PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* (B3) gpmc_wpn.gpio0[31] WLAN_ENABLE */
    >;
    };

    wlan_pins_sleep: wlan_pins_sleep {
    pinctrl-single,pins = <
    AM4372_IOPAD(0x85c, PIN_INPUT | WAKEUP_ENABLE | MUX_MODE7) /* (F6) gpmc_a7.gpio1[23] WLAN_IRQ*/
    AM4372_IOPAD(0x870, PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* (A2) gpmc_wait0.gpio0[30] BT_ENABLE */
    AM4372_IOPAD(0x874, PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* (B3) gpmc_wpn.gpio0[31] WLAN_ENABLE */
    >;
    };

    /* WiFi/Bluetooth Module */
    &mmc3 {
    status = "okay";
    /* these are on the crossbar and are outlined in the
    xbar-event-map element */
    dmas = <&edma_xbar 30 0 1>,
    <&edma_xbar 31 0 2>;
    dma-names = "tx", "rx";
    vmmc-supply = <&vmmcwl_fixed>;
    bus-width = <4>;
    pinctrl-names = "default", "sleep";
    pinctrl-0 = <&mmc2_pins_default>;
    pinctrl-1 = <&mmc2_pins_sleep>;
    cap-power-off-card;
    keep-power-in-suspend;
    ti,non-removable;

    #address-cells = <1>;
    #size-cells = <0>;
    wlcore: wlcore@0 {
    compatible = "ti,wl1831";
    reg = <2>;
    interrupt-parent = <&gpio1>;
    interrupts = <23 IRQ_TYPE_EDGE_RISING>;
    };
    };
  • Hi ,
    - Do you still not see following trace during boot up ""new high speed SDIO card at address" ?
    - wlan_en is controlled by MMC/SDIO driver using voltage regulator frame work . You might want to troubleshoot MMC/SDIO driver and check why it's de-asserting it
    - For kernel 4.9, you may need to apply this patch : patchwork.kernel.org/.../

    Saurabh
  • No I do not see that message for MMC2. I have already applied that patch to my kernel. And when I look at how the EVM boots, it looks like it does the same thing where it asserts wlan_en and de-asserts it, but then later in the boot it asserts it for good. What else could possibly be going wrong if my .dts file is exactly the same as the EVM .dts file?
  • Hi, Can you share o/p of 'ifconfig -a' and 'lsmod'

    Saurabh
  • ifconfig:

    eth0      Link encap:Ethernet  HWaddr F0:B5:D1:3E:56:35  

             inet addr:192.168.61.109  Bcast:192.168.61.255  Mask:255.255.255.0

             inet6 addr: fe80::f2b5:d1ff:fe3e:5635%763860/64 Scope:Link

             UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

             RX packets:43693 errors:0 dropped:0 overruns:0 frame:0

             TX packets:40126 errors:0 dropped:0 overruns:0 carrier:0

             collisions:0 txqueuelen:1000

             RX bytes:39270183 (37.4 MiB)  TX bytes:6377758 (6.0 MiB)

             Interrupt:74

    lo        Link encap:Local Loopback  

             inet addr:127.0.0.1  Mask:255.0.0.0

             inet6 addr: ::1%763860/128 Scope:Host

             UP LOOPBACK RUNNING  MTU:65536  Metric:1

             RX packets:6 errors:0 dropped:0 overruns:0 frame:0

             TX packets:6 errors:0 dropped:0 overruns:0 carrier:0

             collisions:0 txqueuelen:1

             RX bytes:528 (528.0 B)  TX bytes:528 (528.0 B)

    Here is lsmod before and after running the load_wlcore.sh script.

    BEFORE:

    Module                  Size  Used by

    sha512_generic         10031  0

    sha512_arm             12316  0

    sha256_generic         10178  0

    sha1_generic            2928  0

    sha1_arm_neon           6325  0

    sha1_arm                3926  1 sha1_arm_neon

    md5                     2219  0

    cbc                     2388  0

    xfrm_user              22345  2

    xfrm4_tunnel            2040  0

    ipcomp                  2257  0

    xfrm_ipcomp             4183  1 ipcomp

    esp4                    6402  0

    ah4                     5627  0

    af_key                 26840  0

    xfrm_algo               6989  5 xfrm_user,esp4,ah4,af_key,xfrm_ipcomp

    pvrsrvkm              403500  0

    bluetooth             337029  2

    snd_soc_wilink8_bt      2045  1

    snd_soc_simple_card     5844  0

    snd_soc_simple_card_utils     5095  1 snd_soc_simple_card

    pm33xx                  6433  0

    matrix_keypad           6769  0

    matrix_keymap           2881  1 matrix_keypad

    omap_des               11375  0

    omap_aes_driver        19334  0

    des_generic            17608  1 omap_des

    crypto_engine           7098  2 omap_des,omap_aes_driver

    omap_sham              21950  0

    ti_emif_sram            5663  1 pm33xx

    dwc3_omap               5132  0

    extcon_core            17242  1 dwc3_omap

    snd_soc_tlv320aic3x    48423  1

    wkup_m3_ipc             8176  1 pm33xx

    wkup_m3_rproc           3670  1

    remoteproc             28453  2 wkup_m3_rproc,wkup_m3_ipc

    omap_wdt                4634  0

    sch_fq_codel            9051  1

    uio_module_drv          7251  0

    uio                     9121  1 uio_module_drv

    ftdi_sio               32360  0

    usbserial              26355  1 ftdi_sio

    usbcore               201732  2 ftdi_sio,usbserial

    usb_common              4737  1 usbcore

    cryptodev              38083  1

    cmemk                  35021  0

    AFTER:

    Module                  Size  Used by

    wlcore_sdio             6833  0

    wl18xx                 85935  0

    wlcore                182816  1 wl18xx

    mac80211              377021  2 wl18xx,wlcore

    cfg80211              229440  3 wl18xx,wlcore,mac80211

    sha512_generic         10031  0

    sha512_arm             12316  0

    sha256_generic         10178  0

    sha1_generic            2928  0

    sha1_arm_neon           6325  0

    sha1_arm                3926  1 sha1_arm_neon

    md5                     2219  0

    cbc                     2388  0

    xfrm_user              22345  2

    xfrm4_tunnel            2040  0

    ipcomp                  2257  0

    xfrm_ipcomp             4183  1 ipcomp

    esp4                    6402  0

    ah4                     5627  0

    af_key                 26840  0

    xfrm_algo               6989  5 xfrm_user,esp4,ah4,af_key,xfrm_ipcomp

    pvrsrvkm              403500  0

    bluetooth             337029  2

    snd_soc_wilink8_bt      2045  1

    snd_soc_simple_card     5844  0

    snd_soc_simple_card_utils     5095  1 snd_soc_simple_card

    pm33xx                  6433  0

    matrix_keypad           6769  0

    matrix_keymap           2881  1 matrix_keypad

    omap_des               11375  0

    omap_aes_driver        19334  0

    des_generic            17608  1 omap_des

    crypto_engine           7098  2 omap_des,omap_aes_driver

    omap_sham              21950  0

    ti_emif_sram            5663  1 pm33xx

    dwc3_omap               5132  0

    extcon_core            17242  1 dwc3_omap

    snd_soc_tlv320aic3x    48423  1

    wkup_m3_ipc             8176  1 pm33xx

    wkup_m3_rproc           3670  1

    remoteproc             28453  2 wkup_m3_rproc,wkup_m3_ipc

    omap_wdt                4634  0

    sch_fq_codel            9051  1

    uio_module_drv          7251  0

    uio                     9121  1 uio_module_drv

    ftdi_sio               32360  0

    usbserial              26355  1 ftdi_sio

    usbcore               201732  2 ftdi_sio,usbserial

    usb_common              4737  1 usbcore

    cryptodev              38083  1

    cmemk                  35021  0

  • Sorry I didn't see that you said "ifconfig -a". Here is that output:

    eth0 Link encap:Ethernet HWaddr F0:B5:D1:3E:56:35
    inet addr:192.168.61.109 Bcast:192.168.61.255 Mask:255.255.255.0
    inet6 addr: fe80::f2b5:d1ff:fe3e:5635%763860/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:45416 errors:0 dropped:0 overruns:0 frame:0
    TX packets:41761 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:41237105 (39.3 MiB) TX bytes:6592660 (6.2 MiB)
    Interrupt:74

    lo Link encap:Local Loopback
    inet addr:127.0.0.1 Mask:255.0.0.0
    inet6 addr: ::1%763860/128 Scope:Host
    UP LOOPBACK RUNNING MTU:65536 Metric:1
    RX packets:6 errors:0 dropped:0 overruns:0 frame:0
    TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1
    RX bytes:528 (528.0 B) TX bytes:528 (528.0 B)

    sit0 Link encap:IPv6-in-IPv4
    NOARP MTU:1480 Metric:1
    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
    TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1
    RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
  • Hi ,
    - as per logs , i see wl8 kernel modules loaded but wlan0 interface disabled
    - b.w evm and customized boards, mostly you just need to modify dts for wlan_en and wlan_irq settings , assuming same mmc controller is being used for wl8
    - as i mentioned before, you will need to troubleshoot mmc/sdio for this issue. few pointers below
    - reduce sdio max clock freq in dts file to 5 Mhz for testing. add max-frequency = <5000000>; in dts mmc section
    - increase wlan_en startup delay to 200msecs in dts ( i believe it is set to 70 msecs by default )

    Saurabh
  • Where is a good place to start troubleshooting mmc/sdio? Is there a kernel config option I can set so that it will print debug messages?
  • From what I can tell, for mmc2, the function mmc_attach_sdio() in [linux]/drivers/mmc/core.c should succeed. It looks like it is failing when it tries to send a command in the function mmc_send_io_op_cond().

    In this function, mmc_wait_for_cmd() is throwing an error, which causes the attach to fail, and then power off mmc2.

    Do you have any idea what could be causing this to happen?
  • Hi ,
    - Did you try reducing SDIO clk freq to check if it improves this scenario ?
    - To ensure VBAT/VIO , clk etc. are set ok , please confirm power up sequence in section 5.19.2 is being followed : www.ti.com/.../swrs152m.pdf

    Saurabh
  • Yes, I added max-frequency = <5000000>; to the mmc section. In the boot log it prints mmc1: mmc_rescan_try_freq: trying to init card at 400000 Hz. Is that normal?

    I looked at the power up sequence for VBAT, VIO, and clk - it seems okay to me. The clock is starting after VIO and VBAT go high
  • Yes, that is normal . card initialization is @400KHz for first few cmds and then MMC/SDIO driver moves to normal/max freq . As a check , make sure sense on reset pins ( total 3 ) are set for operational mode : section 3 of www.ti.com/.../swra448a.pdf
    Do you see any significant undershoots / overshoots in your SDIO trace captures ? Want to make sure there are no h/w signal integrity issues on your board

    Saurabh
  • I did not see any significant undershoot or overshoot. I don't have testpoints for WLAN_IRQ or BT_UART_DBG, is there some other way to check for operational mode? It says in that PDF there are supposed to be internal pullup and pulldown resistors for these pins, correct?
  • Hi , you may consult the datasheet for internal pull up / pull down on these pins . But for some pins we still need external pull up /down . Check if there is external pull up on irq pin , if yes then wilink is definitely not booting in operational mode .

    Saurabh
  • We do not have an external pullup on wlan_irq, so I think it should be booting in operational mode...

    I noticed that the EVM has a 10K pullup resistor on mmc2_clk, and we do not have this pullup on our board. Would that make any difference?
  • Hi Tanner,

    For us to help troubleshoot the issue better. Can you provide the schematic for the design? We can then provide any feedback as to why you may be seeing an issue.

    Thanks,
    Riz
  • Hi Riz,

    Yes I can provide the schematic, can I send it via email?
  • Hi Tanner,

    I just send you an e-mail. I will close this thread out for now.

    Thanks
    Riz