# Unable to have stable Wifi with MT7697 over UART or SPI

**URL:** https://mangoh.discourse.group/t/unable-to-have-stable-wifi-with-mt7697-over-uart-or-spi/2560
**Category:** mangOH Red
**Created:** [April 17, 2019, 7:39am UTC](https://mangoh.discourse.group/t/unable-to-have-stable-wifi-with-mt7697-over-uart-or-spi/2560 "2019-04-17T07:39:46Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![c.pahl](https://avatars.discourse-cdn.com/v4/letter/c/5f8ce5/32.png) [@c.pahl](https://mangoh.discourse.group/u/c.pahl)
#### Post date: [April 17, 2019, 7:39am UTC](https://mangoh.discourse.group/t/unable-to-have-stable-wifi-with-mt7697-over-uart-or-spi/2560/1 "2019-04-17T07:39:46Z")

</div>

Hello mangOH forum,

I managed to get the WiFi almost working on my WP7607G using [this guide](https://github.com/mangOH/mangOH/wiki/mangOH-Red-mt7697-WiFi) and legato `18.10.3`. Here’s what I’m trying:

```bash
$ ifup wlan1
Setup MT7697 UART
Device: WP76
Enable power control
Initialized MT7697 WiFi core
Started MT7697 WiFi uart core wlan1
# I copied the contents from my target, 
# where the connection is indeed working,
# so I can hopefully rule this out:
$ cat > /etc/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
    ssid="SSID"
    psk="PASS"
}
$ wpa_supplicant -d -i wlan1 -c /etc/wpa_supplicant.conf

```

I’m also able to enumerate APs using `iw wlan1 scan`, just not able to connect. I recorded a verbose log of `wpa_supplicant` in this gist:

```
https://gist.github.com/sahib/8f77b1184556cbf4ebd7a9b91fe40fa5 

```

The issue seems to be:

```bash
[...] This is after "enable_network 0"
wlan1: Authentication with 64:d1:54:3c:c3:d3 timed out.
[...]
wlan1: Request to deauthenticate - bssid=00:00:00:00:00:00 pending_bssid=64:d1:54:3c:c3:d3 reason=3 state=ASSOCIATING
wpa_driver_nl80211_disconnect(reason_code=3)
wlan1: Event DEAUTH (12) received
wlan1: Deauthentication notification
wlan1: * reason 3 (locally generated)
Deauthentication frame IE(s) - hexdump(len=0): [NULL]
wlan1: CTRL-EVENT-DISCONNECTED bssid=64:d1:54:3c:c3:d3 reason=3 locally_generated=1
[...]

```

I do use `wlan0` by the way, because `wlan0` fails to startup. It this a known issue? See the log below. Also, `wifi client` seems to be tied to `wlan0` and even changing it to `wlan1` via a `sed -i 's/wlan0/wlan1/g' $(find -iname '*.[ch]')` seems to fail at the same stage as `wpa_supplicant`.

```bash
$ ifup wlan0
Failed to start TI wifi
$ logread -f 
Jan 6 00:37:31 swi-mdm9x28-wp user.err kernel: [2249.441210] i2c-msm-v2 78b8000.i2c: NACK: slave not responding, ensure its powered: msgs(n:2 cur:0 tx) bc(rx:2 tx:1) mode:FIFO slv_addr:0x55 MSTR_STS:0x0d1300c8 OPER:0x00000010

```

This seems to be a similar problem as in [this thread](https://mangoh.discourse.group/t/problem-connecting-to-wi-fi-hotspot-client-mode/1997), but nobody seemed to have answered there yet,  
so I figured out that I might better create a new thread.

Would be very happy if somebody could help.

---

<div class="post-metadata">

### Author: ![c.pahl](https://avatars.discourse-cdn.com/v4/letter/c/5f8ce5/32.png) [@c.pahl](https://mangoh.discourse.group/u/c.pahl)
#### Post date: [April 17, 2019, 11:45am UTC](https://mangoh.discourse.group/t/unable-to-have-stable-wifi-with-mt7697-over-uart-or-spi/2560/2 "2019-04-17T11:45:14Z")

</div>

I managed to find it out myself. You have to run `wpa_supplicant` with `-D wext`:  
My exact command was :`wpa_supplicant -d -D wext -i wlan1 -c /etc/wpa_supplicant.conf`.

This gave me a link, as observed by:

```bash
$ iw wlan1 link
Connected to 64:d1:54:3c:c3:d3 (on wlan1)
        SSID: MY-SSID
        freq: 2452

```

A `udhcpc -i wlan1` later I had an IP and I was able to ping google afterwards.

---

<div class="post-metadata">

### Author: ![c.pahl](https://avatars.discourse-cdn.com/v4/letter/c/5f8ce5/32.png) [@c.pahl](https://mangoh.discourse.group/u/c.pahl)
#### Post date: [April 17, 2019, 12:37pm UTC](https://mangoh.discourse.group/t/unable-to-have-stable-wifi-with-mt7697-over-uart-or-spi/2560/3 "2019-04-17T12:37:27Z")

</div>

Hmm, internet is working, but it’s not very stable. I tried to download a large file (`wget -O /dev/null http://speedtest.belwue.net/10G`), but it stalled somewhere in the middle and showed a lot of those lines in `dmesg`:

```auto
[14639.729649] mt7697core mt7697core: mt7697_proc_80211cmd(): unsupported cmd(165)
[14639.737244] mt7697core RSP 00000000: a5 a5 a5 a5 a5 a5 a5 a5
[14639.737259] mt7697serial mt7697serial: mt7697_uart_rx_work(): rx_fcn() failed(-22)

```

Sometimes messages like these are interspersed:

```auto
[564.632426] mt7697core mt7697core: mt7697_proc_mac_addr(): invalid MAC address rsp len(0 != 16)
[564.640895] mt7697core mt7697core: mt7697_proc_80211cmd(): mt7697_proc_mac_addr() failed(-22)
[564.819421] mt7697core mt7697core: mt7697_proc_connect_ind(): invalid connect ind len(14926 != 24)
[564.828610] mt7697core mt7697core: mt7697_proc_80211cmd(): mt7697_proc_connect_ind() failed(-22)
[565.809880] mt7697serial mt7697serial: mt7697_uart_rx_work(): Rx invalid message type(85)

```

Note that it did not seem to stall completely, but got slower the longer it ran and the more messages it produced. Letting it run without load seems to not trigger the behavior. Maybe it just takes longer. It still have the serial cable attached, if that’s important.

Any idea? Is the `mt7697wifi` a good choice when requiring a stable connection? Any experience on this?

**EDIT:** The same issue happens when using SPI ([as per this thread](https://mangoh.discourse.group/t/mediatek-wifi-on-spi-solved/2568))

```auto
[613.337877] mt7697core mt7697core: mt7697_rx_data(): invalid Rx frame size(18)
[613.337913] mt7697core mt7697core: mt7697_rx_raw(): mt7697_rx_data() failed(-22)
[613.345103] mt7697core mt7697core: mt7697_proc_80211cmd(): mt7697_rx_raw() failed(-22)

```

---

<div class="post-metadata">

### Author: ![stevewilliam007](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@stevewilliam007](https://mangoh.discourse.group/u/stevewilliam007)
#### Post date: [May 4, 2019, 1:40pm UTC](https://mangoh.discourse.group/t/unable-to-have-stable-wifi-with-mt7697-over-uart-or-spi/2560/4 "2019-05-04T13:40:06Z")

</div>

With the stable wifi, I cannot [install itunes on windows 7](https://itunessupport.org/blog/cannot-install-itunes-on-windows-7/) and that is really a mess. I have tried a lot but still, the internet is not working on that application. Please help me to fix the problem.

---

<div class="post-metadata">

### Author: ![Thong](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/thong/32/1017_2.png) [@Thong](https://mangoh.discourse.group/u/Thong)
#### Post date: [May 7, 2019, 3:07pm UTC](https://mangoh.discourse.group/t/unable-to-have-stable-wifi-with-mt7697-over-uart-or-spi/2560/6 "2019-05-07T15:07:21Z")

</div>

Hi c.Pahl

I don’t have experience with on board Wifi. I’m using Wifi IoT card and it work well.

Thanks  
Thong Nguyen
