SparkFun Forums 

Where electronics enthusiasts find answers.

All things pertaining to wireless and RF links
By Squiffy
#160086
Using the libraries and examples from https://github.com/sparkfun/WiFly-Shield, I am having issues using the SpiUartTerminal library. I send $$$ to go into command mode, but when sending a command, the output starts out clean but then turns into random data. Here is an example output below. I have WiFly shield revision three.
Code: Select all
CMD
get everything

WiFly Ver 2.32, 02-13-2012 on RN-131
Beacon=100
Probe=5
Reboot=0
OPEN=*OPEN*
CLOEL*EEHO
si6Mca0lhe1ITe
ma$FW
PNP76.:0N5220G712
S.020ROPM=4FSxTO=
AP..D=..1N=v1auau
=898:
liyXmUrv
aPs
iucTo=
Pdx
Dog
n
t=
n
tP
s0f
e,4
io0ahson2Sp=
er
ir1Acn
F=
okx0Ilx
uex
nlxTe=
E=9122
e
ut9
l0
dx
_I
im0
pcx
vIWySPwdFm0
g=
re
A22..55
ta0
n=0eP=
2>
Any help is appreciated.
By Ben-X
#160151
hey, im running into the same problem. that is since i did a hardwarefactoryreset, before that it was running fine. could you solve this problem already?

kind regards,
ben-x

edit: i did just a firmware upgrade, but stil have the same problem.
By ptrav1956
#162222
I have the same issue, not just with the Terminal sketch but also when talking to the WiFly shield using Coolterm. My first thought is that it is a flow control issue, since the first chunk of output from the shield is always legible, and then at a certain point becomes garbled. Does anyone have any suggestions as to why this is the case and what might be done to fix it?

The output looks like this:
get ip

IF=UP
DHCP=ON
IP=192.168.181.17:80
NM=255.255.255.0
GW=192.168.181.254
HOST=0.0..0
OT,T1
A=
CD0
K=.022

As far as I can tell from comparing the output from different commands in HEX mode, the shield seems to send 87 bytes that make sense and then the rest doesn't. I didn't have this problem with a RN-XV module (connected via FTDI cable and Adafruit XBEE adapter). Does anyone have any ideas or suggestions please?

The shield is RN-131C, the Arduino is a rev3. Running on a Mac OS10.8.4. Coolterm 1.42 Arduino IDE 1.05. Currently sunny ;)

Paul
By nicoverduin
#162314
I have the same problem..... just put a new topic in but I suppose that can be deleted. I'll ask the moderator.
my info:
I have a Wifly RN-131C ver. 2.21 giving me problems:
a) I have upgraded it to version 4.00 and tried all different kinds of versions and all say ftp & update ok
b) when using SpiUartTerminal it connects fine.
c) It even connects to my network
d) however if I type "get everything" it starts ok then it switches to garbage.
e) I have tried it with an Arduino R2 and an Arduino R3. Same results.
Code: Select all
    SPI UART on WiFly Shield terminal tool
    --------------------------------------

    This is a tool to help you troubleshoot problems with the WiFly shield.
    For consistent results unplug & replug power to your Arduino and WiFly shield.
    (Ensure the serial monitor is not open when you remove power.)

    Attempting to connect to SPI UART...
    Connected to SPI UART.

     * Use $$$ (with no line ending) to enter WiFly command mode. ("CMD")
     * Then send each command followed by a carriage return.

    Waiting for input.

    $$$

    ERR: ?-Cmd
    <4.00>
    get everything

    wifly-GSX Ver 4.00.1, Apr 19 2013 11:48:31 on 131C11
    Beacon=102
    Reboot=0
    IF=DOWN
    HOI00:0N5520G.0
    S..2
    R=PM14LS7TO0
    CP0.ONP
    L=L
    MEEOFsz4
    tC=
    sm=Iee0ma$N00
    mn
    cp.rhc
    a=0F=.0
    iwySm
    roga=s3ipiTe=0To=
    SVe
    a0xn
    o0u=NM=1
    t12MLk-r3Lk-30apszn
    AdsdEU=as
    eT0aT0Tg=
    to0Inx
    a=0
    V=0eg=0rL=
    ahrbpTE=TE=9151
    e
    ua90l0
    d0
    dI
    om1
    ecx
    veWlSPsd
    m0
    gl
    ee
    A2..555
    tv0
    c=00
    nr0ee=04>
    <4.00>
    Joining Verelec now..
    Associated!
    DHCP: Start
    DHCP in 1222ms, lease=86400s
    IF=UP
    DHCP=ON
    IP=192.168.0.12:2000
    NM=255.255.255.0
    GW=.81Len0


    <4.00>
    get everything

    wifly-GSX Ver 4.00.1, Apr 19 2013 11:48:31 on 131C11
    Beacon=102
    Reboot=0
    IF=UP
    DH=
    =2812
    M555
    W26.
    T0.0
    O=,T1
    L=
    CD0
    C=.0P=E
    O*O
    M=E*lhe4
    ch0Fhm5dTr
    da
    S960
    mn
    c=.rhc
    a80F0.:
    lwyXmUrvgaPs
    iuiTo=
    To=
    IVl
    a
    xt
    i0uONa=f
    t22bLm-r0Lm-30ahs5n
    PdedAU=ps
    em0am0rg0
    tn0onx
    a00
    V=
    eR=
    rL0
    uh=bpiE0TA=9852
    e
    ut9
    l0
    dx
    _I
    im0
    pcx
    vIWySPwdFm0
    g=
    re
    S22..55
    ta0
    c=.0
    n=0eP=
    4>

