-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding Raspberry Pi RP2040 as a target test
- Loading branch information
David Bryan
committed
Aug 5, 2022
1 parent
7dd525e
commit 0a894eb
Showing
2 changed files
with
113 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
|
||
int Reset = D2; | ||
int GREEN_LED = D0; | ||
int RED_LED = D1; | ||
|
||
void setup() { | ||
// put your setup code here, to run once: | ||
digitalWrite(Reset, HIGH); | ||
delay(200); | ||
pinMode(Reset, OUTPUT); | ||
Serial.begin(115200); // open the serial port at 115200 | ||
Serial.print("Serial port setup\n"); | ||
pinMode(LED_BUILTIN, OUTPUT); | ||
digitalWrite(LED_BUILTIN, HIGH); | ||
pinMode(GREEN_LED, OUTPUT); | ||
pinMode(RED_LED, OUTPUT); | ||
digitalWrite(GREEN_LED, HIGH); | ||
delay(1000); | ||
digitalWrite(LED_BUILTIN, LOW); | ||
digitalWrite(GREEN_LED, LOW); | ||
digitalWrite(RED_LED, HIGH); | ||
} | ||
|
||
void loop() | ||
{ | ||
#define RUN_CNT 1000 | ||
#define OUTER_LOOP_CNT 1000 | ||
#define INNER_LOOP_CNT 1000 | ||
|
||
//Serial.print("Booting into for loop...\n"); | ||
//Serial.print("Booting into for loop...\n"); | ||
//Serial.print("Booting into for loop...\n"); | ||
//Serial.print("Booting into for loop...\n"); | ||
Serial.print("Booting into for loop...\n"); | ||
|
||
digitalWrite(LED_BUILTIN, LOW); | ||
volatile uint32_t i, j; | ||
volatile uint32_t cnt; | ||
uint32_t blink_status = 1; | ||
uint32_t b = 0; | ||
uint32_t run_cnt = 0; | ||
uint32_t glitch_cnt = 0; | ||
//Serial.print("\nCONNECTED 115200\n"); | ||
//Serial.print("W. O. P. R. Login: \n"); | ||
for (run_cnt = 0; run_cnt < RUN_CNT; run_cnt++) { | ||
//Serial.print("starting loop..."); | ||
//Serial.println(run_cnt); | ||
//run led on | ||
//Serial.print("\nCONNECTED 115200\n"); | ||
//Serial.print("W. O. P. R. Login: \n"); | ||
/*digitalWrite(13, HIGH); | ||
delay(500); | ||
digitalWrite(13, LOW); | ||
delay(500); | ||
digitalWrite(13, HIGH); | ||
delay(500); | ||
digitalWrite(13, LOW); | ||
delay(500); | ||
blink_status ^= 1;*/ | ||
cnt = 0; | ||
for ( i = 0; i < OUTER_LOOP_CNT; i++) { | ||
for ( j = 0; j < INNER_LOOP_CNT; j++) { | ||
cnt++; | ||
} | ||
} | ||
|
||
//Serial.print("Looking for a glitch...\n"); | ||
//look for glitch | ||
/*Serial.print("Outer Loop CNT: "); | ||
Serial.println(i); | ||
Serial.print("Inner Loop CNT: "); | ||
Serial.println(j); | ||
Serial.print("Total Loop Count: "); | ||
Serial.println(cnt);*/ | ||
if (i != OUTER_LOOP_CNT || j != INNER_LOOP_CNT || | ||
cnt != (OUTER_LOOP_CNT * INNER_LOOP_CNT) ) { | ||
/*Serial.print("GEETINGS PROFESSOR FALKEN.\n"); | ||
Serial.print("\n"); | ||
Serial.print("HOW ARE YOU FEELING TODAY?\n");*/ | ||
Serial.print("Glitched!\n"); | ||
digitalWrite(RED_LED, LOW); | ||
//if glitched, reset the run count and blink the fault LED | ||
for( b = 0 ; b < 16; b++) | ||
{ | ||
digitalWrite(LED_BUILTIN, HIGH); | ||
digitalWrite(GREEN_LED, HIGH); | ||
delay(300); | ||
digitalWrite(LED_BUILTIN, LOW); | ||
digitalWrite(GREEN_LED, LOW); | ||
delay(300); | ||
} | ||
run_cnt = 0; | ||
digitalWrite(Reset, LOW); | ||
digitalWrite(RED_LED, HIGH); | ||
delay(100); | ||
digitalWrite(Reset, HIGH); | ||
} | ||
} | ||
} |