Another learning curve question I suspect:
It appears that Serial.available() never indicates serial data is available. I uploaded the RFM69/Examples/Gateway/Gateway.ino example script into my recently received moteino R3, and ran a "dumb terminal" program on my computer. When I type 'i' or 't' or anything on the keyboard the script is evidently not getting the characters. I also compiled and uploaded the following simple "echo" script: with the same result:
void setup() {
Serial.begin(115200); // opens serial port, sets data rate
while (!Serial); // wait for serial port to connect.
}
void loop() {
// send data only when you receive data:
if (Serial.available() > 0) {
// read the incoming byte:
incomingByte = Serial.read();
// say what you got:
Serial.print("I received: ");
Serial.println(incomingByte, DEC);
}
}
I believe for Serial.Available() to work, interrupts must be enabled. Is that right? Is there any reason why I need to call sei() (or something) to enable interrupts?
I've tried two different "dumb terminal" programs on two different operating systems (minicom on LInux and hyperTerminal on WIndows XP) with the same symptom.
Any ideas on what's causing this would be greatly appreciated.
I forgot to mention the simple "echo" script works perfectly on my Arduino Uno, just not on my RFM69HW based moteino. I use the Arduino IDE software.
Hm, that's weird. I use the same thing in the node example sketch that I preload the nodes when I test them:
https://github.com/LowPowerLab/RFM69/blob/master/Examples/Node/Node.ino
I just type 'i' for instance to read the FLASH chip ID, never seen it not work, not even once, not kidding.
Some other users said they saw serial not work properly (I think MAC OS and Linux) because the terminal had some CRLF setting or it was missing it, can't remember exactly since I don't use MAC or linux, but I think it was mentioned somewhere in the forum.
Thanks for the info. I guess my computer is a first. It is a mystery. Does anyone else use moteino on a Linux computer? Does the Gateway.ino or the simple echo sketch work for you?
My computer is Fedora Linux version 18. I installed the arduino IDE 1.0.5 from the Fedora "updates" on-line repository.
I originally downloaded your Node.ino and Gateway.ino sketches from github and noticed they wouldn't respond to anything I typed on the keyboard. I then plugged the moteino into my Windows XP laptop and used "HyperTerminal" with the same result. So I uploaded the simple "echo" sketch into the moteino and it also didn't work on either operating system. If I upload the "echo" sketch into an Arduino Uno, it works fine.
The only thing I haven't done is to install the Arduino IDE software on a Windows computer and compile the Node.ino and Gateway.ino programs there. I'll try that next. But I'm not optimistic because my Arduino Uno works correctly on my Linux computer.
I downloaded and installed the Arduino IDE on a Windows XP computer, and typed in the simple "echo" sketch in my original post. I compiled and uploaded this sketch to one of my RFM69HW moteinos with the same results as on my Linux computer: Serial.available() doesn't ever know about data I enter on the keyboard. To make sure Iinstalled the Arduino IDE correctly, I uploaded the "echo" sketch onto an Arduino Uno. It works correctly.
So, now we know the problem I'm having with Serial.available() isn't related to the computer I'm using. Next I thought the problem might be related to the RFM69HW moteino, so I uploaded the simple "echo" script into one of my RFM12 modeinos. The script doesn't work in that moetino either.
Has anyone else successfully used a RFM69 moteino on Windows XP? Does the "Gateway.ino" sketch accept keyboard input?
If others successfully use the Gateway.ino sketch, I guess there must be some subtle problem that I'm having either with both of my moteinos or with both of my computers.
I finally found the problem with Serial.available() and moteinos. I discovered it is related to the "dumb terminal" software I was running on my computer. I finally tried "PuttyTel" and it works. THe other 2 "terminal" programs I used, minicom and HyperTerminal, didn't work. Investigating further, I noticed that "PuttyTel" by default uses software serial flow control (Xon/Xoff). I reconfigured minicom to use Xon/Xoff and now minicom works as well.
Good to know, thanks for sharing your problem and resolution
one nigth spended trying to resolve, so:
if you search for moteino rx tx 232 serial port problem: set terminal to On/Off flow control!!!!
I know this is an old topic, but I thought that this additional info might help anyone who runs into this problem in the future and comes across this thread:
Serial flow control (which using XON/XOFF is one method of) only comes into play when one of the serial devices can not keep up with the data being sent to it over the serial line. That device will send and XOFF character to the sender to ask it to stop sending serial data until it sends an XON character telling the sender that it can proceed again. The OP with this issue was using 115200 baud, which is faster than many devices can keep up with and may have needed the flow control enabled because of this. This could be why other users who were using lower baud rates did not experience the issue.