WiFi Example

# ifconfig wlan0 down
# iwconfig wlan0 channel auto
Error for wireless request "Set Frequency" (8B04) :
    SET failed on device wlan0 ; Operation not supported.

Remark: The down command switches the led off, the up command switches the led on.

wlan0     Link encap:Ethernet  HWaddr 64:EE:B7:16:1D:62
          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:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

Please give me a hint how to do this.

Can you try, after ran the script and timeout

  • iwconfig wlan0

and tell me what you see then

# iwconfig wlan0
wlan0     no wireless extensions.

reset the board, run the scripts:

  • init_wifi.sh [notssid] [notpassword]
  • iwlist wlan0 scan

notssid: any text, we don’t want it connects to an exist SSID, you can put abcdef…
notpassword: any text: 1234abcdef

tell us what you see.

Saving WiFi config...
Startig WiFi...
ln: /dev/rfkill: File exists
ifconfig: SIOCSIFFLAGS: No such device
Successfully initialized wpa_supplicant
Could not read interface wlan0 flags: No such device
nl80211: Driver does not support authentication/association or connect commands
nl80211: deinit ifname=wlan0 disabled_11b_rates=0
Could not read interface wlan0 flags: No such device
wlan0: Failed to initialize driver interface
wlan0: CTRL-EVENT-DSCP-POLICY clear_all
dhcpcd-9.4.1 starting
wlan0: interface not found
control_free: No such file or directory
# iwlist wlan0 scan
wlan0     Interface doesn't support scanning.

Then it is not related to your router.

somehow the image on SDcard is corrupted. Do you have another SDCard to try?

Ah ok, thank you, then I will try with a new SD card tomorrow, and give you feedback after.

Do you have an usb hub with external power supply? If you have then try to use WiFi through that hub.

  • Format your SD drive with the new image
  • Upload firmware and DotNet as provided
  • Create a console app in VS with provided code
// See https://aka.ms/new-console-template for more information
using System.Net.NetworkInformation;

Console.WriteLine("Hello, World!");
var interfaces = NetworkInterface.GetAllNetworkInterfaces();
foreach (var item in interfaces)
{
    Console.WriteLine($"{item.Name} - {item.NetworkInterfaceType}");
}

This should output

Loaded '/root/.epnet/.dotnet/shared/Microsoft.NETCore.App/8.0.0/Microsoft.Win32.Primitives.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Hello, World!
Loaded '/root/.epnet/.dotnet/shared/Microsoft.NETCore.App/8.0.0/System.Net.Primitives.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/root/.epnet/.dotnet/shared/Microsoft.NETCore.App/8.0.0/System.Collections.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/root/.epnet/.dotnet/shared/Microsoft.NETCore.App/8.0.0/System.Memory.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/root/.epnet/.dotnet/shared/Microsoft.NETCore.App/8.0.0/System.Runtime.Intrinsics.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
lo - Loopback
can0 - Unknown
can1 - Unknown
eth0 - Ethernet
usb0 - Ethernet
The program 'dotnet' has exited with code 0 (0x0).
  • Plug your adapter in then run this code
    NOTE: You will need to add the GHIElectronics.Endpoint.Devices.Network nuget package to your application.
// See https://aka.ms/new-console-template for more information
using GHIElectronics.Endpoint.Devices.Network;
using Iot.Device.Mcp25xxx.Register;
using System.Net;
using System.Net.NetworkInformation;
using NetworkInterfaceType = GHIElectronics.Endpoint.Devices.Network.NetworkInterfaceType;

Console.WriteLine("Hello, World!");
var interfaces = NetworkInterface.GetAllNetworkInterfaces();

var networkType = NetworkInterfaceType.WiFi;
var networkSetting = new WiFiNetworkInterfaceSettings
{
    Ssid = "Your Wifi SSID",
    Password = "Password",
    DhcpEnable = true,
};

var _networkController = new NetworkController(networkType, networkSetting);
_networkController.NetworkAddressChanged += (NetworkController sender, NetworkAddressChangedEventArgs e) =>
{
    Console.WriteLine(string.Format("Address: {0}\nGateway: {1}\nDNS: {2}\nMAC: {3} ", e.Address, e.Gateway, e.Dns[0], e.MACAddress));
};

_networkController.NetworkLinkConnectedChanged += (NetworkController sender, NetworkLinkConnectedChangedEventArgs e) =>
{
    foreach (var item in interfaces)
    {
        Console.WriteLine($"{item.Name} - {item.NetworkInterfaceType}");
    }
};
_networkController.Enable();

foreach (var item in interfaces)
{
    Console.WriteLine($"{item.Name} - {item.NetworkInterfaceType}");
}

Thread.Sleep(-1);

Wow, that’s more than just a hint @kirklynk - I really appreciate your help.

Starting with a new SD card, the first program shows exactly the same output.

In contrast, the second program shows a random behavior. In the majority of my runs it prints “Hello World!” and some additional .net logs, waits for 32 seconds, then prints

lo - Loopback
can0 - Unknown
can1 - Unknown
eth0 - Ethernet
usb0 - Ethernet
wlan0 - Ethernet

waits for some more seconds and prints one more .net log message.

But sometimes the program takes 64 seconds to print the second part, and there are also runs where the program does not print the second part at all. The additional 30 seconds in these cases are caused by the network controller instantiation call.

In all cases I waited for at least 10 minutes, but no more log messages appeared.

The log comes solely from the loop located in code after the “Enable” call.

These are my observations so far. I tried to power off/on the board, also tried to press the reset button, hot plugging the usb wifi dongle, and cold-plugging the usb wifi dongle.

For my money, this could be the root of the problem. Please do try with a powered hub. This is the sort of behavior I saw when the device was not getting enough power.

I experienced similar issues when powered directly from a usb port on a PC/laptop.

Back from my shopping tour - btw. it’s hard to find a powered USB-A hub nowadays - but unfortunately it makes no difference. For a brief moment I had hope…

Plug the tp-Link TL-WN725N adapter into your board
Upload this version of the provided code, ensuring Wi-Fi Ssid and password is correct.

// See https://aka.ms/new-console-template for more information
using GHIElectronics.Endpoint.Devices.Network;
using Iot.Device.Mcp25xxx.Register;
using System.Net;
using System.Net.NetworkInformation;
using NetworkInterfaceType = GHIElectronics.Endpoint.Devices.Network.NetworkInterfaceType;

try{
Console.WriteLine("Hello, World!");
var interfaces = NetworkInterface.GetAllNetworkInterfaces();

var networkType = NetworkInterfaceType.WiFi;
var networkSetting = new WiFiNetworkInterfaceSettings
{
    Ssid = "Your Wifi SSID",
    Password = "Password",
    DhcpEnable = true,
};

var _networkController = new NetworkController(networkType, networkSetting);
_networkController.NetworkAddressChanged += (NetworkController sender, NetworkAddressChangedEventArgs e) =>
{
    Console.WriteLine(string.Format("Address: {0}\nGateway: {1}\nDNS: {2}\nMAC: {3} ", e.Address, e.Gateway, e.Dns[0], e.MACAddress));
};

_networkController.NetworkLinkConnectedChanged += (NetworkController sender, NetworkLinkConnectedChangedEventArgs e) =>
{
    foreach (var item in interfaces)
    {
        Console.WriteLine($"{item.Name} - {item.NetworkInterfaceType}");
    }
};
_networkController.Enable();
}catch(Exception ex){
 Console.WriteLine(ex.Message);
}
Thread.Sleep(-1);

Any errors thrown?
You can also disconnect VS and use the Endpoint config tool to start the application. Note: My adapter light does not light up, but I can see the IP address in the console output.

Really sorry that didn’t work out. Thought we might have had it there too.

USB host work because webcam work,usb stick work as he confirmed
Same image, assuming not corrupted when burn into SD
Same Domino,
Same WiFi USB

Everybody already got WiFi work, except this case. What are we missing…?

try to use WiFi through that hub

Did you do it correctly? Is is WiFi → Hub → Domino → PC?
If you did, give another try: WiFi → Domino → Hub → PC

And don’t forget plug power to outlet, some hubs still work without connect to outlet but get worse.

1 Like

@kirklynk No error - program is in Sleep(-1)
The only output – except .net logs – is “Hello, World!”

@Dat_Tran My current config is:
PC → Endpoint using USB-C
Endpoint → Hub → WiFi dongle using USB-A

I temporarily tried - with same results:
PC → Hub → Endpoint using USB-C
Endpoint → WiFi dongle USB-A

Maybe the WiFi adapter is faulty?

I would expect a $3.50 adapter has gone through an exhaustive QA process.

I have the TP-Link TL-WN725N from Amazon.de which works without any problems. If the linux shell runs the init_wifi.sh without a WLAN adapter, the answer looks like this.

# cd /usr/sbin
# ./init_wifi.sh "MySSID" "MyPassword"
Saving WiFi config...
Startig WiFi...
ln: /dev/rfkill: File exists
ifconfig: SIOCGIFFLAGS: No such device
Successfully initialized wpa_supplicant
Could not read interface wlan0 flags: No such device
nl80211: Driver does not support authentication/association or connect commands
nl80211: deinit ifname=wlan0 disabled_11b_rates=0
Could not read interface wlan0 flags: No such device
wlan0: Failed to initialize driver interface
wlan0: CTRL-EVENT-DSCP-POLICY clear_all
dhcpcd-9.4.1 starting
DUID 00:01:00:01:00:00:03:5d:e4:fa:c4:52:b0:68
wlan0: interface not found
control_free: No such file or directory
#

It looks like yours with the Wi-Fi adapter plugged in.
With the Wi-Fi adapter plugged in


, I get an IP and it looks like this

# cd /usr/sbin
# ./init_wifi.sh "MySSID" "MyPassword"
Saving WiFi config...
Startig WiFi...
ln: /dev/rfkill: File exists
Successfully initialized wpa_supplicant
dhcpcd-9.4.1 starting
DUID 00:01:00:01:00:00:03:5d:e4:fa:c4:52:b0:68
wlan0: waiting for carrier
wlan0: carrier acquired
wlan0: connected to Access Point: WLAN-Leu
wlan0: IAID c4:52:b0:68
wlan0: adding address fe80::ee78:c997:b662:fc0a
wlan0: soliciting an IPv6 router
wlan0: rebinding lease of 192.168.0.170
wlan0: probing address 192.168.0.170/24
wlan0: Router Advertisement from fe80::1
wlan0: adding address 2003:db:bf26:ecd9:bdd4:431c:6a62:7f1a/64
wlan0: adding route to 2003:db:bf26:ecd9::/64
wlan0: requesting DHCPv6 information
wlan0: adding default route via fe80::1
wlan0: REPLY6 received from fe80::1
wlan0: refresh in 86400 seconds
forked to background, child pid 2345
# iwconfig
lo        no wireless extensions.

can0      no wireless extensions.

can1      no wireless extensions.

eth0      no wireless extensions.

usb0      no wireless extensions.

wlan0     IEEE 802.11bgn  ESSID:"WLAN-Leu"  Nickname:"<WIFI@REALTEK>"
          Mode:Managed  Frequency:2.462 GHz  Access Point: 44:D4:54:DF:73:2E
          Bit Rate:72.2 Mb/s   Sensitivity:0/0
          Retry:off   RTS thr:off   Fragment thr:off
          Encryption key:****-****-****-****-****-****-****-****   Security mode:open
          Power Management:off
          Link Quality=100/100  Signal level=27/100  Noise level=0/100
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

You should test if the Wi-Fi adapters work on the PC. If that works, only the board and SD card remain. Linux (Raspberry) is sometimes a bit picky when it comes to SD cards and there are seemingly incomprehensible errors.

I hope this helps somewhat.
Greetings from Saxony

1 Like

Many thanks to everyone who has tried to help me with their tips.

Unfortunately, since nothing has helped, I suspect that there is a fault in the board and am therefore sending it back. It was an interesting experiment, which unfortunately failed. Maybe I’ll try again with a new board, but for now I’ll take a break and devote myself to other projects.

Thanks again for the great helpfulness here in this forum.