Uses TI module instead of MT7697

Hey I am trying to run my mangoh as a gateway following this tutorial:

  • I successfully updated the flash for the mt7697 as described.

  • I could not applied patches as they are not available for the current Legato version

  • I modified red.sdef to add the 3 samples app (wifiApTest, wifiWebAp, wifiClientTest)

  • Added the shell script mtwifi in /etc/init.d/

  • Modified my network interfaces

  • Connected UART1 to the wifi module (at!mapuart=17,1)
    The interface is visible when i do ifconfig -a:

    wlan1 Link encap:Ethernet HWaddr 00:0C:43:76:87:22
    inet6 addr: fe80::20c:43ff:fe76:8722/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
    TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:0 (0.0 B) TX bytes:648 (648.0 B)

network interface

/etc/network/interfaces – configuration file for ifup(8), ifdown(8)

The loopback interface

auto lo
iface lo inet loopback

Wired or wireless interfaces

auto eth0
iface eth0 inet dhcp

Wireless interfaces

iface wlan1 inet manual
pre-up /etc/init.d/mtwifi start uart 1
post-down /etc/init.d/mtwifi stop 1

However whenever I try to launch wifi, i get
Failed to start TI wifi, interface does not exist.
It looks like the mangOH look for this card that I don’t want to use.

Do you know a way to avoid this ?
Thanks !

My config:
VScode extension
MangOH RED - Release 13 - Legato 19.11.2

you can see this document:

Thanks for this document.

I am working with the module WP77xx, so I can not use the .update present in this document.

What should I update ?

You need to build it by yourself

I am working with VSCode, I do not see where to apply patches
Can you help me with that ?

No, you cannot use vscode to do that

Ok thanks, I will try that.
Is it impossible to run this with Release 13 on WP77xx ?

I installed the Legato AF following this: https://docs.legato.io/latest/basicBuildLegato.html
And with the tar files of the 18.03.0 version I did succeed to run make to compile this version.

Then after cloning Legato_patches an trying to apply the patch at my legatoAF, I get:

./apply_legato_patches.sh ~/legato_workspace/legato-18.03.0 18.03.0
fatal: not a git repository (or any of the parent directories): .git
“18.03.0” doesn’t appear to be a valid release tag

I’m stuck, can you help with that ?

It would help me a lot if you could give me the right .update file !

Didn’t there is 18.3.0?

Ok to make it works I had to use apply_legato_patches_untracked.sh as it seems they are some errors with the git tracking.

Now as I try to compile the mangOH source code I have path issue with:
#include “${LEGATO_ROOT}/modules/WiFi/wifi.sinc”

This directory does not exist in the legato version. I removed this link and add a full path to a similar one.

First question, do I have to change the mangOH source code version ? As it is not compatible with the old release ? (18.03.0 or 19.01.0)

Where can you download the old mangoh source?

Ok for the record here is how I did:

Follow https://github.com/mangOH/mangOH/wiki/mangOH-Red-mt7697-WiFi until the section Patch Legato

  • Install the .spk from here Release11_WP77xx
  • Create a leaf profile with swi-wp77_2.3.0 SDK
  • Clone Legato patches from https://github.com/mangOH/Legato_patches
  • Apply patches to my LegatoAF:
    ./apply_legato_patches_untracked.sh $LEGATO_ROOT/leaf-data/$PROFILE_NAME/wp77-legato 19.01.0
  • Clone the mangOH source code
  • Change the branch to v0.5.0 as the v0.6.0 include the wifi definition files from the LegatoAF (and they are not present here)
  • Uncomment line 15 of wifi.sdef
wifi.sdef

//--------------------------------------------------------------------------------------------------
// Sample system definition that includes essential services and WiFi-related services and sample
// applications.
//
// Copyright © Sierra Wireless Inc.
//--------------------------------------------------------------------------------------------------

#include “${LEGATO_ROOT}/default.sdef”

buildVars:
{
LEGATO_WIFI_ROOT={LEGATO_ROOT}/modules/WiFi // File is selected by users, replace "ti" with "qca" to support qca chipset // For mangOH we select the PA script in the board file - i.e. red/yellow ... LEGATO_WIFI_PA={LEGATO_WIFI_ROOT}/service/platformAdaptor/ti/pa_wifi.sh
}

apps:
{
// WiFi services
$LEGATO_WIFI_ROOT/service/wifiService.adef { start: manual }
$LEGATO_WIFI_ROOT/apps/tools/wifi/wifi.adef
}

commands:
{
wifi = wifi:/bin/wifi
}

  • Go to leaf-data/wp77_wifi/wp77-legato/modules/WiFi/service/daemon/Component.cdefand correct the sources link copy this:
Component.cdef

provides:
{
api:
{
{LEGATO_ROOT}/interfaces/wifi/le_wifiClient.api {LEGATO_ROOT}/interfaces/wifi/le_wifiAp.api
}
}

