UnaBiz / unabiz-arduino

Arduino library for connecting UnaShield to SIGFOX network
https://unabiz.github.io/unashield/
GNU General Public License v3.0
26 stars 26 forks source link

Unable to send message/ handshake I was able to send from day I purchase the shield now i can't #4

Open kenken64 opened 5 years ago

kenken64 commented 5 years ago

image

image

//  Send sample SIGFOX messages with UnaBiz UnaShield V2S Arduino Shield.
//  This sketch includes diagnostics functions in the UnaShield.
//  For a simpler sample sketch, see examples/send-light-level.
#include "SIGFOX.h"

//  IMPORTANT: Check these settings with UnaBiz to use the SIGFOX library correctly.
static const String device = "g88pi";  //  Set this to your device name if you're using UnaBiz Emulator.
static const bool useEmulator = false;  //  Set to true if using UnaBiz Emulator.
static const bool echo = true;  //  Set to true if the SIGFOX library should display the executed commands.
static const Country country = COUNTRY_SG;  //  Set this to your country to configure the SIGFOX transmission frequencies.
static UnaShieldV2S transceiver(country, useEmulator, device, echo);  //  Uncomment this for UnaBiz UnaShield V2S / V2S2 Dev Kit
//static UnaShieldV1 transceiver(country, useEmulator, device, echo);  //  Uncomment this for UnaBiz UnaShield V1 Dev Kit

void setup() {  //  Will be called only once.
  //  Initialize console so we can see debug messages (9600 bits per second).
  Serial.begin(9600);  Serial.println(F("Running setup..."));  
  //  Check whether the SIGFOX module is functioning.
  if (!transceiver.begin()) stop(F("Unable to init SIGFOX module, may be missing"));  //  Will never return.

  //  Send a raw 12-byte message payload to SIGFOX.  In the loop() function we will use the Message class, which sends structured messages.
  transceiver.sendMessage("0102030405060708090a0b0c");

  //  Delay 10 seconds before sending next message.
  Serial.println(F("Waiting 10 seconds..."));
  delay(10000);
}

void loop() {  //  Will be called repeatedly.
  //  Send message counter, temperature and voltage as a structured SIGFOX message, up to 10 times.
  static int counter = 0, successCount = 0, failCount = 0;  //  Count messages sent and failed.
  Serial.print(F("\nRunning loop #")); Serial.println(counter);

  //  Get temperature and voltage of the SIGFOX module.
  float temperature;  float voltage;
  transceiver.getTemperature(temperature);
  transceiver.getVoltage(voltage);

  //  Convert the numeric counter, temperature and voltage into a compact message with binary fields.
  Message msg(transceiver);  //  Will contain the structured sensor data.
  msg.addField("ctr", counter);  //  4 bytes for the counter.
  msg.addField("tmp", temperature);  //  4 bytes for the temperature.
  msg.addField("vlt", voltage);  //  4 bytes for the voltage.
  //  Total 12 bytes out of 12 bytes used.

  //  Send the message.
  if (msg.send()) {
    successCount++;  //  If successful, count the message sent successfully.
  } else {
    failCount++;  //  If failed, count the message that could not be sent.
  }
  counter++;

  //  Send only 10 messages.
  if (counter >= 10) {
    //  If more than 10 times, display the results and hang here forever.
    stop(String(F("Messages sent successfully: ")) + successCount +
                   F(", failed: ") + failCount);  //  Will never return.
  }

  //  Delay 10 seconds before sending next message.
  Serial.println("Waiting 10 seconds...");
  delay(10000);
}
albertomannil commented 5 years ago

I had similar issue yesterday with another device. Am unable to send message. Device stops at same ATS410 command.

pedromoter commented 5 years ago

Having a similar issue, mine simply stops at Send Message and never continues.

IMG_1262

IMG_1263

albertomannil commented 5 years ago

Hola Pedro, Share with me your code so I can try on another module here at the office.

On Thu, Oct 31, 2019 at 11:07 AM Pedro Moter notifications@github.com wrote:

Having a similar issue, mine simply stops at Send Message and never continues.

[image: IMG_1262] https://user-images.githubusercontent.com/10541029/67959011-78cc4b00-fbce-11e9-8723-160340159f3c.PNG

[image: IMG_1263] https://user-images.githubusercontent.com/10541029/67959052-8681d080-fbce-11e9-920e-08f81fe0e57b.PNG

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/UnaBiz/unabiz-arduino/issues/4?email_source=notifications&email_token=ANEOCGS3SQGGDAJY7A5CBDLQRLYCPA5CNFSM4G25MGI2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECYDZXQ#issuecomment-548420830, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANEOCGU5YBGPDZFCAOWIIXDQRLYCPANCNFSM4G25MGIQ .

pedromoter commented 5 years ago

Poseidon-master.zip Dear Alberto,

I would really appreciate it if you could test on an additional board.

The only issue you might have is simulating the Interrupts on D2.

The file is the one inside the folder TestV1.

Please let me know what you obtain. Thanks

pedromoter commented 5 years ago

I was able to go around the issue by not using interrupts. For some reason even after making the function that called the Sigfox board atomic, taking it out of the interrupt and putting it on the main loop fixed it.