WiFi PLUS Click with TCP/IP Stack - Complete WiFi Solution

General discussion on Libstock website & codes posted on this website.
Author
Message
smile1357
Posts: 3
Joined: 11 Jun 2014 05:02

Re: WiFi PLUS Click with TCP/IP Stack - Complete WiFi Soluti

#61 Post by smile1357 » 12 Aug 2014 11:22

Thank you for gave me good example. I would like to know, how I can the hyperterminal communicate with LCD via wifi click? Is it possible I edit the example wifi control for that?

Dracog71
Posts: 16
Joined: 16 Jun 2014 18:37

Re: WiFi PLUS Click with TCP/IP Stack - Complete WiFi Soluti

#62 Post by Dracog71 » 13 Aug 2014 01:13

Thank you for gave me good example. I would like to know, how I can the hyperterminal communicate with LCD via wifi click? Is it possible I edit the example wifi control for that?
First, you need to know, how the microcontroler communicate to LCD, how can u send it info, then, in my code where it checks "TCP_RECEIVED", send that info to the LCD.

Hope it works!

zorgcorp
Posts: 110
Joined: 28 Mar 2011 10:17

Re: WiFi PLUS Click with TCP/IP Stack - Complete WiFi Soluti

#63 Post by zorgcorp » 10 Dec 2014 14:57

Super product but it does not work on Net_Wireless_MCW1001_GetScanResult. I am realy desperate on this. I have the choice between the Wifly (wich work very efficient) and the microchip. But I can even do a proper scan result on the microchip. I will spend some more hour and if nothing comes I will switch back to the wifly...please help!

Hello,
I found something not really working Net_Wireless_MCW1001_GetScanResult(i).
My resumed code is:

Net_Wireless_MCW1001_HwReset();
delay_ms(2000);
Response=Net_Wireless_MCW1001_SetMode(_NET_WIRELESS_MCW1001_CP_1, _NET_WIRELESS_MCW1001_MODE_INFRASTRUCTURE);
delay_ms(10000);
Response = Net_Wireless_MCW1001_ScanStart(0xFF, &numOfScanRes);
for(i = 1; i <= numOfScanRes; i++)
{
Net_Wireless_MCW1001_GetScanResult(i);
sprintf(BufferTxSpyDebugGsm,"AXELPROD LOCAL SSID[%u]:%s",i,Net_Wireless_MCW1001_ScanResult.SSID);
SendOnDebugWindow();
}

ON the debug window comes:
AXELPROD LOCAL SSID[1]:Negrescu-Net44444444444444444444d
AXELPROD LOCAL SSID[2]:HP-Print-F3-Officejet Pro 860044d
AXELPROD LOCAL SSID[3]:smartpoint3-Officejet Pro 860044d
AXELPROD LOCAL SSID[4]:Wifi The Cubefficejet Pro 860044d
AXELPROD LOCAL SSID[5]:LEOSKAhe Cubefficejet Pro 860044d
AXELPROD LOCAL SSID[6]:eoo-99732Cubefficejet Pro 860044d
AXELPROD LOCAL SSID[7]:BR-WI-Internefficejet Pro 860044d
AXELPROD LOCAL SSID[8]:CRH-ext-guestfficejet Pro 860044 d
AXELPROD LOCAL SSID[9]:CRH-ext-phestfficejet Pro 860044d
AXELPROD LOCAL SSID[10]:CRH-int-phestfficejet Pro 860044d
AXELPROD LOCAL SSID[11]:Get-int-Wlestfficejet Pro 860044d

It looks like the struct SSID,Net_Wireless_MCW1001_ScanResult.SSID, is not cleared between each Net_Wireless_MCW1001_GetScanResult(i), only the first listed SSID is right, all other take characters from its predecessor.

Also, I tried to print (Net_Wireless_MCW1001_GetScanResult(5)) only the 5th listed SSID with its lenght (always 34!!), result is:

AXELPROD LOCAL SSID[5]:smartpoint44444444444444444444444d
strlen:34

Do I misse something here? or it is a bug?

thanks for you help
Alex

zorgcorp
Posts: 110
Joined: 28 Mar 2011 10:17

Re: WiFi PLUS Click with TCP/IP Stack - Complete WiFi Soluti

#64 Post by zorgcorp » 11 Dec 2014 09:04

As I found the response by my own I submit it for the next person as blind as me!!! :D

The response stand in the help topic for Net_Wireless_MCW1001_ScanResult:
char SSIDLength; // Service set identification (SSID) Length - Number of valid SSID characters that follow
so simple so obvious that I did not see it..

