Wifi exp board on legato21 (R15)

we are following a topic for running the wifi talon exp board on a FX30 (wp77xx) R15 (legato21) and are having issues with the configuration.
This is the log from the device, where it seems there is an error with the i2c communication:

Nov 14 16:23:04 fx30 user.debug Legato: DBUG | wifiService[1437]/daemon T=main | pa_wifi_ap.c GenerateHostapdConf() 401 | LE_WIFIAP_SECURITY_WPA2
Nov 14 16:23:04 fx30 user.info Legato: INFO | wifiService[1437] | WIFI_START
Nov 14 16:23:05 fx30 user.debug Legato: DBUG | wifiService[1437]/daemon T=main | pa_wifi_ap.c pa_wifiAp_Start() 665 | WiFi hardware started correctly
Nov 14 16:23:05 fx30 user.debug Legato: DBUG | wifiService[1437]/framework T=main | thread.c SetSchedPolicyAttr() 682 | Set scheduling policy to SCHED_OTHER for thread ‘WifiApPaThread’.
Nov 14 16:23:05 fx30 user.debug Legato: DBUG | wifiService[1437]/framework T=WifiApPaThread | thread.c PThreadStartRoutine() 478 | Set nice level to 0.
Nov 14 16:23:05 fx30 user.info Legato: INFO | wifiService[1437]/daemon T=WifiApPaThread | pa_wifi_ap.c WifiApPaThreadMain() 278 | Wifi event report thread started!
Nov 14 16:23:05 fx30 user.info Legato: INFO | wifiService[1437] | WIFIAP_HOSTAPD_START
Nov 14 16:23:05 fx30 user.info Legato: INFO | wifiService[1437]/daemon T=WifiApPaThread | pa_wifi_ap.c WifiApPaThreadMain() 295 | PARSING:WIFI_SET_EVENT : len:15
Nov 14 16:23:05 fx30 user.err Legato: =ERR= | wifiService[1437] | /legato/systems/current/apps/wifiService/read-only/pa_wifi:
Nov 14 16:23:05 fx30 user.err Legato: =ERR= | wifiService[1437] | line 427:
Nov 14 16:23:05 fx30 user.err Legato: =ERR= | wifiService[1437] | /bin/hostapd: not found
Nov 14 16:23:05 fx30 user.err Legato: =ERR= | wifiService[1437] |
Nov 14 16:23:05 fx30 user.info Legato: INFO | wifiService[1437]/daemon T=WifiApPaThread | pa_wifi_ap.c WifiApPaThreadMain() 295 | PARSING: (phy #0): unknown event 8 (del_interface) : len:43
Nov 14 16:23:05 fx30 user.info Legato: INFO | wifiService[1437]/daemon T=WifiApPaThread | pa_wifi_ap.c WifiApPaThreadMain() 295 | PARSING:phy #0: delete wiphy : len:21
Nov 14 16:23:05 fx30 user.info Legato: INFO | wifiService[1437] | mangOH red board
Nov 14 16:23:05 fx30 user.err Legato: =ERR= | wifiService[1437] | sh: write error: Operation not permitted
Nov 14 16:23:05 fx30 user.err Legato: =ERR= | wifiService[1437] | ERR* failed to read i2c data
Nov 14 16:23:05 fx30 user.err Legato: =ERR= | wifiService[1437] | ERR* I2c get addr 0x3e value failure
Nov 14 16:23:05 fx30 user.err Legato: =ERR= | wifiService[1437] | ERR* Set mode 0 failure
Nov 14 16:23:05 fx30 user.err Legato: =ERR= | wifiService[1437] | ERR* failed to read i2c data
Nov 14 16:23:05 fx30 user.err Legato: =ERR= | wifiService[1437] | ERR* I2c get addr 0x3e value failure
Nov 14 16:23:05 fx30 user.err Legato: =ERR= | wifiService[1437] | ERR* Set polarity 0 failure
Nov 14 16:23:05 fx30 user.err Legato: =ERR= | wifiService[1437] | ERR* failed to read i2c data
Nov 14 16:23:05 fx30 user.err Legato: =ERR= | wifiService[1437] | ERR* I2c get addr 0x3e value failure
Nov 14 16:23:05 fx30 user.err Legato: =ERR= | wifiService[1437] | ERR* Set output 1 failure
Nov 14 16:23:05 fx30 user.err Legato: =ERR= | wifiService[1437]/daemon T=main | pa_wifi_ap.c pa_wifiAp_Start() 696 | WiFi Client Command “WIFIAP_HOSTAPD_START” Failed: (32512)

But on the hardware we have setup the UART to be assigned to the LINUX and then activated the GPIO8:
AT!MAPUART=17,2
AT+WIOCFG=8,16,1,0

The only extra thing we have noticed is that some of the module are missing now and we are not sure if this board should be run in a different way.
Any help will be very much appreciated!!!

does it work on R14?
Some user says it should be working on R14:

Yes, we just tested with r14 and it seems working, no luck with the r15 i was wondering if anyone has a clue about this issue?

Can you chech this and see if it appears in r14 but not in r15?

Nov 14 16:23:05 fx30 user.err Legato: =ERR= | wifiService[1437] | /bin/hostapd: not found

how do you check to what is mapped UART2?
AT!MAPUART? will give the mapping of UART1…?

You can see this:

Yup, so it seems that the second interface is mapped to the linux:
AT!MAPUART?
!MAPUART: 1,17

The new pa_wifi script should run the tiwifi setup script part below:

ti_wifi_start() {
lsmod | grep wlcore >/dev/null
if [ $? -ne 0 ]; then

    # This is only required for WP85, because kernel is different.
    if [ "${KVERSION}" = "314" ] ; then
        # Check if MMC/SDIO module is inserted. Because WIFI use SDIO/MMC bus
        # we need to remove the SDIO/MMC module
        lsmod | grep msm_sdcc >/dev/null
        if [ $? -eq 0 ]; then
            grep -q mmcblk /proc/mounts
            if [ $? -ne 0 ]; then
                rmmod msm_sdcc
            else
                false
            fi
            if [ $? -ne 0 ]; then
                # Unable to remove. May be others devices use SDIO/MMC bus
                echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
                echo "Unable to remove the SDIO/MMC module... May be in use ?"
                echo "Please, free all SDIO/MMC devices before using TI WIFI."
                echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
                exit 127
            fi
        fi
    fi

    # Enable all GPIOs on all EXPANDERs
    gpioexp 1 1 enable >/dev/null || exit 127

    ### mangOH green has 3 expanders
    # Set IOTO_RESET, GPIO#4/EXPANDER#3 - IOT0 Reset signal is disabled
    gpioexp 3 4 output normal high >/dev/null 2>&1
    if [ $? -ne 0 ]; then
        echo "mangOH red board"

        # Set IOT0_GPIO2 = 1 (WP GPIO13)
        [ -d ${GPIO_DIR}13 ] || echo 13 >${GPIO_EXPORT}
        echo out >${GPIO_DIR}13/direction
        echo 1 >${GPIO_DIR}13/value

        # Set IOT0_RESET = 1 (WP GPIO2)
        [ -d ${GPIO_DIR}2 ] || echo 2 >${GPIO_EXPORT}
        echo out >${GPIO_DIR}2/direction
        echo 1 >${GPIO_DIR}2/value

        # Clear SDIO_SEL, GPIO#9/EXPANDER#1 - Select the SDIO
        gpioexp 1 9 output normal low >/dev/null || exit 127
    else
        echo "mangOH green board"

        # Set IOT0_GPIO2 = 1 (WP GPIO33)
        [ -d ${GPIO_DIR}33 ] || echo 33 >${GPIO_EXPORT}
        echo out >${GPIO_DIR}33/direction
        echo 1 >${GPIO_DIR}33/value

        # Clear SDIO_SEL, GPIO#13/EXPANDER#1 - Select the SDIO
        gpioexp 1 13 output normal low >/dev/null || exit 127
    fi

    # Kernel 3.14 only.
    if [ "${KVERSION}" = "314" ] ; then
        modprobe msm_sdcc || exit 127
    fi

    modprobe wlcore || exit 127
    modprobe wlcore_sdio || exit 127
    modprobe wl18xx || exit 127
fi
attempt=6
for i in $(seq 1 ${attempt})
do
    if [ $i -ne 1 ]; then
        sleep 1
    fi
    (ifconfig -a | grep wlan0 > /dev/null) && break
done
if [ $? -ne 0 ]; then
    echo "Failed to start TI wifi, interface does not exist."
    exit ${TI_WIFI_PA_NO_IF_ERR}
fi
ifconfig wlan0 up > /dev/null
if [ $? -ne 0 ] ; then
    echo "Failed to start TI wifi, interface can not be brought up."
    exit ${TI_WIFI_PA_NO_IF_UP_ERR}
fi

}

but even when I try to run the command manually it seems that the error with the i2c communication still persist…

wifiService[1438] | WIFI_START
wifiService[1438] | ERR* failed to write i2c data
wifiService[1438] | FTL Failed to enable PCA9548A I2C switch*
wifiService[1438] | Clean up due to unknown error

As it fails for i2c communication, while on the previous legato version it seemed this was using the UART2 communication, I am wondering if we have to change the way the communication with the IoT exp board works?
Understand this is not something fully supported by SWI, possibly someone experienced with the talon IoT wifi could reply? We are looking at implementing this on several devices and would like to have an understanding of why this is no longer working with the new legato version…

it failed on “gpioexp 1 1 enable”, seems not UART2 issue.

how can you say it fails in that command? we assume it should not cause an i2c communication error if it is only trying to enable the gpioexp…?

what did you see in console if you type that command?

thank you for that, you were correct, this is what happens:

root@fx30:~# gpioexp 1 1 enable
expander#:1 gpio pin:1, i2cAddr:0x3e
module 1, pin 1 i2cAddr 62 bus 4 bank 1
Open I2C Bus at, ‘/dev/i2c/4’
Try open I2C Bus at, ‘/dev/i2c-4’
Enabling PCA9548A I2C switch…
Open I2C Bus at, ‘/dev/i2c/4’
Try open I2C Bus at, ‘/dev/i2c-4’
ERR* failed to write i2c data
FTL* Failed to enable PCA9548A I2C switch

What is the meaning of this? We didn`t have this problem with the previous version of legato (19).

i think this is not related to legato, but i guess there is change of yocto imge in R15 which makes this problem

I wonder if you can modify the tiwifi so that it will skip this line

I can try to, do you have any reference and documentation about this gpioexp command?
We can try to rebuild from linux source to see if this solves the problem…

I am not sure if FX30 is really using this gpio expander in hardware…
this gpioexp seems is for mangoh board.

Anyway, source code of gpioexp is in here:
./build_bin/tmp/work/armv7a-neon-poky-linux-gnueabi/sierra-init-tiwifi/1.0-r0/gpioexp.c

I suggest you modify tiwifi to see if it works first

yup, it actually worked.
Will have a look to see if this can be handled from the legato part itself but I think we will need to re-build the linux image to solve the problem…

how is your modification now in tiwifi to make it work in R15?
Just comment out this line?

gpioexp 1 1 enable >/dev/null || exit 127

Why do you need to modify legato image?
Didn’t you only need to modify tiwifi?

in order to get it up an running on a new device I need to modify the linux image.
but have tested a bit more this and it actually doesn’t work…
even when we comment the exit error, it will get stuck on deploying the kernel modules.
It would be nice to hear from anyone using the same IoT exp board as I guess this will be the same issue for everybody, or anyone can advise any alternative IoT wifi board?
we don`t really care and the talon one seems completely without any sort of support

it gets stuck on the call
modprobe wlcore_sdio || exit 127
it doesn’t return error or anything but it doesn’t proceed either…

For FX30 (WP7702 inside), I remember i need to do the following first in R14:

cat /proc/kmsg &
modprobe wlcore_sdio.ko
modprobe wlcore.ko
modprobe wl18xx.ko
echo 33 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio33/direction
echo 1 > /sys/class/gpio/gpio33/value
echo 8 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio8/direction
echo 1 > /sys/class/gpio/gpio8/value
wifi client start