@ willgeorge - Calling Close() then Dispose() should work fine, if it threw an exception we can take a look at that if you have an example. Regardless, Dispose calls Close internally if the interface is not already closed.
How exactly can I reset the RS9110 when a hardware-failure occurrs?
I can’t dispose it, because when I call .Dispose after provoking a failure:
#### Exception GHI.Networking.WiFiRS9110+HardwareFailureException - 0x00000000 (6) ####
#### Message:
#### GHI.Networking.WiFiRS9110::ThrowFailure [IP: 0007] ####
#### GHI.Networking.WiFiRS9110::OnClosing [IP: 000a] ####
#### GHI.Networking.BaseInterface::Dispose [IP: 0027] ####
#### GHI.Networking.BaseInterface::Dispose [IP: 0005] ####
#### MFConsoleApplication1.Program::<Main>b__0 [IP: 0007] ####
A first chance exception of type 'GHI.Networking.WiFiRS9110.HardwareFailureException' occurred in GHI.Networking.dll
And I can’t setup a new interface because of:
#### Exception System.InvalidOperationException - 0x00000000 (6) ####
#### Message: This interface type is already created.
#### GHI.Networking.BaseInterface::.ctor [IP: 0032] ####
#### GHI.Networking.WiFiRS9110::.ctor [IP: 0005] ####
#### GHI.Networking.WiFiRS9110::.ctor [IP: 000e] ####
#### MFConsoleApplication1.Program::ResetWiFiAndConnect [IP: 0022] ####
#### MFConsoleApplication1.Program::<Main>b__0 [IP: 0007] ####
A first chance exception of type 'System.InvalidOperationException' occurred in GHI.Networking.dll
An unhandled exception of type 'System.InvalidOperationException' occurred in GHI.Networking.dll
Additional information: This interface type is already created.
The other thing is, how can I detect a failure? I tried getting the IP via netif.IPAddress, but that stays the same, even if I disconnect the module. When I reconnect it, I couldn’t find a way to bring it back to life without reseting the whole system.
@ glx - hardware failures like that should not be a regular thing. In the next SDK we will look into making it so that you can properly dispose of the interface when these errors occur after opening.
For now, you can reset the board and call UpdateFirmware right after the Wi-Fi constructor the next time around. You may be able to use reflection to set activeNetwork on the WiFiRS9110 instance to null, after which you may be able to create a new WiFiRS9110 instance.
The only way I “could get” into that state, was to unplug the module and reconnect it again (what can’t be done on the final design, I just tried some fail-cases). I just wanted to know if there’s a way to recover it from that state. After reseting the whole device everything works fine, even without the firmwareupgrade. Besides that the module runs very stable, I just built a small setup to see how reliable my code runs, and that works for about two days now, without any issues.
By the way, are there plans to replace the RS9110-Module? Just because I’ve seen on mouser it’s ‘not recommended for new designs’. (And a 2.4/5GHz-module would be cool 8))