GPRSbee and time lib not working on the Seeeduino Stalker

I have problems to run the GPRSbee with the RTC lib. As hardware I’m using the latest GPRSbee with a Seeeduino Stalker v2.3 as board. This basic example sketch is working without including

Wire.begin();

After including the initialization of wire the sketch sends out one httpget request but after this the GPRSbee led is fast flashing and no second or ongoing gprsbee.doHTTPGET is done. I have tried the initial Seeeduino Stalker lib, but also the Sodaq_DS3231 lib.

What is wrong with the GPRSbee lib and the RTC lib? Why are there conflicts and what kind of? I have an data logging sketch with a RFM69 module wake up triggered by an RTC IRQ and sleep mode in between. I had expected I can switch to the GPRSbee easily but something is going wrong. Why does the RTC mess up the GPRSbee communication / code?

// GSM / GPRSbee
#include <GPRSbee.h>

// fill in your own APN here
#define APN "internet.eplus.de"

static const uint8_t BEEDTR = 18;
static const uint8_t BEECTS = 19;

// RTC 
#include <Wire.h>    // I2C (for RTC)
//old/other Seeeduino Stalker RTC lib 
//#include <DS3231.h>  // RTC itself 
#include <Sodaq_DS3231.h>  // RTC itself 

//needed for old/other Seeeduino Stalker RTC lib 
//DS3231 RTC;                     // create RTC object for DS3231

// we need some variable as char to pass it to payload easily 
char timestampChar[20];  // should handle yyyy/mm/dd hh:mm:ss and null terminator 


void setup() { 
  // Serial for GPRSbee 
  Serial.begin(19200);

  // pin 5 is a fake pin, we do not need it but the lib requires it 
  // use an unused pin for this!
  gprsbee.initAutonomoSIM800(Serial, BEEDTR, 5, BEECTS);
  // make sure the GPRSbee is switched off to begin with
  gprsbee.off();

  // rtc, irq 
  Wire.begin(); //  <- with this included the sektch is working no more !!
  rtc.begin();  
}

void loop() {
  char buffer[200];
  memset(buffer, 0, sizeof(buffer));
  gprsbee.doHTTPGET(APN, "http://domain.org/upload.php?dataset=2016-03-23%20test%203", buffer, sizeof(buffer));
  gprsbee.off();
  
  delay(10*1000UL);
}

Not an immediate answer to your problem, but …

Prototype of initAutonomoSIM800 is:

  void initAutonomoSIM800(Stream &stream, int vcc33Pin, int onoffPin, int statusPin,
      int bufferSize=SIM900_DEFAULT_BUFFER_SIZE);

If you are sure that you don’t need the onoffPin you should pass it as -1.

From your description (I don’t know anything about Seeduino Stalker) it sounds like there is a problem with the RTC. By leaving out Wire.begin() it probably does not activate the RTC.

The GPRSbee doesn’t use Wire at all, and thus no RTC either. There shouldn’t be any conflict. We have lots of sketches that use both GPRSbee and Sodaq_DS3231.

Have you tried a sketch that only uses the RTC?

Yes, I have tried several sketches with RTC code and all is working as expected (in case I do not use GPRSbee in parallel): setting time, fetch time, also wakeup via IRQ is working. But to cut down complexity I tried to add the problematic code step by step. I think also the I2C/wire lib itself will not cause the problem but the RTC code.

As described, the first attempt is always successful an gprsbee.doHTTPGET is working, but only for the first time. saw some wdt_reset code in the GPRS lib but have no idea if this can cause the problem.

Sometimes I got a second successful result but the reported date (other code as in the first posting) is something like 2000/01/23 00:00:80 and after some–in the most times 3 to 4–updates I got on the server the sketch doesn’t go on.

Just to be sure to have no mismatch in the variable order, I found in

void GPRSbeeClass::initAutonomoSIM800(Stream &stream, int pwrkeyPin, int vbatPin, int statusPin,
    int bufferSize)

and I think it is correct because it is working on my side. Is your code an older example or is there vcc33Pin and onoffPin interchanged?

Btw this is the debug information I get for the sketch in the initial posting. I get two times “off powerPin
off vbatPin”, without the RTC code I got it ony once

It seems that the connection / GPRSbee is not correct switched off. About “>> AT+SAPBR=1,1 > ERROR” some wrote also that it could be because a connection was already made:
http:// electronics.stackexchange.com/questions/132267/sim900-error-on-at-command-atsapbr-1-1

But what does it have to do with the RTC??

OK
>> AT+HTTPPARA="CID",1

OK
>> AT+HTTPPARA="URL","http://domain.org/upload.php?dataset=2016-03-23%2015:08,63.303,59.4,14.5,65.5,3.3,4.1"

OK
>> AT+HTTPACTION=0

OK

+HTTPACTION: 0,200,68
>> AT+HTTPREAD

+HTTPREAD: 68

OK
>> AT+HTTPTERM

OK
off powerPin
off vbatPin
off powerPin
off vbatPin
>> AT

OK
>> AT+CIURC=0

OK
>> ATE0

OK
>> AT+CSQ

+CSQ: 18,0

OK
>> AT+CREG?

+CREG: 0,1

OK
>> AT+SAPBR=3,1,"CONTYPE","GPRS"

OK
>> AT+SAPBR=3,1,"APN","internet.eplus.de"

OK
>> AT+SAPBR=1,1

ERROR
>> AT+SAPBR=1,1

ERROR
>> AT+SAPBR=1,1

ERROR
>> AT+SAPBR=1,1

ERROR
>> AT+SAPBR=1,1

ERROR
doHTTPGET failed!
off powerPin
off vbatPin
off powerPin
off vbatPin

Yeah, sorry. You’re right.
I have a newer version which has many changes only to make it more compatible with Sodaq_3Gbee.
I probably should publish my new version, so that everyone can enjoy :slight_smile:

I get two times “off powerPin off vbatPin”, without the RTC code I got it ony once

That reason for that is that doHTTPGET is also doing an off()

I guess it shouldn’t, but I’m not sure. Perhaps you can try to disable it.
We only have sketches with enabled watchdog.

I have now only included in the head
#include <Wire.h> // I2C (for RTC)

and in setup
Wire.begin();

I commented out all RTC stuff
//#include <Sodaq_DS3231.h> // RTC itself
//rtc.begin();

and the problem still exists. So … I’m feeling a bit stupid now because I used
BEEDTR = 18;
BEECTS = 19;

This is A4, A5 on the Pro Mini and SDA and SCL for I2C ! Here you are “conflict”. Sometimes the human factor is really crazy especially if you are the one …

Thanks for your patience!

Ah, OK. Thanks for letting us know