Watchdog timer with I2S

I try to run a watchdog timer together with the I2S bus.
Seperate they work fine, toghter they don't.

The I2S data is wired from the modems I2S_RXD to the cpu PA07.
The I2S clock is wired from to I2S_CLK to PA10.
The I2S word select is wired to PA11.

I'm reading the I2S bus with 16 kHz in 32 bit.

Everything works fine until i attach a watchdog timer (with every lib i can find) on the cpu's internal watchdog timer:

From my perspective i see no reason for troubles but it is just not reading the bus:

 while (vcs.getvoiceCallStatus() == TALKING)
    {
      I2S.read();
    }

I think it's a hardware issue within the SAMD21.

Can a hardware guru or someone else enlighten me?

Thank you in advance

PS: The whole sketch with the sodaq watchdog lib (the behaviour is the same with wdt_zero etc.):


#include <MKRGSM.h>

#include "Sodaq_wdt.h"

#include "arduino_secrets.h"
// Please enter your sensitive data in the Secret tab or arduino_secrets.h
// PIN Number
const char PINNUMBER[] = SECRET_PINNUMBER;

// initialize the library instance

GSM gsmAccess(true);
GSMVoiceCall vcs;

// Array to hold the number for the incoming call
char numtel[20];

void setup() {
  // initialize serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }
  sodaq_wdt_enable(WDT_PERIOD_8X);
  Serial.println("Receive Voice Call Test");

  // start I2S at 16 kHz with 32-bits per sample
  if (!I2S.begin(I2S_PHILIPS_MODE, 16000, 32)) {
    Serial.println("Failed to initialize I2S!");
    while (1); // do nothing
  }
  Serial.println("I2S initialisiert");
  // connection state

  bool connected = false;

  // Start GSM shield
  // If your SIM has PIN, pass it as a parameter of begin() in quotes
  while (!connected) {
    if (gsmAccess.begin(PINNUMBER) == GSM_READY) {
      connected = true;
    } else {
      Serial.println("Not connected");
      delay(1000);
    }
  }

  // This makes sure the modem correctly reports incoming events
  vcs.hangCall();
  vcs.enableI2SInput(16000);
  vcs.ready();
  Serial.println("Waiting for a call sketch");
}

void loop() {

  // Check the status of the voice call
  if (vcs.getvoiceCallStatus() == RECEIVINGCALL)
  {
    vcs.retrieveCallingNumber(numtel, 20);

    // Print the calling number
    Serial.print("Number:");
    Serial.println(numtel);

    vcs.answerCall();
  }

  if (vcs.getvoiceCallStatus() == TALKING)

  {
    Serial.println("TALKING");
    while (vcs.getvoiceCallStatus() == TALKING)
    {
      I2S.read();
    }
    vcs.hangCall();

  }

}

Where do you reset (feed/kick) the dog?

Sorry, i did a cmd-z recovery of my sketch and pasted it too early in this forum. There was a reset.
sodaq_wdt_reset();

The topic is that when the SAMD21 watchdog timer is set, the I2S is not readable anymore.
With every watchdog lib i tried.

Why? Is there a way to make both things happen?

And do you reset the WDT properly?

If you don't reset it here and someone is taking too long the WDT will fire.

Yes, i did, trust me on this. I had the same issue with the wdt_zero lib and pushed a issue on github some time ago:

Since then there's no answer to this issue #9.

Now i'm facing the same problem again that's why i opened this topic.

Thank you for your effort!

For those who follow or will find this topic in the future:

This solves the problem. I don't know why aentinger added this to the merge and then removed it again. I will ask on github.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.