Pages: [1]   Go Down
Author Topic: garbage characters at RN-171 , WiFly direct connection  (Read 250 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 26
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
whenever I run my program, I got "garbage" characters from the RN171 (or my application cant grab the real content from Module) .. But strange thing is, Module (looks like) can process my commands (ie. connect xx.yy.zz  50000) without any problem. But I have trouble to process the messages from the module because of these garbage characters shown below. So any idea? many thanks in advance, reha

VVVVVVVVV   output at Arduino console VVVVVVVVVVV
merhaba!
‘þ$Ñÿ Áÿ

ERR: ?-Cmd
<2.23> getÁÿ

IF=UP
DHCP=ON
IP=192.168.1.110:2000
NM=255.255.255.0
GW=192.168.1.1
HOST=198.100.31.2:1883
PROTO=TCP,
MTU=1524
FLAGS=0x7
BACKUP=0.0.0.0
<2.23>


******   My Environment    ************

1) Connected RN171 to arduino nano 3 directly using pin 4 & 5
2) Powered RN171 from 3.3V from the Arduino board
3) Arduino is connected to notebook via USB

**********  and my program is: *****
#include <SoftwareSerial.h>
SoftwareSerial mySerial(4, 5); // RX, TX

void setup() 
{
  Serial.begin(9600);
  Serial.println("merhaba!");

  mySerial.begin(9600);
  delay(2000);
  mySerial.write("$$$");
}

void loop()
{
  if (mySerial.available())
    Serial.write(mySerial.read());
  if (Serial.available())
    mySerial.write(Serial.read());
}

Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 26
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
since I could not solve the problem, I fixed (I guess, it is working properly till now) the problem using another library that I didnt want to use ie. AltSoftSerial ... which uses "fixed I/O" pins in which I didn't like.. But, since I could not solve the problem from SW, I solved the problem from HW..

- I changed the pins of Tx & Rx to D8 and D9
- I changed the library to AltSoftSerial.h
- I did not changed the application except library

Now it is working properly (as I mentioned above... till now and I hope it will continue to work)

Final version of the program is:

#include <AltSoftSerial.h>

AltSoftSerial mySerial;

void setup() {
  Serial.begin(9600);
  Serial.println("AltSoftSerial Test Begin");
  mySerial.begin(9600);
  mySerial.print("Hello World");
}

void loop() {
  char c;
  if (mySerial.available())
    Serial.write(mySerial.read());
  if (Serial.available())
    mySerial.write(Serial.read());
}


BUT still I'm looking for any suggestion to use original SoftwareSerial library.. I will be so happy to hear ideas.. regards, reha
Logged

Pages: [1]   Go Up
Jump to: