Does the Colibri IMX8X support WIFI direct?

I am trying to setup WIFI direct on the Colibri IMX8QXP 2GB WB IT. I want to be able to connect the system to the internet via a gateway at the same time so I have set “driver_param=use_multi_chan_concurrent=1 use_p2p_group_interface=1” in the wpa_supplicant configuration file.

However when I run “p2p_group_add” in the wpa_cli I get an error “Failed to create interface p2p-wlp1s0-4: -22 (Invalid argument)”. In the kernel log I get a message from the mwifiex_pcie driver “type not supported”. I tracked this error message down in cfg80211.c function “mwifiex_add_virtual_intf”. And the error message seems correct, the driver does not handle “NL80211_IFTYPE_P2P_GO”.

Am I correct in interpreting this as the WIFI hardware simply not supporting what I want to do? Or am I missing something? Perhaps another driver? I have not previously worked with WIFI direct so this is all new to me.

I looked thru the datasheet for the “AW-CM276NF” and can see no mention of WIFI direct or P2P so that reinforces my suspicion that the hardware does not support this.

Hello @MikaelE , welcome to the community :slight_smile:

Yes, the HW supports WiFi direct, but it is not enabled by default. To do so run :
echo "options mwifiex driver_mode=7" > /etc/modprobe.d/mwifiex.conf

That will enable the Wifi direct.

Then reboot the SoM, and when you run ifconfig a new interface named p2p0 should appear

root@colibri-imx8x-06760713:~# ifconfig
eth0: flags=-28669<UP,BROADCAST,MULTICAST,DYNAMIC>  mtu 1500
        ether 00:14:2d:67:29:09  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 92  bytes 7886 (7.7 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 92  bytes 7886 (7.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

mlan0: flags=-28669<UP,BROADCAST,MULTICAST,DYNAMIC>  mtu 1500
        ether c0:e4:34:2f:eb:9d  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

p2p0: flags=-28669<UP,BROADCAST,MULTICAST,DYNAMIC>  mtu 1500
        ether c2:e4:34:2f:ea:9d  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

uap0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether c0:e4:34:2f:e9:9d  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

usb0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 36:9d:36:7f:66:b2  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Best regards,
Josep

Thanks @josep.tx. I got those extra devices now. Does not seem to add new devices when I run p2p_group_add like my computer does though. But I can look into that myself first.

Hello @MikaelE ,

Can you describe the procedure that you are following so we can try to reproduce the issue?
Also, do you have any relevant logs that you can share with us about this issue?

Best regards,
Josep

On my own computer when I call “p2p_group_add” in the wpa_cli a new interface “p2p-wlp2s0-0” is created. This is just to show what I mean. I intend to use p2p_find and p2p_connect when I have the Toradex card setup as group owner.

root@fodo-Lenovo-YOGA-720-15IKB:/etc/wpa_supplicant# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: wlp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 44:03:2c:be:ec:77 brd ff:ff:ff:ff:ff:ff
    inet 10.105.114.172/24 brd 10.105.114.255 scope global dynamic noprefixroute wlp2s0
       valid_lft 86366sec preferred_lft 86366sec
    inet6 fe80::b112:6e2:51a8:9257/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
3: p2p-wlp2s0-0: <BROADCAST,MULTICAST> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 44:03:2c:be:ec:79 brd ff:ff:ff:ff:ff:ff

When I do the same on the Toradex system I get no new interface:

$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: end0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq qlen 1000
    link/ether 00:14:2d:6f:d5:7e brd ff:ff:ff:ff:ff:ff
    inet 192.168.10.2/24 brd 192.168.10.255 scope global dynamic end0
       valid_lft 81279sec preferred_lft 81279sec
    inet6 fe80::214:2dff:fe6f:d57e/64 scope link 
       valid_lft forever preferred_lft forever
3: can0: <NOARP40000> mtu 16 qdisc noop qlen 10
    link/[280] 
4: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
    link/ether 38:d5:47:0b:04:fb brd ff:ff:ff:ff:ff:ff
5: wlp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq qlen 1000
    link/ether ea:fb:1c:aa:a5:d7 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::e8fb:1cff:feaa:a5d7/64 scope link 
       valid_lft forever preferred_lft forever
6: uap0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
    link/ether e8:fb:1c:aa:a7:d7 brd ff:ff:ff:ff:ff:ff
7: p2p0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
    link/ether ea:fb:1c:aa:a5:d7 brd ff:ff:ff:ff:ff:ff

I have been following this text https://www.ti.com/lit/ug/swru576/swru576.pdf?ts=1702289219555#P2P_commands on page 13 to setup a group owner on the toradex and my own computer as a client.

However since the Toradex module is not creating a new interface I cannot follow the instructions to ifconfig an IP number on the interface. I cannot follow step 7 either where they switch over to the new interface since it does not exist.

I have tried setting the ip number on both the “p2p0” and “wlp1s0” interface but that does not seem to work.

This is my wpa_supplicant configuration:

ctrl_interface=/var/run/wpa_supplicant
update_config=1
device_name=mint
device_type=2-0050F204-1
p2p_disabled=0
p2p_listen_reg_class=81
p2p_listen_channel=1
p2p_oper_reg_class=81
p2p_oper_channel=1
p2p_go_intent=1
p2p_no_group_iface=1
config_methods=virtual_push_button

/Regards
Mikael

Hello @MikaelE ,
I can try to reproduce your issue with the information that you gave me.

Meanwhile another alternative could be to use the proprietary driver from NXP.
, according to 3.6 Configure and test Wi-Fi direct in UM11490.pdf it should support it.
https://www.nxp.com/webapp/Download?colCode=UM11490

Best regards,
Josep

Hi @josep.tx,
I’m trying to follow these instructions to install the proprietary drivers:

But I cannot find the files mention at Sign in to NXP.com | NXP Semiconductors. In my case “PCIE-WLAN-USB-BT-8997-U16-X86-W16.88.10.p70-16.26.10.p70-C4X16672_V4-GPL.zip”. I used “88w8997” as the search term. Does somebody have to grant me access for me to see the files at NXP?

/Regards
Mikael

Hello @MikaelE ,
We can provide the files under an NDA. I have asked internally.

Best regards,
Josep

Hi @josep.tx,
Ok. So how do we proceed? Should I contact somebody?

/Regards
Mikael

Hello @MikaelE ,
I have already started the process, you don’t need to contact anyone. Our Technical Sales Engineer will contact you.

Best regards,
Josep

Hello @MikaelE ,
I am trying to reproduce the issue that you had, but when I try to start wpa_supplicant with the config file that you provided it gives the following error:

root@colibri-imx8x-06760713:~# wpa_supplicant -ip2p0 -Dnl80211 -c /etc/wpa_supplicant.conf &
[3] 811
[2]   Killed                  wpa_supplicant -ip2p0 -Dnl80211 -c /etc/wpa_supplicant.conf
root@colibri-imx8x-06760713:~# Successfully initialized wpa_supplicant
Line 4: unknown global field 'p2p_disabled=0'.
Line 4: Invalid configuration line 'p2p_disabled=0'.
Line 5: unknown global field 'p2p_listen_reg_class=81'.
Line 5: Invalid configuration line 'p2p_listen_reg_class=81'.
Line 6: unknown global field 'p2p_listen_channel=1'.
Line 6: Invalid configuration line 'p2p_listen_channel=1'.
Line 7: unknown global field 'p2p_oper_reg_class=81'.
Line 7: Invalid configuration line 'p2p_oper_reg_class=81'.
Line 8: unknown global field 'p2p_oper_channel=1'.
Line 8: Invalid configuration line 'p2p_oper_channel=1'.
Line 9: unknown global field 'p2p_go_intent=1'.
Line 9: Invalid configuration line 'p2p_go_intent=1'.
Line 10: unknown global field 'p2p_no_group_iface=1'.
Line 10: Invalid configuration line 'p2p_no_group_iface=1'.
Failed to read or parse configuration '/etc/wpa_supplicant.conf'.
: CTRL-EVENT-DSCP-POLICY clear_all

Are you using a custom build? Or one of our reference images?

Best regards,
Josep

Hi @josep.tx,
I sent Diana a signed copy of the NDA. So I hope you can grant me access to the proprietary driver soon.

Yes I am using Buildroot 2023.02.8. Wpa_supplicant version 2.10. And kernel 5.15.129(your downstream one).

I have actually got Wifi direct to work with a USB adapter. I can connect to the Toradex card with my cellphone and it works exactly as I wanted it to. This is the wpa supplicant configuration:

update_config=1
device_name=Log Mate
device_type=2-0050F204-1
config_methods="push_button"
persistent_reconnect=1

When I use the same configuration with the builtin Wifi it does not work. Even though I am doing the exact same thing. So I am very curious if the proprietary driver will work better.

/Regards
Mikael

Hello @MikaelE ,
I sent you the proprietary drivers via email. Please let me know when you receive them.

Best regards,
Josep

Hi @josep.tx,
I’m trying to build the driver but it does not seem to be compatible with your kernel “linux-toradex_5.15-2.2.x-imx”. Some linux headers seems to be incompatible. In the README it says that is only compatible up to linux 5.5.2.

Is this the newest driver you have? If not which kernel do you recommend that I compile this driver against on an iMX8X?

/Regards
Mikael

Hello @MikaelE ,
We have tested the driver on both the oe_dunfell-5.x.y branch and the 5.3.0 tag of the Toradex BSP repo manifest using full Yocto builds with the following branch settings:

  • Toradex BSP Version 5.3.x and meta-toradex-wifi branch 5.3.0-branch
  • Toradex BSP Version 5.x.y or 5.4.x and meta-toradex-wifi branch 5.4.0-devel-branch

Best regards,
Josep

Hi @josep.tx ,
I managed to get the driver to build,install and run. But I cannot get it to run as a P2P group owner.
When running “iw phy” it should report “P2P-GO” as a “Supported interface mode”. But it does not.

I have tried setting the module parameters according to the UM11490 document you provided. “p2p_enh=1” seems to be an important parameter that I have made sure to set for example. cal_data_cfg=nxp/cal_data.conf cfg80211_wext=12 have also been set so that the configuration should be the same as in your yocto overlay.

I tried installing your Toradex Yocto image but that seems to have the open source driver.

Not quite sure where to go from here.

If I describe how I get it to work with an external adapter. Can you try to get it to work on your end with the Wi-Fi chip on the module?

This is what I do with my USB adapter. The model is Asus USB-N53_B1 with a MT7612U chipset.

I start the wpa_supplicant like this:

wpa_supplicant -c /etc/wpa_supplicant/wpa_supplicant-wlan0.conf -i wlan0

I then start wpa_cli:

wpa_cli -i wlan0

and then start the group owner:

p2p_group_add

A new network interface now appears if you run ifconfig. I set an IP number on this new interface and start a dhcpd server on it:

ifconfig p2p-wlan0-0 192.168.42.1
udhcpd /etc/udhcpd/udhcpd-p2p-wlan0-0.conf

I connect wpa_cli to this new interface:

wpa_cli -i p2p-wlan0-0

On my Pixel 7 I go to settings->Network and Internet->Internet->Network settings->Wi-Fi Direct.
Then select “Log Mate”.
In the wpa_cli i now start WPS push button mode:

wps_pbc

On my phone the status for “Log Mate” now goes from “Invite” to “Connected”.

/Regards
Mikael

wpa_supplicant-wlan0.conf (161 Bytes)
udhcpd-p2p-wlan0-0.conf (271 Bytes)

Hello @MikaelE ,
One of our colleagues ( @rafael.tx ) did some deeper investigations:

The first thing I’m trying to do is to make P2P work using mwifiex. It seems that our wpa-supplicant configuration file doesn’t enable everything that’s necessary to get full P2P functionality. I’m rebuilding wpa-supplicant, and I added CONFIG_P2P=y to the defconfig file, following this:
wpa_supplicant/README-P2P - platform/external/wpa_supplicant_8 - Git at Google

CONFIG_DRIVER_NL80211=y CONFIG_CTRL_IFACE=y CONFIG_P2P=y CONFIG_AP=y CONFIG_WPS=y

To be able to follow the customer’s instructions, I had to slightly change their wpa_supplicant configuration, adding the ctrl_interface directive:

update_config=1 device_name=Log Mate device_type=2-0050F204-1 config_methods="push_button" persistent_reconnect=1 ctrl_interface=/tmp/wpa_supplicant

After starting wpa_supplicant with:

wpa_supplicant -c test_wpa_p2p.conf -i p2p0

Where test_wpa_p2p.conf is the file mentioned above, I could start the client and connect to it with:

wpa_cli -p /tmp/wpa_supplicant/ -i p2p0

On the cli, then trying to add the GO (group owner), I got the following error:

`wpa_cli v2.10
Copyright (c) 2004-2022, Jouni Malinen j@w1.fi and contributors

This software may be distributed under the terms of the BSD license.
See README for more details.

Interactive mode

p2p_group_add
FAIL
<5>P2P: Failed to add group interface`

And on the wpa_supplicant side:

[ 3563.561496] mwifiex_pcie 0000:01:00.0: type not supported Failed to create interface p2p-p2p0-0: -22 (Invalid argument) P2P: Failed to create new group interface P2P: Failed to add group interface

Looking up this message on the mwifiex driver, we get to:

drivers/net/wireless/marvell/mwifiex/cfg80211.c 2887 struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy, ... 3003 default: 3004 mwifiex_dbg(adapter, ERROR, "type not supported\n"); 3005 return ERR_PTR(-EINVAL); 3006 }T

This is part of a switch command over the type of the virtual interface being created.
The code doesn’t contain a case for either NL80211_IFTYPE_P2P_GO or NL80211_IFTYPE_P2P_DEVICE , the only supported P2P option is NL80211_IFTYPE_P2P_CLIENT.
This is a really strong indication that the feature the customer wants to use is not available on the mwifiex driver.

Regarding the proprietary driver,

Looking through the code of the proprietary driver, it also only lists the NL80211_IFTYPE_P2P_CLIENT .
This doesn’t directly mean that the proprietary driver doesn’t support P2P-GO, but it almost certainly means it doesn’t support its use with wpa_supplicant .

Best regards,
Josep

Hi @MikaelE !

Were you able to go through the previous message here?

Do you have any news on your side?

Since seems like Wi-Fi Direct is not available on mwifiex driver, do you have other options?

Best regards,