Forum >problem in wifi shield v2.2, wizfi 210 example code
ArduinoGeneral

problem in wifi shield v2.2, wizfi 210 example code

userHead potato 2013-11-08 07:24:01 8482 Views9 Replies
Good evening everybody, I'm having trouble with my wifi shield v2.2, i attached it to arduino uno.

so i got the code from here https://github.com/Wiznet/WizFiShield/tree/master/Software/WizFiShield

and i want to test the example code named wizfibasictest.ino, and I always got this response

////////////////////////////
Serial Init
Send Sync data
Rcving Sync Timeout!!
////////////////////////////

this is my code
[code]/******************************************************************
WizFiShield Basic Test Example

This sketch connect to the server after receiving the serial command.

Circuit:
WizFiShield connected to Arduino via SPI

RST: pin 2 // Output
DRDY: pin 3 // Input
CSB: pin 4 // output

MOSI: pin 11 // output
MISO: pin 12 // input
SCK: pin 13 // out

Created 18 Sep. 2012
by James YS Kim ([email protected], [email protected])

Modified 27 May. 2013
by Jinbuhm Kim ([email protected], [email protected])

*****************************************************************/

// WizFi210 communicates using SPI, so include the SPI library:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <SPI.h>
#include <WizFi2x0.h>
#include <WizFiClient.h>
#include <TimerOne.h>

#define SSID "randy" // SSID of your AP
#define Key "apakek27" // Key or Passphrase
// Wi-Fi security option (NO_SECURITY, WEP_SECURITY, WPA_SECURITY, WPA2PSK_SECURITY)
#define Security WPA_SECURITY

unsigned char SIP[4] = {192, 168, 1, 7}; // Server IP address to connnect
unsigned int ServerPort = 5000; // Server port number

WizFi2x0Class myWizFi;
WizFiClient myClient;

boolean Wifi_setup = false;

///////////////////////////////
// 1msec Timer
void Timer1_ISR()
{
uint8_t i;

myWizFi.ReplyCheckTimer.CheckIsTimeout();
}
//
//////////////////////////////
void setup() {
byte retval;

Serial.begin(9600);
Serial.println("\r\nSerial Init");

// initalize WizFi2x0 module:
myWizFi.begin();
myClient = WizFiClient(SIP, ServerPort);

// Timer1 Initialize
Timer1.initialize(1000); // 1msec
Timer1.attachInterrupt(Timer1_ISR);

myWizFi.SendSync();
myWizFi.ReplyCheckTimer.TimerStart(3000);
Serial.println("Send Sync data");

while(1)
{
if(myWizFi.CheckSyncReply())
{
myWizFi.ReplyCheckTimer.TimerStop();
Serial.println("Rcvd Sync data");
break;
}
if(myWizFi.ReplyCheckTimer.GetIsTimeout())
{
Serial.println("Rcving Sync Timeout!!");
// Nothing to do forever;
for(;;)
;
}
}

////////////////////////////////////////////////////////////////////////////
// AP association
while(1)
{
retval = myWizFi.associate(SSID, Key, Security, true);

if(retval == 1){
Serial.println("AP association Success");
Wifi_setup = true;
break;
}else{
Serial.println("AP association Failed");
}
}

delay(1000);

}

void loop()
{
uint8_t retval;
byte rcvdBuf[129];

memset(rcvdBuf, 0, 129);

if(Wifi_setup)
{
myWizFi.RcvPacket();

if(myClient.available()) {
if(myClient.read(rcvdBuf))
{
Serial.print("CID[");
Serial.print((char)myClient.GetCID());
Serial.print("]");
Serial.println((char *)rcvdBuf);
myClient.write(rcvdBuf);
}
}
CheckConsoleInput();

}
}


void CheckConsoleInput(void)
{

uint8_t ch;

if(Serial.available() > 0)
ch = Serial.read();

switch(ch)
{
case 'd':
case 'D':
Serial.println("Disconnect Request received");
if(myClient.IsConnected()) {
if (myClient.disconnect() == 1) Serial.println("Disconnected! ");
else Serial.println("Disconnection Failed");
}
break;
case 'c':
case 'C':
Serial.println("Connect Request received");
if(!(myClient.IsConnected())) {
if (myClient.connect() == 1) Serial.println("Connected! ");
else Serial.println("Connection Failed");
}
break;
}

}
[/code]

all I change was the ssid, key, and security.

I also tried the timer from 3000 to 10000, 1000 to 30000, etc, but no luck

and my also tried baud rate 9600 and 115200, still no luck.

Anyone here already succeed with this example code? would you please help me?
2014-01-12 07:14:50 Hi have you had any luck on accessing your test site? userHeadPic addictiverat
2013-11-21 21:05:48 Im using pubsubclient.h, and about at+httpconf, yeah i think so bro

Or, can i use at+nctcp for connecting my arduino to test.mosquitto.org?
userHeadPic potato
2013-11-21 20:02:27 what mqtt library are you using?
Do you still need the httpconf command using mqtt to connect to test.mosquitto.org ?
userHeadPic Jose
2013-11-21 02:29:33 Thx for your reply jose,

So i'm going to make the internet of things projects, i do it fine with ethernet shield.

In the ethernet shield, i easily connect it with test.mosquitto.org.

But in this wifi shield, i still have no luck for doing it.

That's why i desperately need the at+httpconf command.
userHeadPic potato
2013-11-12 21:12:58 Hello Potato,

Upgrading the board is not supported, and is quite dodgy, potentially leaving the shield unusable. The wiznet utility does not work well all the times. For the firmware you will need to ask directly to wiznet.

on this firmware revision, the command seems to be different from the 1.3 datasheet version. In our provided datasheet:
AT+HTTPCCONF=(*)    note that the datasheet says that AT+http* commands are not supported for this revision
And there is no explanation of the param and values.

[url=https://www.dfrobot.com/image/data/TEL0047/WizFi210-User_Manual_EN_V1.12.pdf]https://www.dfrobot.com/image/data/TEL0047/WizFi210-User_Manual_EN_V1.12.pdf[/url]

What do you need this feature for? Perhaps you can do the request from within Arduino itself.


userHeadPic Jose
2013-11-10 05:07:46 ooh i see, so that's how it works, I already test in the wiki, and It's working.

now, i'm trying to communicating with secure web server using HTTPS in the manual.

but, when I type AT+HTTPCONF=20,User-Agent: Mozilla/5.0, I got [ERROR: INVALID INPUT] response.

mine is UART v1.1.0.5(W), how can I upgrade it to enterprise version UART v1.2.0.x(S2WEAP)?
userHeadPic potato
2013-11-09 01:55:02 You can input the commands directly to the Serial port, check the documents on the wiki for the AT commands.
[url=https://www.dfrobot.com/wiki/index.php/WiFi_Shield_V2.2_For_Arduino_(SKU:TEL0047)]https://www.dfrobot.com/wiki/index.php/WiFi_Shield_V2.2_For_Arduino_(SKU:TEL0047)[/url]

Basically, what you want to do, is as wiki follows.
Connect to the wireless network,
and then, if you need a webserver, make sure the ports are open, instead the default one 4000 mentioned on wiki, you will want to use port 80.

The rest is up to Arduino code not the library.

Have you tried following the wiki? did you run into some problems?
userHeadPic Jose
2013-11-08 22:52:59 Hi jose, yeah, i just realized it until now when I read the spec in dfrobot.com about wifi shield v2.2 that it don't support SPI. Thank you.

but, when i search google, I haven't seen any example code and libraries for wizfi 210 using UART,they all always using SPI. do you know where can I find it? i'm sorry for demanding too much :(
userHeadPic potato
2013-11-08 20:24:11 Welcome Potato,

I believe this example code is for I2C or SPI
Our WiFi shield v2.2 is UART, the library don't have UART support, so it won't work.

Cheers^^
userHeadPic Jose