Possible bug in FreeRTOS and AtWiFi Arduino library

I am trying to implement FreeRTOS with WiFi feature. However, I find that the task cannot be created even if I only include the AtWiFi.h. Here is the code:

#include <Seeed_Arduino_FreeRTOS.h>
//#include <AtWiFi.h> // Uncomment this and try again
 
TaskHandle_t Handle_aTask;
TaskHandle_t Handle_bTask;
 
static void ThreadA(void* pvParameters) {
    Serial.println("Thread A: Started");
 
    while (1) {
        Serial.println("Hello World!");
        delay(1000);
    }
}
 
static void ThreadB(void* pvParameters) {
    Serial.println("Thread B: Started");
 
    for (int i = 0; i < 10; i++) {
        Serial.println("---This is Thread B---");
        delay(2000);
    }
    Serial.println("Thread B: Deleting");
    vTaskDelete(NULL);
}
 
void setup() {
 
    Serial.begin(115200);
 
    vNopDelayMS(1000); // prevents usb driver crash on startup, do not omit this
    while(!Serial);  // Wait for Serial terminal to open port before starting program
 
    Serial.println("");
    Serial.println("******************************");
    Serial.println("        Program start         ");
    Serial.println("******************************");
 
    // Create the threads that will be managed by the rtos
    // Sets the stack size and priority of each task
    // Also initializes a handler pointer to each task, which are important to communicate with and retrieve info from tasks
    xTaskCreate(ThreadA,     "Task A",       256, NULL, tskIDLE_PRIORITY + 2, &Handle_aTask);
    xTaskCreate(ThreadB,     "Task B",       256, NULL, tskIDLE_PRIORITY + 1, &Handle_bTask);
 
    // Start the RTOS, this function will never return and will schedule the tasks.
    vTaskStartScheduler();
}
 
void loop() {
    // NOTHING
}

As you uncomment the AtWiFi.h include and flash it into Wio Terminal, you will only see the output stucks at:

******************************
        Program start         
******************************

, instead of going forward. It seems that xTaskCreate cannot be called.
What makes it worse, the uploading will not be available anymore as it will stuck at “uploading” stage, whose solution is to download Ardupy firmware into it and then flash the normal Arduino code.

Any ideas?

There is a problem in this area and we are working to fix it. Sorry for the bad experience.

Thanks. Looking forward to the fixed update! :smiley: