I want to communicate data with M5stack Core2 and COM.Sigfox.



  • Hello. I bought M5stack Core2 and COM.Sigfox. I want to use this for data communication.
    I was able to register the module in the sigfox backend. But I can't communicate or call back.
    When I use M5stack Basic and COM.Sigfox,I can do data communication and callbacks.
    Is there something wrong with my sketch?

    #include <M5Core2.h>
    
    void setup() {
     M5.begin(true, false, true);
     Serial2.begin(9600, SERIAL_8N1, 13, 14);
     Serial.begin(9600);
     }
    
    void loop() {
     int val = 11223344;
     String msg = String(val, HEX);
     Serial.print( msg);  Serial.println(" msg ");
     Serial2.print("AT$SF=" + msg);
     Serial.print("AT$SF=" + msg);  Serial.println(" AT$SF= msg ");
     delay(15*1000);
    }
    


  • Hello @takero

    in this example sending a command uses Serial2.write("AT$SF=00FFEE\r\n"); instead of print(). In another example I found println() was used.

    I have a feeling the COM.Sigfox module would like a \r\n as a line end. (But that is just a guess as I don't have that module and cannot test myself.)

    Good luck!
    Felix



  • @felmue
    Thank you for suggestion Felix. And Sorry for my late reply.
    I tried Serial2.println("AT$SF=" + msg );.
    or Serial2.println("AT$SF= + msg ");.

    and Serial2.write("AT$SF= + msg ");.
    or Serial2.write("AT$SF=" + msg );.

    But I couldn't communicate.
    If you have new tips, I would love to try.

    Thank you.



  • Hello @takero

    have you tried the example I've mentioned? This should read and display the SigfoxID and PACNumber and if successful would tell you the hardware is ok.

    Note: for M5Core2 you'll need to adapt rxPin to 13 and txPin to 14 as before.

    Thanks
    Felix



  • @felmue Thank you.
    I tried your sample. I succeeded in compiling.
    But I can't write to core2 since yesterday.

    Displayed "A fatal error occurred: Failed to connect to ESP32: Timed out Waiting for packet header"

    Both of the Core2 I have are like that. Did my Core 2 break?
    I just wrote a sketch.

    Thank you.



  • Hello @takero

    sorry to hear. It's very unlikely that both of your M5Core2 devices just broke like that. Some suggestions:

    • Have you tried a different USB cable?
    • Have you tried a different USB port?
    • Have you tried closing and reopening your software?
    • Have you tried to reboot your computer?

    Thanks
    Felix



  • Thank you @felmue .I have tried your suggestion.

    Have you tried a different USB cable? :Yes I did.
    Have you tried a different USB port? :Yes I did.
    Have you tried closing and reopening your software? :Yes I did.
    Have you tried to reboot your computer? :Yes I did.

    However, I got an error. Isn't my Core 2 broken ?

    I tried another sketch and the result was the same.
    At that time, I connected the actual sensor.
    DHT22 to GPIO72.
    DS18B20 to GPIO26.
    Analog sensor to GPIO36.
    Is that not good?
    Thank you.



  • Hello @takero

    until you have figured out the issue regarding flashing a sketch (any sketch) onto your M5Core2, I'd do the following:

    • only connect the USB cable to your computer
    • disconnect everything else
    • try flashing a sketch
      If that doesn't work, then maybe your M5Core2 has been damaged (still very unlikely though).
      Thanks
      Felix


  • @felmue
    While I was writing to Core 2, I pressed the power button for a long time and the writing was successful.

    Thank you.