Pages: [1]   Go Down
Author Topic: Data incoming via SoftwareSerial not detected  (Read 339 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 38
Don't eat yellow snow.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi

I'm currently building a logger using a Seeduino Stalker v2.3 and GPRS shield V2. I also use an SD card for saving log data and long strings. The sending and receiving of GPRS data is done with SoftwareSerial. I attached all relevant code. I've been successfully testing this device, adding bits of code for extra functionality. I am logging the level changes on two pins.

I have now reached a point where I want to start wrapping the project up, but now I am encountering a weird issue.
The program gets past the setup function, doing a thorough diagnostic routine. Then it enters the loop. The loop has 5 parts: First it makes sure I'm not stuck in an incorrect state. Then it goes through a switch that controls the action to be taken for each state. Then it logs(if neccesary). Then it checks if the GPRS shield has anything waiting in it's buffer.

This is the point where I am encountering problems: the command GPRS.available() isn't acting the way it should. I loaded my program onto the Stalker, allowed it to start, and called the GPRS shield with my phone. Even though I can hear it ringing on my phone, there is no reaction on my serial monitor. I know the program isn't stuck, because the watchdog timer would restart it, and I tested it with printouts. It also still logs exactly the way it should.

Note: I test the GPRS SoftwareSerial port right at the beginning of the program by sending "AT" and waiting for it to reply "OK". I also tested my setup with a simpler sketch("Basic AT").
File_maker creates all the files required for the successful operation.
Bluegum_logger_2 has worked correctly in the past. The problem started when I did some minor edits. I have tried to reverse most of this.

Please take a look. Is this a memory issue? Or a bug in SoftwareSerial? I am very frustrated.

Thanks

* Basic_AT.ino (1.11 KB - downloaded 5 times.)
* Bluegum_Logger_2.ino (20.82 KB - downloaded 6 times.)
* File_maker_forum.ino (1.37 KB - downloaded 3 times.)
« Last Edit: July 20, 2013, 08:17:53 am by snugRugBug » Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 64
Posts: 6889
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

What are the relationships among the three files? They each have setup and loop so can't run on the same arduino.

Looks like you have atmega328p so 2KB sram. From my personal experience, SD library will take away a huge chunk leaving almost nothing for other stuff. You also have lots of c-strings to take up SRAM. If you have a mega 2560, load your code to it and see if you can run it or not. Try the freemem library to see if you really have run out of memory.

http://playground.arduino.cc/Code/AvailableMemory
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 38
Don't eat yellow snow.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi liudr

Basic_AT.ino is a sketch that tests the AT capabilities of my setup. It works like a command line via the serial line, and I can use it to enter AT commands, as well as receive responses. This sketch is there just to illustrate roughly how the AT-side of my setup functions. I also mentioned that when I test my setup with this sketch, it behaves correctly.

Bluegum_Logger_2.ino is my main project and the source of all my problems.

File_maker_forum.ino is used to create all the files on the SD card Bluegum_Logger needs to work.

I will start to run a few memory tests, to see if that is my problem. I cannot do tests with the mega 2560. I only have access to Stalkers.

Thanks so far
« Last Edit: July 22, 2013, 10:59:33 am by snugRugBug » Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 64
Posts: 6889
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Try the one with file preparation. You will be surprised at how much memory SD library uses. My recollection was a bit more than 1KB.
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 38
Don't eat yellow snow.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi

Sorry if I haven't been here for a while, been busy...

I think I have found the source (and a possible solution) of this problem. It seems that my gprsReset() function sends the communication GPRS shield into some kind of brownout state. How and why exactly this happens is a topic on its own.

I am able to get the GPRS shield out of this state by sending the "AT" AT command, which is basically just a test command that returns "OK". Once this has been done, I am able to pick up incoming transmissions just fine. At the moment, my solution to the problem is to just send "AT" down the line every 20 seconds.

Just btw, I did run some memory tests on the sketch, and I always had around 700 bytes free, so I don't think that is a problem at the moment...

Thanks liudr  smiley
Logged

Pages: [1]   Go Up
Jump to: