Skip to content

Commit 94167d6

Browse files
committed
Allow more startup time for booting device
1 parent 5f9e265 commit 94167d6

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

bootloaders/uart/uart_boot.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ int main()
185185
// Reset chip
186186
reset_chip();
187187

188+
int attempts = 0;
188189

189190
while (true) {
190191
char splash[] = "RP2350";
@@ -204,13 +205,20 @@ int main()
204205
if (ptr && strncmp(ptr, splash, sizeof(splash) - 1) == 0) {
205206
printf("Splash found\n");
206207
uart_boot();
208+
attempts = 0;
207209
} else {
208210
ptr = memchr(buf, hello[0], sizeof(buf));
209211
if (ptr && strncmp(ptr, hello, sizeof(hello) - 1) == 0) {
210212
printf("Device is running\n");
211213
} else {
212-
printf("Device not running - attempting reset\n");
213-
reset_chip();
214+
if (attempts > 3) {
215+
printf("Device not running - attempting reset\n");
216+
reset_chip();
217+
attempts = 0;
218+
} else {
219+
printf("Device not running - waiting\n");
220+
attempts++;
221+
}
214222
}
215223
}
216224
sleep_ms(1000);

0 commit comments

Comments
 (0)