sources:
{
wifiService.c
le_wifiClient.c
le_wifiAp.c
//Put hardlink here

 ${LEGATO_WIFI_ROOT}/service/platformAdaptor/ti/pa_wifi_client_ti.c
 ${LEGATO_WIFI_ROOT}/service/platformAdaptor/ti/pa_wifi_ap_ti.c

}

cflags:
{
-I${LEGATO_WIFI_ROOT}/service/platformAdaptor/inc/
}

bundles:
{
file:
{
// Script file implementing Wifi PA
${LEGATO_WIFI_ROOT}/service/platformAdaptor/ti/pa_wifi.sh pa_wifi.sh
}
}

Now it is possible to compile the mangOH source successfully and update it to red_wp77xx.

Then I followed the indication in the document How to test MTK wifi chipset on MangOH Red board (added mtwifi in /etc/init.d/ and chmod +x it, modifying interfaces to look like below, and setup the UART protocol as indicated).

interfaces

/etc/network/interfaces – configuration file for ifup(8), ifdown(8)

The loopback interface

auto lo
iface lo inet loopback

Wired or wireless interfaces

auto eth0
iface eth0 inet dhcp

Wireless interfaces

iface wlan1 inet manual
pre-up /etc/init.d/mtwifi start uart 1
post-down /etc/init.d/mtwifi stop 1

Typing the commands below allows me start successfully the wifi uC and to observe wifi AP SSID on my mobile phone.

Commands

wifi ap setssid “SIERRAWIFI123”

wifi ap setdriver 1

wifi ap setmaxclients 1

wifi ap setsecurityproto 1

wifi ap setpassphrase “knockknock”

wifi ap setdiscoverable 1

wifi ap start wlan1

I then added the wifiWebAp app to my module, starts it, everything run but I now can’t see the SSID with my mobile phone, I got those errors:

Logs

Capture d’écran de 2020-12-15 12-50-14

Any ideas why I can’t connect ?

Did you see wlan0?

Did you power cycle after these commands?

wifi ap setssid “SIERRAWIFI123”

wifi ap setdriver 1

wifi ap setmaxclients 1

wifi ap setsecurityproto 1

wifi ap setpassphrase “knockknock”

wifi ap setdiscoverable 1

wifi ap start wlan1

No I can’t see wlan0 after launching the app

ifup wlan0 (using mtwifi script) show then wlan1 in ifconfig -a

logs
root@swi-mdm9x28-wp:~# app status
[running] atAirVantage
[running] atQmiLinker
[running] atService
[running] audioService
[running] avcService
[running] battery
[running] cellNetService
[running] dataConnectionService
[running] dataHub
[running] fwupdateService
[running] gpioService
[running] ledService
[running] modemService
[running] portService
[running] positioningService
[running] powerMgr
[running] qmiAirVantage
[stopped] redCloud
[running] redSensor
[running] secStore
[stopped] smsInboxService
[stopped] spiService
[stopped] tools
[stopped] voiceCallService
[stopped] wifi
[running] wifiService
[running] wifiWebAp
root@swi-mdm9x28-wp:~# ifconfig -a
bridge0   Link encap:Ethernet  HWaddr 0A:15:37:78:90:87  
          inet addr:192.168.225.1  Bcast:192.168.225.255  Mask:255.255.255.0
          inet6 addr: fe80::815:37ff:fe75:8d84%1257381756/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  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:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

ecm0      Link encap:Ethernet  HWaddr C6:61:B8:10:27:44  
          inet addr:192.168.2.2  Bcast:192.168.2.255  Mask:255.255.255.0
          inet6 addr: fe80::c461:b8ff:fe10:2744%1257381756/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:9460 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9528 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:608980 (594.7 KiB)  TX bytes:3764644 (3.5 MiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1%1257381756/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  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:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

rmnet0    Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          UP RUNNING  MTU:2000  Metric:1
          RX packets:16 errors:0 dropped:0 overruns:0 frame:0
          TX packets:33 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2144 (2.0 KiB)  TX bytes:2327 (2.2 KiB)

rmnet_data0 Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet addr:10.142.78.112  Mask:255.255.255.224
          inet6 addr: fe80::a244:f705:e5f9:1841%1257381756/64 Scope:Link
          UP RUNNING  MTU:1500  Metric:1
          RX packets:16 errors:0 dropped:0 overruns:0 frame:0
          TX packets:33 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2016 (1.9 KiB)  TX bytes:2327 (2.2 KiB)

rmnet_data1 Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          [NO FLAGS]  MTU:1500  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:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

rmnet_data2 Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          [NO FLAGS]  MTU:1500  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:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

rmnet_data3 Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          [NO FLAGS]  MTU:1500  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:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.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:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

the error message is using wlan0 but now you don’t have this interface, probably this makes the problem.
you need to fix that part.

Did you really choose MediaTek in the webpage?

Ok thanks a lot.

No I don’t have any choice here:

Ok got it working,

My error was to use the app from: https://github.com/legatoproject/legato-WiFi/tree/19.01-release
Which is not up to date.

By taking the app directly from the legato repo I managed to have the right version. Everything is working now, thanks @jyijyi !