Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/D2xNvmFlash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,23 @@ D2xNvmFlash::writePage(uint32_t page)
void
D2xNvmFlash::waitReady()
{
while ((readReg(NVM_REG_INTFLAG) & 0x1) == 0);
uint32_t ReadR;
int count = 0;
int maxTries = 3;
do{
try
{
ReadR = (readReg(NVM_REG_INTFLAG) & 0x1);
}
catch(const SambaError& e)
{
count++;
if ( count == maxTries){
throw ::SambaError();
};
}

}while(ReadR == 0);
}

void
Expand Down
33 changes: 32 additions & 1 deletion src/Device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,38 @@ Device::create()
_family = FAMILY_SAMD21;
flashPtr = new D2xNvmFlash(_samba, "ATSAMD21x18", 4096, 64, 0x20004000, 0x20008000) ;
break;

//
// SAMC21
//
case 0x1101000D: //E15A
case 0x11010008: //G15A
case 0x11010003: //J15A
_family = FAMILY_SAMC21;
flashPtr = new D2xNvmFlash(_samba, "ATSAMC21x15", 512, 64, 0x20000800, 0x20001000) ;
break;
case 0x1101000C: //E16A
case 0x11010007: //G16A
case 0x11010002: //J16A
_family = FAMILY_SAMC21;
flashPtr = new D2xNvmFlash(_samba, "ATSAMC21x16", 1024, 64, 0x20001000, 0x20002000) ;
break;

case 0x1101000B: //E17A
case 0x11010006: //G17A
case 0x11010021: //N17A
case 0x11010001: //J17A
_family = FAMILY_SAMC21;
flashPtr = new D2xNvmFlash(_samba, "ATSAMC21x17", 2048, 64, 0x20002000, 0x20004000) ;
break;

case 0x1101000A: //E18A
case 0x11010005: //G18A
case 0x11010000: //J18A
case 0x11010020: //N18A
_family = FAMILY_SAMC21;
flashPtr = new D2xNvmFlash(_samba, "ATSAMC21x18", 4096, 64, 0x20004000, 0x20008000) ;
break;

//
// SAMR21
//
Expand Down
2 changes: 2 additions & 0 deletions src/Device.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ class Device

FAMILY_SAM9XE,

FAMILY_SAMC21,

FAMILY_SAMD21,
FAMILY_SAMR21,
FAMILY_SAML21,
Expand Down