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();
}
}

