As a showstopper for a new product, the minimal code example below freezes 30 secs after going online.
It does this on both B523 product HW , B SOM evaluation board (B523), and an Argon (change watchdog pin to unused pin). All running OS2.0.1 and connected to an FRAM (Adafruit for the dev boards).
Building with the Web IDE with MB85RC256V-FRAM-RK (0.0.5), PublishQueueAsyncRK (0.2.0) and for OS 2.0.1 it resets. Building for OS1.5.2 and uploading to OS2.0.1 devices all is well.
I have tried retained memory instead, on the product HW and it does the same: Reset when built for 1.5.2 and ok when built for 2.0.1, and in both cases uploaded to 2.0.1 devices.
In a trace the last thing that happens is PublishQueueAsyncRK is storing the data.
Hoping someone can spot a bug or knows of a work-around for 2.0.1?
#include <MB85RC256V-FRAM-RK.h>
#include <PublishQueueAsyncRK.h>
SYSTEM_MODE(SEMI_AUTOMATIC)
SYSTEM_THREAD(ENABLED);
SerialLogHandler logHandler;
MB85RC512 fram(Wire, 0);
// retained uint8_t publishQueueRetainedBuffer[2048]; // Out of 3068 bytes total
// PublishQueueAsync publishQueue(publishQueueRetainedBuffer, sizeof(publishQueueRetainedBuffer));
PublishQueueAsyncFRAM publishQueue(fram, 8192, 16383);
//PublishQueueAsyncFRAM publishQueue(fram, 0, 8192);
static char buf[620]; // Particle.publish data (up to 255 characters (prior to 0.8.0), 622 characters (since 0.8.0))
static unsigned long lastUploadTime = 0;
const pin_t WATCHDOG_PIN = D22;
void setup() {
pinMode(WATCHDOG_PIN, OUTPUT);
fram.begin();
publishQueue.setup();
publishQueue.setPausePublishing(true);
Particle.process();
Particle.connect();
}
void loop() {
if (Particle.connected() && Time.isValid()){}
else lastUploadTime = millis();
if (((millis() - lastUploadTime) >= 30*1000)) UpdateServer();
digitalWrite(WATCHDOG_PIN, !digitalRead(WATCHDOG_PIN));
}
int UpdateServer(void){
Log.trace("UpdateServer()");
snprintf(buf, sizeof(buf), "{\"T\":\"2021-02-02T12:51:03Z\",\"R\":-72,\"I\":60,\"D\":\"{}\"}");
publishQueue.publish("HLP1up", buf, 60, PRIVATE, WITH_ACK);
}