Teensy 3.0 Serial Issue

Status
Not open for further replies.

houston5

New member
Hi all,

I am using the teensy 3.0 with the teensyduino IDE add-on. I have been trying to establish a serial connection to a sim900 breakout board I purchased a few months ago (this model http://store.open-electronics.org/Breakout/GSM Breakout/Breakout SIM900 GSM Module ).

Once the sim900 powers up I successfully receive this in the serial monitor

RDY

+CFUN: 1

+CPIN: READY

+PACSP: 1

Call


Though the problem is when I try and send an AT command to the module such as "AT". The module always sends back gibberish.
In particular sending "AT" cause the module to respond with

|,

My code

Code:
char incomingByte;
char incomingComp;



void setup() {                
  pinMode(8,OUTPUT);
  Serial.begin(9600);
  Serial1.begin(2400); 
  
  digitalWrite(8, HIGH); //power on for sim900 on d8

  delay(1200);

  digitalWrite(8, LOW);

  delay(10000);
}


void loop()
{
  
  
  if(Serial.available() > 0) {                        //print data from computer to sim900
  
		incomingComp = char(Serial.read());
		Serial1.print(incomingComp);
               
                
	}       
  
  
  
  
if (Serial1.available() > 0) {                       //print data from sim900 to computer
  
		incomingByte = char(Serial1.read());
		Serial.print(incomingByte);
                
	}             
}

It would seem to me that the problem is sending from the teensy not receiving. Please note that I have successfully used a 3.3 volt Arduino to interface with this module using very similar code and when sending "AT" the response was "OK". Have I implemented the teensy's serial function incorrectly? Why can I only receive?

Thanks
 
Your code sends exactly what you type in the serial monitor to the SIM900. That will include whatever line end characters you have allowed the serial monitor to send. I think the default is carriage return and then line feed. The SIM900 might be expecting the line to end only with either carriage return or line feed, but not both. There's a dropdown menu in the serial monitor window which allow you to specify the line ending character(s). Play with that to see if it does anything.
Also, the SIM900 is almost certainly expecting to see AT in upper case so you must type it like that.

Pete
 
Last edited:
Thanks Pete for your reply, I have been sending the AT in uppercase and using the carriage return option in the serial monitor. I believe from reviewing the data sheet that a carriage return is the correct option. When in the past I used the 3.3v arduino to interface with it I used the carriage return option and was able to recieve "OK" back.
Would setting both to lower baud rates possibly help? It seems 2400 is already pretty low.

Thanks.
 
Your code reads (and prints) the power-up info from the SIM900 at 2400 baud, so it ought to be able to receive AT commands at the same speed.

On the website for this board, one of the reviewers says that there is an Arduino library for it but I can't find one. No datasheet either.
Have you got any info?

Pete
 
Have you tried any other baud rates for Serial1? Try 9600 and send AT followed by carriage return several times.

The hardware serial port should be much more reliable than using the softwareserial library.
How have you wired up the Serial1 port to the SIM900? Check that the connection for transmitting from T3 to the SIM900 is correct.

There's a library here: http://code.google.com/p/gsm-shield-arduino/downloads/list
Might be worth a try.

Pete
 
Though when I used the Arduino to interface with it, I was using a software serial library. Could there be a reason why using the software serial would work over hardware serial? As far as I can tell there is not a software serial library for teensy 3.0, right?

There is sort-of a SoftwareSerial library for Teensy3.

If you use a pair of pins which have real serial capability, then SoftwareSerial will use Teensy3's serial port hardware. This is mainly useful for libraries that have a hard-code dependency on SoftwareSerial.

If you don't use native serial pins, Teensy3's SoftwareSerial can transmit, but not receive. Someday I'll work on reception, but it's a very low priority because there are 3 real serial ports.
 
Thanks for all of your help guys but I have discovered my problem. I was using an ATX power supply with some small caps to power the sim900 but according to this forum http://www.edaboard.com/thread207589-2.html the 2 amps the sim900 draws during transmit can really drop the voltage causing it to reset itself. I am now using a larger capacitor and everything is working now. I apologize for wasting your time with what was such a trivial problem, thanks again you guys, I learned alot!
 
software serial library = autoselect ?

There is sort-of a SoftwareSerial library for Teensy3.

If you use a pair of pins which have real serial capability, then SoftwareSerial will use Teensy3's serial port hardware. This is mainly useful for libraries that have a hard-code dependency on SoftwareSerial.

If you don't use native serial pins, Teensy3's SoftwareSerial can transmit, but not receive. Someday I'll work on reception, but it's a very low priority because there are 3 real serial ports.

Hi Paul,
Does that mean if I use the standard GSM library and select some hardware pins, then the softserial library wont be required / compiled into the code ? Or is there an advantage to using the library at http://www.open-electronics.org/arduino-gsm-shield/

Thanks Nik
 
Status
Not open for further replies.
Back
Top