Main Site Documentation

IoT with FEZ rules them all


#21

Maybe there is a newer version in dev branch. What is online is what is the latest we have.


#22

Hi Gus,

The compilers complains about the GHI package signer:
This project references NuGet package(s) that are missing on this computer. The missing file is The missing file is …\packages\GHIElectronics.Tools.AssemblySigner.1.0.3\build\GHIElectronics.Tools.AssemblySigner.targets


#23

Hi,
I have deleted the references to the GHI assembly signer and ST driver compiles. Also I have copy OpenSockect to OpenServerSocket in GHI SPWF04Sx driver. This worked! The response was catched in the event handler: wifi.IndicationReceived += (s, e) => … as defined in wifi.cs. I have succesfully catched:
SPWF04SxIndication.IncomingSocketClient and SPWF04SxIndication.PendingData in this event handler. I don’t know if this the recommanded way. May be a callback should be used? I am still not sucessfully received data because IncomingSocketClient and PendingData didn’t contain any data. What was received the IP address of the client and som numbers. I can’t find any spec of these numbers. Also it was tested with webbrouwser as client. I am searching for socket client app but not found (one from google play store didn’t download).

May be the GHI assmeblysigner had to be used only if the GHI publish the drivers. To delete the references i had to edit the ST driver project file.

Q: Do I have to catch incomming sockets in the event handler or is tthere a better way? How to read the socket data?

Thanks for all your help!

Best regards,
Aart


#24

Good Progress !! I Would not compile the driver as .dll but would add all of its classes to my project.Then you can set breakpoints an better see what is going on.


#25

Some years ago I played around with RN171 WiFi Module. To test the http server I used a simple homemade http client for PC. Perhaps it can be helpful. The client App is included in this project.
https://old.ghielectronics.com/community/codeshare/entry/927


#26

I have compiled the GHIElectronics.TinyCLR.Drivers.STMicroelectronics project in the GHIElectronics.TinyCLR.Drivers solution in debug mode. After that I copied (can be automated) to the Packages folder of my project. I can now ‘Step Into’ (with F11) the SPWF04Sx.DLL and it open SPWF04SxInterface.cs and others ro see what happens and I can even set breakpoint there! Work great. BTW the Wifi model doesn’t connect to an Unify access point but a Fritzbox AP is not a problem!


#27

Hi RoSchmi,

This WiFi module used a preprogrammed web server with which you can (dynamical) create html files in flash wiich are then being served. I don;t know how to use this to make a kind of SOAP or REST service. The Wifi module supports a socket server which looks very usable. I used the SPWF04Sx training pdf found on ST’s website. Here are not all the return values defined. May be I had to seach a document with full spec. Further I downloaded from a Android phone the SP socket tester in Google Play store. The same one that is used in the ST training PDF. But if I entered the wifi module’s IP addess and the port (i choose 3333) the handler is not fired with IncomingSocketClient. Probably I had to open port 3333 in the firewall in this situation. If I type in a desktop web browser http://<FEZ_IP>:3333 then several IncomingSocketClient are received. So I can continue for now!


#28

Did you download my http client? It’s a C# windows forms application. You can run it with debugger and can see what you send and what you get (only port 80 I think).


#29

Hi RoSchmi,

I haven’t downloaded your http client because I have installed the SP socket tester on an android phone. May be I will do later to learn new things from your software.

The downloaded SP socket tester is the same as the one used in ST Microelectronics training PDF. Problem was that ST WiFi module didn’t connect to our Unify Access Point. This AP is in our domain and gives local IP addresses. After reconnecting the USB of the FEZ it was suddenly able to connect to the Unify AP. After that I could test access over the public internet. And it worked very well!!!

If I click ‘Connect’ in the SP app than I receive: WIND: IncomingSocketClient :39876:0:0. 39876 is the Remote Port. What 0:0 is I am not sure but the first zero I think is the socket numer. I will see later. After entering some text in the SP Google app and I click ‘Send’ then I receive: WIND: PendingData 0:0:4:8. The last 8 is the number of characters I entered in the app. The first 0 is probably the spocket number but what is second 0 and 4? The Send button can be clicked repeatedly with different text. I receive new PendingData’s with the last number changed according the length of the eneterd text.

Next problem is to read the text entered in the SP app and this goes with other AT commands not implemented yet. So I am on my to get started with IoT but I never had expected that this wasn’t possibly out of the box.

