Skip to content

Commit 5620800

Browse files
committed
Allow 100ms delay after chip reset to avoid some linux kernel lock-ups.
1 parent 0012a5c commit 5620800

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

src/Samba.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -628,28 +628,28 @@ Samba::chipInfo()
628628
void
629629
Samba::reset(void)
630630
{
631-
632-
uint32_t chipId = Samba::chipId();
633-
634-
//If it's SAMD21G18 or SAMD21J18
635-
if(chipId == 0x10010000 || chipId == 0x10010005) {
636-
//The following write resets the controller.
637-
//More info : http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0484c/index.html
638-
writeWord(0xE000ED0C,0x05FA0004);
639-
return;
640-
}
641-
642-
//Now do the rest
643-
644-
645-
if (chipId != 0x285e0a60) {
646-
printf("Reset not supported for this CPU");
647-
return;
648-
}
631+
printf("CPU reset.\n");
649632

633+
uint32_t chipId = Samba::chipId();
650634

651-
printf("CPU reset.\n");
652-
writeWord(0x400E1A00, 0xA500000D);
635+
switch (chipId)
636+
{
637+
// SAMD21G18 or SAMD21J18
638+
case 0x10010000:
639+
case 0x10010005:
640+
// http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0484c/index.html
641+
writeWord(0xE000ED0C, 0x05FA0004);
642+
break;
643+
644+
// SAM3X8E
645+
case 0x285e0a60:
646+
writeWord(0x400E1A00, 0xA500000D);
647+
break;
648+
649+
default:
650+
printf("Reset not supported for this CPU.\n");
651+
return;
652+
}
653653

654654
// Some linux users experienced a lock up if the serial
655655
// port is closed while the port itself is being destroyed.

0 commit comments

Comments
 (0)