Alex

MaGiK
Posts: 897
Joined: 19 Apr 2013 10:00

Re: WiFi PLUS Click with TCP/IP Stack - Complete WiFi Soluti

#65 Post by MaGiK » 06 Jan 2015 17:21

Thank you so much Alex :D
I'm sure that piece of information will help someone in the future.

Best Regards
My hobby is collecting MikroElektronika products.
Gotta catch them all!

tommyx64
Posts: 4
Joined: 13 Sep 2011 09:21

Re: WiFi PLUS Click with TCP/IP Stack - Complete WiFi Soluti

#66 Post by tommyx64 » 27 Jan 2015 13:04

Hi, I have problem with creating adhoc server. Commands are accepted, at the end is wifi_status = 1. But I not see the adhoc netword named "Tomasko"...

Code example:

Code: Select all

procedure InitWiFi_Adhoc;
begin
  strSSID  := 'Tomasko';
  channels[0] := 6;
  netMask[0] := 255;
  netMask[1] := 255;
  netMask[2] := 0;
  netMask[3] := 0;
  gatewayAdd[0] := 169;
  gatewayAdd[1] := 254;
  gatewayAdd[2] := 0;
  gatewayAdd[3] := 1;
  myIpAdd[0] := 169;
  myIpAdd[1] := 254;
  myIpAdd[2] := 0;
  myIpAdd[3] := 10;
  myMacAdd[0] := 0x22;
  myMacAdd[1] := 0x33;
  myMacAdd[2] := 0x44;
  myMacAdd[3] := 0x55;
  myMacAdd[4] := 0x44;
  myMacAdd[5] := 0x22;

  Net_Wireless_MCW1001_TimeToWait := 1;
  response := 1;

  while(response <> 0) do
    response := Net_Wireless_MCW1001_SetMode(_NET_WIRELESS_MCW1001_CP_1, _NET_WIRELESS_MCW1001_MODE_adhoc);

   // WiFi is ready
  Net_Wireless_MCW1001_TimeToWait := 10;
  Net_Wireless_MCW1001_SetChannelList(1, channels);                     // Choose only channerl one for communication
  Net_Wireless_MCW1001_SetSecurity_Open(_NET_WIRELESS_MCW1001_CP_1);    // Set open security level
  Net_Wireless_MCW1001_SetSSID(_NET_WIRELESS_MCW1001_CP_1, strSSID);    // Set SSID of network

  // Set network parameters
  Net_Wireless_MCW1001_SetNetworkMask(netMask);
  Net_Wireless_MCW1001_SetGatewayIP(gatewayAdd);
  Net_Wireless_MCW1001_SetMAC(myMacAdd);
  Net_Wireless_MCW1001_SetIP(myIpAdd);

  Net_Wireless_MCW1001_SetArpTime(1);
  Net_Wireless_MCW1001_SetRetryCount(5, 0);
  
    // Open "ad-hoc server"
    response := Net_Wireless_MCW1001_Connect(_NET_WIRELESS_MCW1001_CP_1, wifiStatus);
    localPort := 10002;
    
end;
Thank for any ideas...

User avatar
marina.petrovic
Posts: 2986
Joined: 18 Apr 2013 08:11

Re: WiFi PLUS Click with TCP/IP Stack - Complete WiFi Soluti

#67 Post by marina.petrovic » 28 Jan 2015 14:26

Hi,

Please, make sure that you set a network settings according to your network
(from the part of the code which you posted, it seems that you use default network setting from the example).

If you use example from Network WiFi Library, please, make sure that you adjust every part of the example to correspond to your hardware and network settings.

Best regards,
Marina

Dominic75
Posts: 84
Joined: 05 Oct 2012 23:37
Location: Quebec, Canada

Re: WiFi PLUS Click with TCP/IP Stack - Complete WiFi Soluti

#68 Post by Dominic75 » 29 Jan 2015 03:02

Hi,
Is there anyway that this module could run in interrupt mode instead of waiting for the answer? I've got all my WiFi connection working properly but when you use this function to get the data:

Code: Select all

response=Net_Wireless_MCW1001_UDP_ReadBytes(char *socketHandle, unsigned int amountOfDataToBeRead, unsigned int *remotePort, char *remoteIP, char *dat, unsigned int numOfReceiveBytes);
It actually waits for an answer for Net_Wireless_MCW1001_TimeToWait time which according to my test must be around 1 seconds minimum. So i am 'stuck' waiting for the WiFi time out before i can do something. Would there be a way to just send the command and have an interrupt flag raised when data is available? (Similar as an RCIF interrupt)

Basically in my main loop, i check for any events and service them if required. Problem is that since i am waiting for the WiFi response, i can't process anything else.

Main loop

Code: Select all

void checkforEvents()
{
	#ifdef USE_WIFI
	if (UDP_Handler())
	{
	  sortWiFiData();    
	}
	#endif
	//
	#ifdef USE_USB
	if(USB_Handler())
	{
		sortUSBData();
	}
	#endif
}
Service USB:

Code: Select all

char USB_Handler()
{
	char response;
	response = HID_Read();
	if(response != 0 ) return 1;
	return 0;
}
Service WiFi

Code: Select all

// Handling the UDP data sent from remoteIP
char UDP_Handler() 
{
	response=Net_Wireless_MCW1001_UDP_ReadBytes(&socketHandle, sizeof(wifiBuffer) ,&remotePort, remoteIP, &wifiBuffer, &cntBytes); <--This is where execution waits for response
	if(response == 0 ) return 1;
	return 0;
}
Is there a way to make it work without having to wait for the response?

Thanks

User avatar
marina.petrovic
Posts: 2986
Joined: 18 Apr 2013 08:11

Re: WiFi PLUS Click with TCP/IP Stack - Complete WiFi Soluti

#69 Post by marina.petrovic » 29 Jan 2015 14:17

Hi,

In the current implementation of the Network WiFi library you can not work with interrupts.

You can reduce increment time of the Net_Wireless_MCW1001_TimeToWait () variable.
For example if you increment this variable on 1 ms, in that case min wait time for this function is 1 ms.

In Network WiFi Library Help file you can find a note:
"Global library variable Net_Wireless_MCW1001_TimeToWait is the time that the MCU waits for an answer from the the WiFi module after each command sent through UART.
It is expressed in the number of Net_Wireless_MCW1001_Time global variable increments. It is user responsibility to increment this variable in his code".

Best regards,
Marina

Dominic75
Posts: 84
Joined: 05 Oct 2012 23:37
Location: Quebec, Canada

Re: WiFi PLUS Click with TCP/IP Stack - Complete WiFi Soluti

#70 Post by Dominic75 » 29 Jan 2015 18:33

Hi Marina,
I have read the help file 1000 times, so i know this it is my responsibility to increment the value which i am doing. But how can you expect to receive any data in a 1 ms wait time? As i said, under a 1 Sec delay, i am not able to get any data.

Whats the purpose to run @48Mhz if i always need to wait? That's why interrupt exist. My device is not going to do WiFi only. I don't understand how a library that consumes many cycle is written in a polling fashion.

Anyhow, I guess ill put this module in the garbage and try with the WiFi 3 Click which seems to support Interrupts...what a waste of time :(

User avatar
marina.petrovic
Posts: 2986
Joined: 18 Apr 2013 08:11

Re: WiFi PLUS Click with TCP/IP Stack - Complete WiFi Soluti

#71 Post by marina.petrovic » 30 Jan 2015 16:48

Hi,

Sorry, I mentioned 1 ms just as an example, unfortunately, I didn't put the time in real conditions.

I will certainly pass the suggestion to my colleagues from Software Department and they will certainly consider to
implement some modification into current WiFi Network Library.

Best regards,
Marina

tommyx64
Posts: 4
Joined: 13 Sep 2011 09:21

Re: WiFi PLUS Click with TCP/IP Stack - Complete WiFi Soluti

#72 Post by tommyx64 » 24 Feb 2015 15:13

Hello,
I solve the same problem for a long time as Dominic75. We develop automatic door systems based on PIC32MX. Everything works beautifully. I've got a long-implemented Ethernet library. I needed to implement support for WiFi and I came across the problem of timing of the program. I got quite a lot of interruptions (pulse counting position of the motor, counting speed, ...). Were added another break for UART Javascript Plus Click Wifi module. Throughout the program in loops called procedure that handles the received data over WiFi and responds to them. I almost had a heart attack when I found out that the procedure Net_Wireless_MCW1001_UDP_SendBytes waits 1 second for a response from the module. Changing the timing variable Net_Wireless_MCW1001_Time brought some results, but it's not very useful, because Wifi module really long answers and actually I knew to get to about 25 ms, the fact that it does not get caught me completely all communications WiFi. The door system must be timed very accurately, because the exact start and decelerations, detection of obstacles. 25 ms is already can say nepoužťeľné timing. I use MikroMMB for PIC32 @ 80MHz and has to do without WiFi, let alone with him. It would help if there was a function, such as Net_Wireless_MCW1001_UDP_Accept that exactly tell you when the data is available. Although I fear that Javascript method of transmission over the UART is very helpful. In this regard, I am disappointed with the WiFi module Click Plus, because its construction is intended to be of very limited use, especially where timing 1 second problem.
My question is, will do something with this timing? I hope so soon. My door system would be the first to WiFi in the world :)

