WiFly Shield code library alpha 0 release (also SPI UART)

It’s been brought to my attention that an updated version of the WiFly Shield is shipping which uses a different crystal frequency.

This change will require a change in the file “SpiUart.cpp” on the line that currently reads:

#define XTAL_FREQUENCY 12288000UL // On-board crystal

I need to get confirmation of the new frequency value to use.

–Philip;

Hi -

Just a big thanks for doing this!

This is going to make me look dumb, but I spent a few hours trying the WiFly terminal in the tutorial, and then yours, with no success, and was burrowing deeper into understanding the bitmath in the SpiUart code where it seemed to be failing when I tried using a different Arduino. It worked! So hackers, if you find yourself needing to troubleshoot your WiFly shield: make sure you see blinky lights before getting into the code.

Adam

follower:
It’s been brought to my attention that an updated version of the WiFly Shield is shipping which uses a different crystal frequency.

This change will require a change in the file “SpiUart.cpp” on the line that currently reads:

#define XTAL_FREQUENCY 12288000UL // On-board crystal

I need to get confirmation of the new frequency value to use.

–Philip;

Thanks for posting this. It looks really interesting.

FYI, the WiFly Shield I got has a 14.7456MHz crystal on it, so your define should be:

#define XTAL_FREQUENCY 14745600UL // On-board crystal (newer boards)

and the baud rate LSB needs to be: 0x60

utoxin:
As a counter suggestion for project hosting: Github, if you prefer distributed version control. (Which I really really do.)

For sure, I certainly was just making a suggestion.

Also, should we start by firming up (and documenting) the lower level libraries first? I’m just saying I’ve got a Kegerator I’m trying to build!

I can’t find that in my SpiUart.cpp. Is there another version of this?

Also, I had a WiFly module mounted onto a breakout board (RN-121) and ordered the SC16IS750 breakout board to adapt it. I’ve soldered everything in place and it doesn’t talk to it.

I had preconfigured it, while it was a breakout board, and it connects perfectly by itself. It’s a great little module, I just need it to talk to the arduino…

Thanks…

seacritter:
I can’t find that in my SpiUart.cpp. Is there another version of this?

There's only been one version released. Note that there are two files with similar names: SpiUart.cpp and SpiUart.h

Also, I had a WiFly module mounted onto a breakout board (RN-121) and ordered the SC16IS750 breakout board to adapt it. I’ve soldered everything in place and it doesn’t talk to it.

Without knowing more detail it's difficult to know what to suggest. I'd recommend double-checking the wiring and ensuring the RX/TX connections are correct.

–Philip;

This is great! Really cool!

Just a quick question, though…does the WiFly have the ability (currently, or in the future with this library) to communicate straight between WiFly/laptop, WiFly/smartphone, WiFly/WiFly, without the need for a broadcasting wireless router nearby? Just a standalone, 2-device, ad-hoc network? That would make me an incredibly happy happy happy person!

bswift5528:
does the WiFly have the ability (currently, or in the future with this library) to communicate straight between WiFly/laptop, WiFly/smartphone, WiFly/WiFly, without the need for a broadcasting wireless router nearby? Just a standalone, 2-device, ad-hoc network?

As I understand it the WiFly module itself supports both joining and creating an Ad Hoc network.

However, the library doesn’t yet support creating an ad hoc network directly. From reading section 5.11 of the user guide (version 2.19) I think the following will create an ad hoc network assuming the correct configuration has been provided:

set wlan join 4

AFAICT you should be able to join an ad hoc network in the same manner as you join a normal AP-hosted network.

–Philip;

Thanks! Oh, yeah I see that in the description of the unit now. I was too tired to process that before, apparently. :stuck_out_tongue:

I just brought a WiFly shield last week, I have some difficulty on making this board work.

I did try using the library examples and set the passcode & wifi termianl.pde but none of them work, it just give me some garbage char. result

http://dl.dropbox.com/u/2436964/wifishield/wifly.png

I also try the program “screen” in mac, it also give me the same result.

here is the video

http://dl.dropbox.com/u/2436964/wifishield/wifly.mov

can anyone give me some hint? thanks a lot.

seacritter:
I can’t find that in my SpiUart.cpp. Is there another version of this?

Also, I had a WiFly module mounted onto a breakout board (RN-121) and ordered the SC16IS750 breakout board to adapt it. I’ve soldered everything in place and it doesn’t talk to it.

I had preconfigured it, while it was a breakout board, and it connects perfectly by itself. It’s a great little module, I just need it to talk to the arduino…

Thanks…

Just download the alpha 0 library from this thread, I can’t find that define frequency in SpiUart.cpp & SpiUart.h, any possible reason for that?

I found the solution

struct SPI_UART_cfg SPI_Uart_config = {
  0x60, //0x50,  <- should change this value for new clock
  0x00,
  0x03,
  // We need to enable flow control or we overflow buffers and
  // lose data when used with the WiFly. Note that flow control 
  // needs to be enabled on the WiFly for this to work but it's
  // possible to do that with flow control enabled here but not there.
  // TODO: Make this able to be configured externally?
  EFR_ENABLE_CTS | EFR_ENABLE_RTS | EFR_ENABLE_ENHANCED_FUNCTIONS
};

value used is calculated base on this page

viewtopic.php?f=13&t=21530&start=0&hilit=wifly+baud

lawleo:

seacritter:
I can’t find that in my SpiUart.cpp. Is there another version of this?

Just download the alpha 0 library from this thread, I can't find that define frequency in SpiUart.cpp & SpiUart.h, any possible reason for that?
Yes, I just discovered the possible reason for that. :oops: So...it turns out I forgot the released version didn't have that separate crystal speed define but I assumed it did. The addition of the define was the first code change I made after I made the release which was long enough ago that I got confused about what the release had in it. Sorry about that. :)

All the more reason for me to get another release of the library out the door.

–Philip;

@Follower, any updates on this library?

Hi Everyone,

I wanted to share some quick and dirty changes I made and posted up on GitHub of the library.

I wanted to experiment with AdHoc mode of the WiFly shield, I thought I would pass some of that code along.

http://github.com/Encryptic/WiFly-Library

Bonjour tout le monde,

I have succeed to use auto-pairing mode with UDP protocol.

I have found a mistake in documentation in section “11.2. UDP Auto-Pairing”

He’s writing about flags value 0x80, but it’s not 0x80… the right value is 0x40.

But, in chapter “5.6 IP Parameters”, section “set ip flags ”, the values in table are correct, 7th bit is for enable UDP auto pairing

7th bit = > 0100 0000 => 0x40 ( and not 0x80 )

Method for use auto pairing :

  • Set “ip flags” with 7th bit enable

  • Join any network where a “listener” listen UDP broadcast packets from wifly.

  • When listener receive broadcast packet, listener extract ip of the wifly module

  • Listener send a udp packet with arbitrary value toward the extracted ip ( the wifly module ) .

  • Then, the wifly module will set automatically host ip address with ip address of the listener.

this method make it possible to not hardcode ip value, of the listener or the wifly module. Very helpfull when the ip is attribute from DHCP server or AUTO-IP mode ( Ad-hoc ) for example.

It’s maybe helpfull to remind what the udp broadcast packet from wifly module contains many information about him, signal strenght received, battery voltage, MAC addr of AP ( eg. “11.4 Using the UDP broadcast function” )

PS : sorry for my bad english

Encore bonjour,

Anyone have succeed to send UDP packet with the library ?

Maybe a sample ? please.

thank,

[Update: See [WiFly Shield code library alpha 2 release (also SPI UART) for the latest release.][/i]](WiFly Shield code library alpha 2 release - SparkFun Electronics Forum)

A GitHub repository would allow others to fork and contribute back to your code using a tested and well known workflow. It would also give your project a lot ore visibility to other developers.

Just my two cents :slight_smile:

I am literally ready to make it, I’ve been logging my changes with git, nothing we couldn’t merge :wink: