Go Down

Topic: Serial (UART) communication (Read 362 times) previous topic - next topic

Heromann

Hello,

I've hooked up a sim800 gsm modem on an UNO (pin 0, 1). I wrote a simple sketch which sends 2 modem commands over the serial connection. First setup a call, delay 5 seconds and then disconnect the call. When I upload the sketch from the arduino ide everything works fine (tx is lid, modem receives commands and initiates/ends the call).

When I power cycle the arduino and modem the sketch is started again (blink check ok) but the serial transmission is not initiated. No AT commands send (tx not lid). Also tried with external power, same result no serial transmission. What could be the cause of this problem.


groundFungus

#1
Oct 17, 2017, 11:45 am Last Edit: Oct 17, 2017, 11:46 am by groundFungus
What happens if you just reset the Uno, with the reset button, without cycling the power?  Can you, please, post your code?  Please read the "how to use the forum-please read" stickies to see how to format and post code.

MarkT

I suspect you have to wait a while after powering up the GSM modem before it can connect.  It
has to negotiate with the network.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

TomGeorge

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom.... :)
Everything runs on smoke, let the smoke out, it stops running....

Heromann

#4
Oct 17, 2017, 07:35 pm Last Edit: Oct 23, 2017, 10:32 am by Heromann
Here is the code, it works fine after an upload from the Arduino IDE. But with both powercycle and reset debug flash works but no tx led flashes.  (also tried external power 9v 1A no tx either)

Code: [Select]
void setup() {
  pinMode(LED_BUILTIN, OUTPUT); //set debug blink
  digitalWrite(LED_BUILTIN, HIGH); //debug blink on

  Serial.begin(9600);
  while(!Serial);
  Serial.flush();

  delay(30000);  

  digitalWrite(LED_BUILTIN, LOW); //debug blink off
  
  Serial.print("ATD06********;\r");
  delay(5000);  
  Serial.print("ATH\r");
  delay(300);

}

void loop() {
 
}


DrAzzy


What happens if you remove:


  while(!Serial);
  Serial.flush();


You say this is an Uno, though - so neither of those should be having any effect.
ATtiny core for 841+1634+828 and x313/x4/x5/x61/x7/x8 series Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts (some assembled), mosfets and awesome prototyping board in my store http://tindie.com/stores/DrAzzy

Grumpy_Mike

Quote
Here is the code, it works fine
No what you posted does not work at all. You need to post ALL your code.

See why here :- http://snippets-r-us.com/

A reminder is here:- https://www.youtube.com/watch?v=tdQL_7osGzc

Heromann

Right, nice vid. Indeed I forgot to copy the empty loop.

Do you have any clue why the serial transmission of AT commands is successful only after a sketch upload?

Grumpy_Mike

Quote
Indeed I forgot to copy the empty loop.
And the variable declarations. And any libraries you may or not have included.

Reply #5? Did you try that?

Is your modem being power cycled?

Heromann

I stripped my original sketch to eliminate other interference. There is no need for libs or vars in this simple example.

I tried #5, same effect; immediately after sketch upload it is working fine. But when power cycle, reset or external power is used the AT commands are not send. Only when the sketch is uploaded again it works. Could it be something which configured/set on the serial port by the uploading sequence?

Grumpy_Mike

#10
Oct 20, 2017, 12:49 pm Last Edit: Oct 20, 2017, 12:51 pm by Grumpy_Mike
You do not need to upload code again. We here this from beginners many times and they are always mistaken.

Quote
There is no need for libs or vars in this simple example.
Yes their is as your code as posted will not compile, so how can we try it?
As you choose not to cooperate with simple requests I guess you are in your own.

Go Up