By ptrav1956
#162335
One more datum: This behaviour only happens over the serial port. Telnet'ing to the shield and issuing the same commands gives the full and appropriate output. I have tried changing all parameters I can think of (including the SPI clock speed, as per mtngardner's suggestion in https://forum.sparkfun.com/viewtopic.php?f=13&t=35187), but this doesn't help. Currently at wit's end and rapidly losing both hair and what remained of my sanity.

Surely someone else has faced and solved this same problem?
By nicoverduin
#162336
Sanity can be solved :) losing hair will get you bold :). I have put a ticket out at MicroChip and sent a mail to Sparkfun. See what happens. I have "No" but it can always become a "Yes". If not solved I guess I will have to find another brand with better service support. I am suprised that Sparkfun ignores this as well...
Like you I have tried ti switch parameters as well and also with no success. And I am like you surprised that if we are the only ones with this board, then it must be a poor product (sold 5?). So eiher we are doing something wrong here, or.....
By nicoverduin
#162511
I went through the library and found this piece of code in SpiUartDevice.cpp and found a delay(2) statement (I hate delays :)). So I commented it out and...... works like a charm :)
Code: Select all
int SpiUartDevice::available() {
  /*
   * Get the number of bytes (characters) available for reading.
   *
   * This is data that's already arrived and stored in the receive
   * buffer (which holds 64 bytes).
   */

  // This alternative just checks if there's data but doesn't
  // return how many characters are in the buffer:
  // readRegister(LSR) & 0x01
//  delay(2);
  return (readRegister(RXLVL));
}
By ptrav1956
#162515
Nico,

you're a genius! that works for me too! I have found out a few other things that may be of some use -

1. The debug mode in wiflydevice.cpp does not compile for me if set to anything other than 0 - any debug statement with a variable name generates an error - it seems to be the print(F()), which I understand is done to save memory but I can live with the overhead during debugging, so I deleted the F function call and these statements now compile. This should make things easier.

2. The entercommandmode routine in Wiflydevice.cpp checks to see if it has entered command mode by checking for the output of the 'ver' command. However, it is checking for 'wifly ver' in the output, whereas the module on the wifly shield returns 'wifly-GSX Ver'. As a result, it would always return false.

With those changes, together with your finding about the delay statement, have let me run the webserver example successfully. Result!!

Paul
By nicoverduin
#162519
Now I still have to get this change into the official library or we will be answering this same question for quite some time. Anybody haven an idea how to do this with GIT? I have Github installed on my windows7 machine, but no idea how to do it.