Ethernet library for Wifly shield

Is there an Ethernet library that will work with the Wifly shield http://www.coolcomponents.co.uk/catalog/product_info.php?products_id=456?

[Disclosure: I wrote the library in question. :) ]

Just in case anyone finds this question, the answer is: yes, there is now.

An alpha of an Arduino library for the WiFly shield was released recently. The library was designed to be as close to a "drop in" replacement for the official Ethernet library as possible. Aside from the initial setup it seems to manage to do so.

Feedback welcome.

--Philip;

P.S. Yeah, I realise it's been a while since I posted around here. :)

Brilliant :). I will be trying the library out shortly. I am curently using WEP but can probably get it changed to WPA. I'll let you know how I get on.

Justin

I will be trying the library out shortly.

Great, thanks for taking a look.

I am curently using WEP but can probably get it changed to WPA.

Actually one person has already modified the library for WEP support, just make the change in the second part of this post.

--Philip;

@Philip : Does Bjoern Hartmanns UPD-Package run on your WiFly-Ethernet-Library? Link to UPD-Code: http://www.bitbucket.org/bjoern/arduino_osc/src/tip/libraries/Ethernet/

I need UPD for retrieving time information using the NTP protokoll which is included in the new time library. If this is working, i do not need a RTC module anymore.

Hi,

Thanks for your query.

@Philip : Does Bjoern Hartmanns UPD-Package run on your WiFly-Ethernet-Library?

From what I can tell, no.

I should probably have explained my "drop in" replacement statement as being at the high-level API level rather than being compatible at the implementation level.

With its standard functionality I don't think the WiFly supports easily sending UDP data. There is a "raw" mode available which might work but it's very low level, not well documented and I've not tried it out.

I need UPD for retrieving time information using the NTP protokoll which is included in the new time library. If this is working, i do not need a RTC module anymore.

Oh, you might still be in luck, as the WiFly user guide mentions that it has NTP support, configured using the "set time ..." commands. I've not tested this functionality however. (Might be nice to try to integrate it with the time library.)

--Philip;

Oh, you might still be in luck, as the WiFly user guide mentions that it has NTP support, configured using the "set time ..." commands. I've not tested this functionality however. (Might be nice to try to integrate it with the time library.)

Greate news. But then we need a NTP-Handler for Ehternet-Library an one for WiFly. That is annoying but we we do not realy implement a full blown operating system on a Arduino.

Anyhow, i got my wifly last week and have only spare time slots to do arduino devellopment. I will inventigate the "set time" command. May be it is good enough for we. When finnished i will present my solution to the forum.

Some quick investigations showed that the time functions will not meet the requirements of the time library. The time function can not handel dates and it is noch described how to change timer zone (default : 7). I need -1.

But in user manual V 2.20 is a section which decribes how to handel UDP comminication. I will try that.

Some deeper investigation showed that the WiFly can only handel TCP or UDP. So thats not an option for me. May be it can be changed by using “set ip protocol 3” which allows TCP und UPD in parallel.

But there is a real time clock on wifly that can synchronize with NTP servers. It has to be activated by setting the NTP synchonizing mode with "set time enable " or "set t e ". Read the manual for value.

The manual does not describe how to set time zone. One has to use “set t z (timezone correction value)”, for instance Germany should use -1=> “set t z -1”. This command will be documented in the next manual version.

Then one can read the RTC by executing “show t t” which will deliver a set of data which includes an RTC value of long integer. This value contains date and time. It seems to be a unix time value. That meets the implementation of the Time Library.

Here is the Example from Manual V2.2:
To view a complete listing of the time variable use the command
<2. 20> show t t
Time=09:02:10
UpTime=653 s
Powerup=1792 s
RTC=7753271426558 ms
timera=66885

I have to do further work on that because this result is just paper work :slight_smile:

Hi Guys,

I was googling the RTC time presented by wifly and bump into this thread. My question here is, does anyone know how to convert the wifly RTC time to standard unix time? For example, the WiFly gives something like 7753271426558ms and getting rid of the ms (last 3 digits) gives 7753271426 sec. However, the standard utc time is more like the format of 1282839291.

Any ideas?

Hello I have a Wifly ver 2.21, and i could set the time zone by:

set time zone 16

I don't know where this number comes from, I just tryed and found the correct one...

Hi

I was able to get the time automatically from the NTP server. I altered the code supplied here: http://www.sparkfun.com/commerce/images/WiFly_Tutorial_Files/WiFly_Tutorial_Final.zip , so it places the needed configurations when autoconnecting to the WiFi.

Place this code somewhere within the autoconnect function, BEFORE it tries to connect:

SPI_Uart_println("set t z 23");
   delay(500);
   SPI_Uart_println("set time address 129.6.15.28");
   delay(500);
   SPI_Uart_println("set time port 123");
   delay(500);
   SPI_Uart_println("set t e 1");
   delay(500);

//(...)

//after the get_ip() function...
    Serial.println("Obtaining Time ");
    SPI_Uart_println("show t t");
    get_time();

the function get_time() is an adaptation from the get_ip() function:

void get_time(void)
{
  char returns = 0;
  char time_index = -7;
  char a = 0;
  // Parse
  while(returns < 3)
  {
    if((SPI_Uart_ReadByte(LSR) & 0x01))
    {
      incoming_data = SPI_Uart_ReadByte(RHR);
      if(incoming_data == 0x0d)
      {
        returns++;
      }
      if(returns > 1)
      {
        //Serial.print(incoming_data,BYTE);
        time[time_index] = incoming_data;
        time_index++;
      }
    }
  }
  hourNow = (time[0]-48) * 10 + (time[1]-48);
  minuteNow = (time[3]-48) * 10 + (time[4]-48);
  delay(100);
  Flush_RX(); // Do not print characters
}

Hope this helps someone… :wink: