PlatformIO Community

SAMD21 (Zero) Chip bricked after upload

Hello,

I was trying to make my own library. But it goes wrong ^^
I am not the C++ pro. I am learning but this way was to hard.

That are my library files:

.h

#ifndef SRS_Module_h
#define SRS_Module_h

#include “Arduino.h”

struct settings_t{
settings_t();
bool debug;
bool DHCP;
int FadeTime;
int IP1;
};

extern settings_t settings;

class Configs
{
public:
void write(bool flasheeprom);
void read();
private:
bool _flasheeprom;
};

#endif

.cpp

#include <extEEPROM.h>
#include “SRS_Module.h”

extEEPROM myEEPROM(kbits_2, 1, 16, 0x50);

settings_t::settings_t()
{
debug = true;
DHCP = false;
FadeTime = 1;
IP1 = 192;
}

settings_t settings;

byte i2cStat = myEEPROM.begin(myEEPROM.twiClock100kHz);

void Configs::write(bool _flash)
{
int EEPROMnew = myEEPROM.read(255);
if (EEPROMnew != 50 || _flash == true){
myEEPROM.write(0, settings.debug);
myEEPROM.write(1, settings.DHCP);
myEEPROM.write(2, settings.FadeTime);
myEEPROM.write(3, settings.IP1);
}
}

After uploading the SAMD21 (Arduino Zero) chip was bricked. No USB was found, No erase with Atmel Studio possible.
It tooks 3 broken Chips to find out if I delete this line all is good.

byte i2cStat = myEEPROM.begin(myEEPROM.twiClock100kHz);

What make I wrong? I must start EEPROM that I can use the functions in the library. If I put this all in the mainfile withou my library all is working.

Regards
Steffen