Pages: [1]   Go Down
Author Topic: I can NOT communicate with my Wifly shield...  (Read 917 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, all
I got a Wifly shield from Sparkfun.
http://www.sparkfun.com/products/9954

and I try to config this Wifly shield but alway failed...

I have read many setup manual, but it still can not work.

http://arduinology.tumblr.com/WiFlyBuild
http://cairohackerspace.blogspot.com/2011_05_01_archive.html
http://www.instructables.com/id/Twitter-Mood-Light-The-Worlds-Mood-in-a-Box/step3/Connect-the-Arduino-and-WiFly-to-a-computer/
http://140.138.40.170/OptimalWeb/articlesystem/article/compressedfile/%282012-02-23%29%20%E4%BD%BF%E7%94%A8WiFly%20Shield%E6%90%AD%E9%85%8DArduino%20UNO%E5%BB%BA%E7%AB%8B%E4%B8%80%E7%B2%BE%E7%B0%A1%E5%9E%8B%E4%BC%BA%E6%9C%8D%E5%99%A8.aspx?ArchID=1722
(this page is Traditional Chinese version)

I have installed Wifly Serial library and uploaded its Wifly_test example into arduino.
Wifly Serial Library: http://sourceforge.net/projects/arduinowifly/files/

however, the Serial Monitor alway display this two line
------
Starting WiFly Tester.
Free memory:1160
-----

I have tried 2 ways to connect Wifly shield and arduino board.

The way 1. (refer http://www.instructables.com/id/Twitter-Mood-Light-The-Worlds-Mood-in-a-Box/step3/Connect-the-Arduino-and-WiFly-to-a-computer/)
Wifly Rx pin  <----->  Arduino digital pin 0
Wifly Rx pin  <----->  Arduino digital pin 1
Wifly GND pin <-----> Arduino GND pin
Wifly Vin pin <-----> Arduino Vin pin
Wifly 10 pin <-----> Arduino digital pin 10
Wifly 11 pin <-----> Arduino digital pin 11
Wifly 12 pin <-----> Arduino digital pin 12
Wifly 13 pin <-----> Arduino digital pin 13

The way 2.(refer http://arduinology.tumblr.com/WiFlyBuild)
Wifly Rx pin <-----> Arduino digital pin 3
Wifly Tx pin <-----> Arduino digital pin 2
Wifly GND pin <-----> Arduino GND pin
Wifly Vin pin <-----> Arduino pin 3.3v

and then, I upload Wifly_test example but serial monitor alway only display 2 lines
------
Starting WiFly Tester.
Free memory:1160
-----

How can I address this issue?

Thank you !!
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 201
Posts: 8669
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The schematic shows the following connections on the shield:

Reset
Vin
Ground
D7
D10
D11
D12
D13

Vin does not provide power when running the Arduino off USB power.  You will need to provide 7-12V in the power jack.

The Reset connection is only to allow the Reset button on the shield to replace the Reset button covered by the shield.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for your help.

Today ,I soldered the digital pin 7 on wifly shield.
Following pin was already soldered.
Vin
Ground
D7
D10
D11
D12
D13
but the Reset pin I didn't solder it yet, I would like to control Reset function directly from Arduino UNO.
I connect Wifly shield and arduino uno together, and it communicate with my computer through USB cable.
Now, the PIO 4 led and PIO6 led on the Wifly shield is blinking.

I upload Wifly_test example and  open the Serial Monitor, but it still only display following string.
-----
Starting WiFly Tester.
Free memory:1166
-----

Should I modify some source code in the Wifly_test example ?
or solder RST pin on wifly shield?

This is my Wifly_Test example code:

/*
 * WiFly_Device Test Platform
 * A simple tester for communicating with the WiFly GSx RN-131b/g series.
 * LGPL 2.0
 * Tom Waldock, 2011
 */

#include <Arduino.h>
#include <Streaming.h>
#include <SoftwareSerial.h>
#include "WiFlySerial.h"
#include "MemoryFree.h"
#include "Credentials.h"


// Pins are 3 for INCOMING TO Arduino, 5 for OUTGOING TO Wifly
// Arduino       WiFly
//  2 - receive  TX   (Send from Wifly, Receive to Arduino)
//  3 - send     RX   (Send from Arduino, Receive to WiFly)
WiFlySerial WiFly(2,3);

#define REQUEST_BUFFER_SIZE 120
#define HEADER_BUFFER_SIZE 150
#define BODY_BUFFER_SIZE 100

char bufRequest[REQUEST_BUFFER_SIZE];
char bufHeader[HEADER_BUFFER_SIZE];
char bufBody[BODY_BUFFER_SIZE];


void setup() {
 
  Serial.begin(9600);
  Serial.println(F("Starting WiFly Tester." ) );
  Serial << F("Free memory:") << freeMemory() << endl; 

  WiFly.begin();
  Serial << F("Starting WiFly...") <<  WiFly.getLibraryVersion(bufRequest, REQUEST_BUFFER_SIZE)
   << F(" Free memory:") << freeMemory() << endl;
 
  // get MAC
  Serial << F("MAC: ") << WiFly.getMAC(bufRequest, REQUEST_BUFFER_SIZE) << endl;
  // is connected ?
 
  // WiFly.setDebugChannel( (Print*) &Serial);
 
  WiFly.setAuthMode( WIFLY_AUTH_WPA2_PSK);
  WiFly.setJoinMode(  WIFLY_JOIN_AUTO );
  WiFly.setDHCPMode( WIFLY_DHCP_ON );

   
  // if not connected restart link
  WiFly.getDeviceStatus();
  if (! WiFly.isifUp() ) {
    Serial << "Leave:" <<  ssid << WiFly.leave() << endl;
    // join
    if (WiFly.setSSID(ssid) ) {   
      Serial << "SSID Set :" << ssid << endl;
    }
    if (WiFly.setPassphrase(passphrase)) {
      Serial << "Passphrase Set :" << endl;
    }
    Serial << "Joining... :"<< ssid << endl;

    if ( WiFly.join() ) {
      Serial << F("Joined ") << ssid << F(" successfully.") << endl;
      WiFly.setNTP( ntp_server ); // use your favorite NTP server
    } else {
      Serial << F("Join to ") << ssid << F(" failed.") << endl;
    }
  } // if not connected

  Serial << F("IP: ") << WiFly.getIP(bufRequest, REQUEST_BUFFER_SIZE) << endl <<
    F("Netmask: ") << WiFly.getNetMask(bufRequest, REQUEST_BUFFER_SIZE) << endl <<
    F("Gateway: ") << WiFly.getGateway(bufRequest, REQUEST_BUFFER_SIZE) << endl <<
    F("DNS: ") << WiFly.getDNS(bufRequest, REQUEST_BUFFER_SIZE) << endl
    << F("WiFly Sensors: ") << bufBody <<  WiFly.SendCommand("show q 0x177 ",">", bufBody, BODY_BUFFER_SIZE) << endl
    << F("WiFly Temp: ") <<  WiFly.SendCommand("show q t ",">", bufBody, BODY_BUFFER_SIZE)
    << F("WiFly battery: ") << WiFly.getBattery(bufBody, BODY_BUFFER_SIZE) << endl;

  WiFly.SendCommand("set comm remote 0",">", bufBody, BODY_BUFFER_SIZE);
  memset (bufBody,'\0',BODY_BUFFER_SIZE);

  WiFly.closeConnection();
  Serial << F("After Setup mem:") << freeMemory() << endl ;
 
  Serial << F("WiFly now listening for commands.  Type 'exit' to listen for wifi traffic.  $$$ (no CR) for command-mode.") << endl;


  // clear out prior requests.
  WiFly.flush();
  while (WiFly.available() )
    WiFly.read();
 
}

char chOut;
void loop() {
  // Terminal routine

  // Always display a response uninterrupted by typing
  // but note that this makes the terminal unresponsive
  // while a response is being received.
 
  while(WiFly.available() > 0) {
    Serial.write(WiFly.read());
  }
 
  if(Serial.available()) { // Outgoing data
    WiFly.write( (chOut = Serial.read()) );
    Serial.write (chOut);
  }

} //loop
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 201
Posts: 8669
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
  WiFly.begin();

Aren't you supposed to specify a baud rate?
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for your help very much.
I have already addressed this issue.
I found that Wifly library and Wifly serial library doesn't support Arduino IDE 1.0 or above.
Due to Arduino IDE 1.0 or above doesn't support "BYTE" type.
And older Arduino IDE 32bits cannot execute on Linux mint 12 64bits.
Therefore, I compiled Wifly code with Arduino IDE 0023 32bits on Linux mint 12 32bits.
Finally , I uploaded it into arduino and configured wifly shield successfully.

BTW , I copied Wifly serial library folder into arduino_0023/libraries and restarted arduino 0023 IDE again.
I can not find "Wifly Serial" in my arduino 0023 IDE "File->Examples" menu.
But I copied Wifly serial library folder into arduino_1.0/libraries and restarted arduino 1.0.
I can find it in "File->Examples" menu successfully.
Is this a bug?
Logged

Pages: [1]   Go Up
Jump to: