Hi Guys,
I've been working with this library and it is working on SAMD51. I'm not sure if this issue exists on SAMD21, but I am unable to get the watchdog timer to function while freertos tasks are running. The board it is being tested on is an Adafruit Feather M4. Any idea why this breaks it and I wonder if it happens on a SAMD21?
`#include <FreeRTOS_SAMD21.h>
#define SERIAL Serial
//**************************************************************************
// global variables
//**************************************************************************
TaskHandle_t Handle_aTask;
//**************************************************************************
// Can use these function for RTOS delays
// Takes into account procesor speed
//**************************************************************************
void myDelayMs(int ms)
{
vTaskDelay( (ms * 1000) / portTICK_PERIOD_US );
}
void setup(){
vNopDelayMS(1000); // prevents usb driver crash on startup, do not omit this
Serial.begin(9600);
while(!Serial);
//vTaskStartScheduler seems to break WDT:
xTaskCreate(aTask, "aTask task", 256, NULL, tskIDLE_PRIORITY + 1, &Handle_aTask);
vTaskStartScheduler();
//WDT enabled here
REG_WDT_CONFIG = WDT_CONFIG_PER_CYC4096_Val;
REG_WDT_CTRLA = WDT_CTRLA_ENABLE; // Enable the WDT in normal mode
while(WDT->SYNCBUSY.bit.ENABLE);
}
static void aTask( void *pvParameters )
{
for(;;) {
//if (!WDT->SYNCBUSY.bit.CLEAR) REG_WDT_CLEAR = WDT_CLEAR_CLEAR_KEY; // Clear the watchdog timer
Serial.println("aTask");
myDelayMs(100);
}
}
void loop(){
Serial.println("mainLoop");
delay(100);
}`
Hi Guys,
I've been working with this library and it is working on SAMD51. I'm not sure if this issue exists on SAMD21, but I am unable to get the watchdog timer to function while freertos tasks are running. The board it is being tested on is an Adafruit Feather M4. Any idea why this breaks it and I wonder if it happens on a SAMD21?
`#include <FreeRTOS_SAMD21.h>
#define SERIAL Serial
//**************************************************************************
// global variables
//**************************************************************************
TaskHandle_t Handle_aTask;
//**************************************************************************
// Can use these function for RTOS delays
// Takes into account procesor speed
//**************************************************************************
void myDelayMs(int ms)
{
vTaskDelay( (ms * 1000) / portTICK_PERIOD_US );
}
void setup(){
vNopDelayMS(1000); // prevents usb driver crash on startup, do not omit this
Serial.begin(9600);
while(!Serial);
//vTaskStartScheduler seems to break WDT:
xTaskCreate(aTask, "aTask task", 256, NULL, tskIDLE_PRIORITY + 1, &Handle_aTask);
vTaskStartScheduler();
//WDT enabled here
REG_WDT_CONFIG = WDT_CONFIG_PER_CYC4096_Val;
REG_WDT_CTRLA = WDT_CTRLA_ENABLE; // Enable the WDT in normal mode
while(WDT->SYNCBUSY.bit.ENABLE);
}
static void aTask( void *pvParameters )
{
for(;;) {
//if (!WDT->SYNCBUSY.bit.CLEAR) REG_WDT_CLEAR = WDT_CLEAR_CLEAR_KEY; // Clear the watchdog timer
Serial.println("aTask");
myDelayMs(100);
}
}
void loop(){
Serial.println("mainLoop");
delay(100);
}`