Only strange that the ST WiFi module could not connect to the AP from Unify in the first place. Now the connection was succesfull I get WpaCrunchingPsk xxx:16 is stead of xxx:14.

Best Regards,
Aart


#30

Only strange that the ST WiFi module could not connect to the AP from Unify in the first place. Now the connection was succesfull I get WpaCrunchingPsk xxx:16 is stead of xxx:14.

I think you must have a look if ‘SPWF04SxWiFiState.ReadyToTransmit’ state is reached before you can continue to write to the module
https://github.com/RoSchmi/AzureDataSender_FEZ/blob/master/AzureDataSender_FEZ/RoSchmi/Net/WiFi_SPWF04S_Device.cs


#31

Hi RoSchmi,

Thank you again!

I have waited until the event SPWF04SxIndication.WiFiUp occured. But this event never occured however. After a power Off and On suddenly everyting start to work. Also Socket Connect and Socket Send works as expected. I will also test if (Wifi.State == SPWF04SxWiFiState.ReadyToTransmit). I never use ‘State’ but i expect that this State occors before the WiFiUp event.

Best regards,
Aart


#32

Hi RoSchmi,

Forgot to ask: Where can I find a specifiction the return messages of the AT commands? In the ST training manual i found for example: +WIND:61:Incoming Socket Client:192.168.1.XX:12345:0:0. I have found that 12345 is remote port number but what is 0:0. Also in the PDF +WIND:55:Pending Data:0:0:4:4. The last 4 is the number of characters of the entered text (test in this case). But what are 0:0:4 or where is the spec?

Thanks for your support.

Best Regards,
Aart


#33

Sorry, I have all ready found the specs on the ST website: en.DM00329655.pdf


#34

Hi RoSchmi,

I have now used: if (Wifi.State == SPWF04SxWiFiState.ReadyToTransmit) and everything works reliable at the moment. Thank very much for the hint!

In the mean I can receive incoming sockets and read the data entered in the SP Google app over the public internet. I have only added:
public int OpenServerSocket(int port, SPWF04SxConnectionType connectionType, SPWF04SxConnectionSecurityType connectionSecurity)
and
public int ReadServerSocket(int SockIdServer, int SockIdClient, byte[] buffer, int buflen=0)

Next: to implement: WriteServerSocket and CloseServerSocket.

So nearly ready to start!

Best Regards,
Aart


#35

Hi all,

I would let you know that everything has been solved! I have added OpenServerSocket, ReadServerSocket, WriteServerSocket and SocketClientGone to the GHI ST Wifi driver. With tests with SP Google app last problem was when SP closses the socket (after a time out). In that case the wait for: SPWF04SxIndication.PendingData: had to be stopped on the event: SPWF04SxIndication.SocketClientGone so that SP can reconnect. Last test will be with multiple SP clients (module support max 8 sockets). After that I can start the IoT with FEZ rules them all board.

Thanks a lot for all the help!

Best Regards,
Aart


#36

Sorry this text:

had to be:
WriteServerSocket and CloseServerSocket to the


#37

Thanks for posting your results. Would be very nice if you could post some code on Github or elsewhere for download.


#38

Hi RoSchmi,

The new functions are merely copies of the existing ones in the GHI SPWF04SxInterface.cs file but changed with the needed AT command. But if you want them it is OK. Where I ahd tom upload?

May be I should finish the orher functions first. I have allready made the MiniAP mode functions and I can use the FEZ as an AP now. I that this the mode after a reset with an easy predefined IP. This actualy works. I have the AP now with IP: 222.222.222.222 and my phone gets IP 222.222.222.223.

Strange thing is that this din’t work with a Winoows phone but it did with an Android. With this the user should be able to join an existing network or keep this ip for ad hoc device control. This user config had to be remembered but also flash and memory function are not implemented. Also after a reset the device had to return to the MiniAP mode with the easy IP address.

In had read everything about the memory and flash control functions of the ST Wifi module. Mentioned was that this module is obsolete?

Best Regards,
Aart


#39

Yes sir. Replacing the ST WiFi Modules


#40

@aartastona Yes, I think it is the best to post the code when all intended functions are ready. A good place to upload is Github.
@Gus_Issa Curios that STM stopped SPWF04SA without having a successor. Is there any information if they are going to have a successor in the next time and why the gave up this product. How about your efforts to find another WiFi module?