Here is an example code:

Code: Select all

procedure Uart_prerusenie; iv IVT_UART_1; ilevel 1; ics ICS_AUTO;
begin
 Net_Wireless_MCW1001_Receive;
 U1RXIF_bit := 0;           // ensure interrupt not pending
 if (Net_Wireless_MCW1001_Properties.networkStatus <> _NET_WIRELESS_MCW1001_STATUS_NOTCONN_STATIC_IP) and
    (Net_Wireless_MCW1001_Properties.networkStatus <> _NET_WIRELESS_MCW1001_STATUS_NOTCONN_DHCP) and
    (Net_Wireless_MCW1001_Time >= 30) then
      Net_Wireless_MCW1001_Time := Net_Wireless_MCW1001_Time - 30;
end;

Code: Select all

procedure Timer5_prerusenie; iv IVT_TIMER_5; ilevel 5; ics ICS_AUTO;                 
begin
 // znacenie markerov pre zmeny rezimov
 if DI_RF2RF8_ZAMKNUTE and not DI_RF2RF8_AUTOMATIKA then
  vstup_zamknute_pozadovane := True;
 if DI_RF2RF8_AUTOMATIKA and not DI_RF2RF8_ZAMKNUTE then
  vstup_automatika_pozadovane := True;
 if DI_RF2RF8_ZAMKNUTE and DI_RF2RF8_AUTOMATIKA then
  begin
   vstup_zamknute_pozadovane := False;
   vstup_automatika_pozadovane := False;
  end;
 // znacenie markerov pre zmeny rezimov cez volne vstupy
 if DI_VOLNY1 and not DI_VOLNY2 then
  volnevstupy_zamknute_pozadovane := True;
 if DI_VOLNY2 and not DI_VOLNY1 then
  volnevstupy_automatika_pozadovane := True;
 if DI_VOLNY2 and DI_VOLNY1 then
  begin
   volnevstupy_zamknute_pozadovane := False;
   volnevstupy_automatika_pozadovane := False;
  end;
 // obsluha eth premennej
 Inc(TRM1_pocitadlo_net);
 // inkrement wifi premennej
 Net_Wireless_MCW1001_Time := Net_Wireless_MCW1001_Time + 10;
 if TRM1_pocitadlo_net = {200}400 then          
  begin
   Inc(Net_Ethernet_28j60_userTimerSec);        
   TRM1_pocitadlo_net := 0;
   TMR5 := 0;
   if DO_VYSTUP1 then                            
    DO_VYSTUP1 := False;
  end;
 T5IF_bit := 0;
end;

pomea
Posts: 11
Joined: 02 Dec 2013 18:54

Re: WiFi PLUS Click with TCP/IP Stack - Complete WiFi Soluti

#73 Post by pomea » 21 Feb 2016 14:01

Hello MikroE forum, I would need an help! PLEASE..
I have all the hardware needed to test the WiFi Control demo from the Libstock here: http://www.libstock.com/projects/view/3 ... ntrol-demo

On the 2GB MicroSD formatted with FAT ( from Windows XP, No FAT32) I have copied the .RES file as well as the complete folder of the Images.
Then I have actually loaded on the MikroMedia18F the .hex file from the client folder, the TFT screen remains blank.
Is there someone that can give me a help? What I'm doing wrong?
Thanks a lot
Antonio

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: WiFi PLUS Click with TCP/IP Stack - Complete WiFi Soluti

#74 Post by filip » 25 Feb 2016 08:49

Hi,

Please, can you post the photo of the mikromedia ?

Regards,
Filip.

pomea
Posts: 11
Joined: 02 Dec 2013 18:54

Re: WiFi PLUS Click with TCP/IP Stack - Complete WiFi Soluti

#75 Post by pomea » 13 Mar 2016 15:51

filip wrote:Hi,

Please, can you post the photo of the mikromedia ?

Regards,
Filip.
Hi Filip,
Sorry for long time. Finally I make it working by changing the TFF initialization
TFT_Init_ILI9341_8bit(240, 320);
Then I had 1 WiFi Plus kit defective
Nevertheless now the example project "WiFi Control demo" is working
Thanks

Post Reply

Return to “Libstock Discussion”