<p>A good starting point <em>could</em> be to use one of the two versions of the <a href="https://reprap.org/wiki/File:RAMPS1.4_TestCode.pde" rel="nofollow noreferrer"><code>RAMPS1.4_TestCode.pde</code></a> testcode, which is linked to by this thread on the RepRapWiki, <a href="https://reprap.org/forum/read.php?219,99920" rel="nofollow noreferrer">RAMPS 1.4 test code</a>:</p>
<blockquote>
<p>Please note it will switch on and off your heated-bed and extruder hot-end too besides moving all the motors and flashing the leds. Disconnect them if you do not want any heating while testing.</p>
</blockquote>
<p>There is a later version, in <a href="https://reprap.org/forum/read.php?219,99920,165777#msg-165777" rel="nofollow noreferrer">this post</a> on the same thread, which also checks the individual stepper motor steps:</p>
<pre><code>#define X_STEP_PIN 54
#define X_DIR_PIN 55
#define X_ENABLE_PIN 38
#define X_MIN_PIN 3
#define X_MAX_PIN 2

#define Y_STEP_PIN 60
#define Y_DIR_PIN 61
#define Y_ENABLE_PIN 56
#define Y_MIN_PIN 14
#define Y_MAX_PIN 15

#define Z_STEP_PIN 46
#define Z_DIR_PIN 48
#define Z_ENABLE_PIN 62
#define Z_MIN_PIN 18
#define Z_MAX_PIN 19

#define E_STEP_PIN 26
#define E_DIR_PIN 28
#define E_ENABLE_PIN 24

#define Q_STEP_PIN 36
#define Q_DIR_PIN 34
#define Q_ENABLE_PIN 30

#define SDPOWER -1
#define SDSS 53
#define LED_PIN 13

#define FAN_PIN 9

#define PS_ON_PIN 12
#define KILL_PIN -1

#define HEATER_0_PIN 10
#define HEATER_1_PIN 8
#define TEMP_0_PIN 13 // ANALOG NUMBERING
#define TEMP_1_PIN 14 // ANALOG NUMBERING

void setup() {
  pinMode(FAN_PIN , OUTPUT);
  pinMode(HEATER_0_PIN , OUTPUT);
  pinMode(HEATER_1_PIN , OUTPUT);
  pinMode(LED_PIN , OUTPUT);

  pinMode(X_STEP_PIN , OUTPUT);
  pinMode(X_DIR_PIN , OUTPUT);
  pinMode(X_ENABLE_PIN , OUTPUT);

  pinMode(Y_STEP_PIN , OUTPUT);
  pinMode(Y_DIR_PIN , OUTPUT);
  pinMode(Y_ENABLE_PIN , OUTPUT);

  pinMode(Z_STEP_PIN , OUTPUT);
  pinMode(Z_DIR_PIN , OUTPUT);
  pinMode(Z_ENABLE_PIN , OUTPUT);

  pinMode(E_STEP_PIN , OUTPUT);
  pinMode(E_DIR_PIN , OUTPUT);
  pinMode(E_ENABLE_PIN , OUTPUT);

  pinMode(Q_STEP_PIN , OUTPUT);
  pinMode(Q_DIR_PIN , OUTPUT);
  pinMode(Q_ENABLE_PIN , OUTPUT);

  digitalWrite(X_ENABLE_PIN , LOW);
  digitalWrite(Y_ENABLE_PIN , LOW);
  digitalWrite(Z_ENABLE_PIN , LOW);
  digitalWrite(E_ENABLE_PIN , LOW);
  digitalWrite(Q_ENABLE_PIN , LOW);
}


void loop () {

  // if (millis() %1000 &lt;500)
  // digitalWrite(LED_PIN, HIGH);
  // else
  // digitalWrite(LED_PIN, LOW);

  // if (millis() %1000 &lt;300) {
  // digitalWrite(HEATER_0_PIN, HIGH);
  // digitalWrite(HEATER_1_PIN, LOW);
  // digitalWrite(FAN_PIN, LOW);
  // } else if (millis() %1000 &lt;600) {
  // digitalWrite(HEATER_0_PIN, LOW);
  // digitalWrite(HEATER_1_PIN, HIGH);
  // digitalWrite(FAN_PIN, LOW);
  // } else {
  // digitalWrite(HEATER_0_PIN, LOW);
  // digitalWrite(HEATER_1_PIN, LOW);
  // digitalWrite(FAN_PIN, HIGH);
  // }



  if ( millis() % 60000 &lt; 30000) {
    digitalWrite(X_DIR_PIN , HIGH);
    digitalWrite(Y_DIR_PIN , HIGH);
    digitalWrite(Z_DIR_PIN , HIGH);
    digitalWrite(E_DIR_PIN , HIGH);
    digitalWrite(Q_DIR_PIN , HIGH);
    digitalWrite(HEATER_0_PIN, LOW);
    digitalWrite(FAN_PIN, HIGH);
    digitalWrite(HEATER_1_PIN, LOW);
    digitalWrite(LED_PIN, HIGH);

  }
  else {
    digitalWrite(X_DIR_PIN , LOW);
    digitalWrite(Y_DIR_PIN , LOW);
    digitalWrite(Z_DIR_PIN , LOW);
    digitalWrite(E_DIR_PIN , LOW);
    digitalWrite(Q_DIR_PIN , LOW);
    digitalWrite(HEATER_0_PIN, HIGH);
    digitalWrite(FAN_PIN, LOW);
    digitalWrite(HEATER_1_PIN, HIGH);
    digitalWrite(LED_PIN, LOW);

  }

  digitalWrite(X_STEP_PIN , LOW);
  digitalWrite(Y_STEP_PIN , LOW);
  digitalWrite(Z_STEP_PIN , LOW);
  digitalWrite(E_STEP_PIN , LOW);
  digitalWrite(Q_STEP_PIN , LOW);

  delay (200);

  digitalWrite(X_STEP_PIN , HIGH);
  digitalWrite(Y_STEP_PIN , HIGH);
  digitalWrite(Z_STEP_PIN , HIGH);
  digitalWrite(E_STEP_PIN , HIGH);
  digitalWrite(Q_STEP_PIN , HIGH);

  delay (200);

}

</code></pre>
<p>As your board isn't a RAMPS you will probably have to change some of the <code>#defines</code>, to correspond with your board, but that should just be a simple <em>search-and-replace</em> exercise.</p>

CC BY-SA 4.0
2021-09-17T19:32:40.253Z
2021-09-17T19:32:40.253Z
Greenonline
<p>Well I got some problems with a batch of STM32 boards where some work and some don't. I'm trying to figure out the same thing.</p>
<p>The initial plan is a simple board with a socket for the micro and some LEDs, hopefully not 64 of them, and put in it a simple firmware that just goes around testing all the GPIOs, but I fear that the test could not be enough.</p>

CC BY-SA 4.0
2023-06-27T21:42:34.890Z
Did you ever manage to come up with some firmware to test your board? Just a thought, but you could use a multiplexer to reduce the number of LEDs required, or (maybe) use a form of [Charlieplexing](https://en.wikipedia.org/wiki/Charlieplexing) instead.
Greenonline
CC BY-SA 4.0
2021-09-17T17:01:16.730Z
2023-06-27T21:43:00.480Z
2023-06-27T21:43:00.480Z
Miguel Ferreira
<p>I have an SKR PRO control board with a dead (shorted, it's burning hot) main processor. I ordered a new board, it was my mistake.</p>
<p>The voltage regulators work, so I ordered a replacement STM32F407 processor from STM (a free sample actually) and I'll repair the board in my free time.</p>
<p>How can I test all pins of the new board, so that I can ensure the board is working when I'll sell it/when I'll use it for my next project?</p>
<p>I think that programmatically turning on and off each pin would be enough, then I would use an oscilloscope or a LED to verify the result. The pins which have special functions (heater, fan, MOSFET in general) would be tested accordingly, but I still need the pulsating input.</p>

<part-testing>
How to test all pins of a STM32 board?
FarO
# How to test all pins of a STM32 board?

(Asked by: username_0 on 2020-10-26)

I have an SKR PRO control board with a dead (shorted, it's burning hot) main processor. I ordered a new board, it was my mistake.

The voltage regulators work, so I ordered a replacement STM32F407 processor from STM (a free sample actually) and I'll repair the board in my free time.

How can I test all pins of the new board, so that I can ensure the board is working when I'll sell it/when I'll use it for my next project?

I think that programmatically turning on and off each pin would be enough, then I would use an oscilloscope or a LED to verify the result. The pins which have special functions (heater, fan, MOSFET in general) would be tested accordingly, but I still need the pulsating input.

**Tags:** part-testing


---

## 2 answers

### Answer by username_1 on 2021-09-17. Score: 0 | Accepted answer

A good starting point *could* be to use one of the two versions of the [`RAMPS1.4_TestCode.pde`](https://reprap.org/wiki/File:RAMPS1.4_TestCode.pde) testcode, which is linked to by this thread on the RepRapWiki, [RAMPS 1.4 test code](https://reprap.org/forum/read.php?219,99920):

> Please note it will switch on and off your heated-bed and extruder hot-end too besides moving all the motors and flashing the leds. Disconnect them if you do not want any heating while testing.

There is a later version, in [this post](https://reprap.org/forum/read.php?219,99920,165777#msg-165777) on the same thread, which also checks the individual stepper motor steps:

```
#define X_STEP_PIN 54
#define X_DIR_PIN 55
#define X_ENABLE_PIN 38
#define X_MIN_PIN 3
#define X_MAX_PIN 2

#define Y_STEP_PIN 60
#define Y_DIR_PIN 61
#define Y_ENABLE_PIN 56
#define Y_MIN_PIN 14
#define Y_MAX_PIN 15

#define Z_STEP_PIN 46
#define Z_DIR_PIN 48
#define Z_ENABLE_PIN 62
#define Z_MIN_PIN 18
#define Z_MAX_PIN 19

#define E_STEP_PIN 26
#define E_DIR_PIN 28
#define E_ENABLE_PIN 24

#define Q_STEP_PIN 36
#define Q_DIR_PIN 34
#define Q_ENABLE_PIN 30

#define SDPOWER -1
#define SDSS 53
#define LED_PIN 13

#define FAN_PIN 9

#define PS_ON_PIN 12
#define KILL_PIN -1

#define HEATER_0_PIN 10
#define HEATER_1_PIN 8
#define TEMP_0_PIN 13 // ANALOG NUMBERING
#define TEMP_1_PIN 14 // ANALOG NUMBERING

void setup() {
  pinMode(FAN_PIN , OUTPUT);
  pinMode(HEATER_0_PIN , OUTPUT);
  pinMode(HEATER_1_PIN , OUTPUT);
  pinMode(LED_PIN , OUTPUT);

  pinMode(X_STEP_PIN , OUTPUT);
  pinMode(X_DIR_PIN , OUTPUT);
  pinMode(X_ENABLE_PIN , OUTPUT);

  pinMode(Y_STEP_PIN , OUTPUT);
  pinMode(Y_DIR_PIN , OUTPUT);
  pinMode(Y_ENABLE_PIN , OUTPUT);

  pinMode(Z_STEP_PIN , OUTPUT);
  pinMode(Z_DIR_PIN , OUTPUT);
  pinMode(Z_ENABLE_PIN , OUTPUT);

  pinMode(E_STEP_PIN , OUTPUT);
  pinMode(E_DIR_PIN , OUTPUT);
  pinMode(E_ENABLE_PIN , OUTPUT);

  pinMode(Q_STEP_PIN , OUTPUT);
  pinMode(Q_DIR_PIN , OUTPUT);
  pinMode(Q_ENABLE_PIN , OUTPUT);

  digitalWrite(X_ENABLE_PIN , LOW);
  digitalWrite(Y_ENABLE_PIN , LOW);
  digitalWrite(Z_ENABLE_PIN , LOW);
  digitalWrite(E_ENABLE_PIN , LOW);
  digitalWrite(Q_ENABLE_PIN , LOW);
}

void loop () {

  // if (millis() %1000 <500)
  // digitalWrite(LED_PIN, HIGH);
  // else
  // digitalWrite(LED_PIN, LOW);

  // if (millis() %1000 <300) {
  // digitalWrite(HEATER_0_PIN, HIGH);
  // digitalWrite(HEATER_1_PIN, LOW);
  // digitalWrite(FAN_PIN, LOW);
  // } else if (millis() %1000 <600) {
  // digitalWrite(HEATER_0_PIN, LOW);
  // digitalWrite(HEATER_1_PIN, HIGH);
  // digitalWrite(FAN_PIN, LOW);
  // } else {
  // digitalWrite(HEATER_0_PIN, LOW);
  // digitalWrite(HEATER_1_PIN, LOW);
  // digitalWrite(FAN_PIN, HIGH);
  // }

  if ( millis() % 60000 < 30000) {
    digitalWrite(X_DIR_PIN , HIGH);
    digitalWrite(Y_DIR_PIN , HIGH);
    digitalWrite(Z_DIR_PIN , HIGH);
    digitalWrite(E_DIR_PIN , HIGH);
    digitalWrite(Q_DIR_PIN , HIGH);
    digitalWrite(HEATER_0_PIN, LOW);
    digitalWrite(FAN_PIN, HIGH);
    digitalWrite(HEATER_1_PIN, LOW);
    digitalWrite(LED_PIN, HIGH);

  }
  else {
    digitalWrite(X_DIR_PIN , LOW);
    digitalWrite(Y_DIR_PIN , LOW);
    digitalWrite(Z_DIR_PIN , LOW);
    digitalWrite(E_DIR_PIN , LOW);
    digitalWrite(Q_DIR_PIN , LOW);
    digitalWrite(HEATER_0_PIN, HIGH);
    digitalWrite(FAN_PIN, LOW);
    digitalWrite(HEATER_1_PIN, HIGH);
    digitalWrite(LED_PIN, LOW);

  }

  digitalWrite(X_STEP_PIN , LOW);
  digitalWrite(Y_STEP_PIN , LOW);
  digitalWrite(Z_STEP_PIN , LOW);
  digitalWrite(E_STEP_PIN , LOW);
  digitalWrite(Q_STEP_PIN , LOW);

  delay (200);

  digitalWrite(X_STEP_PIN , HIGH);
  digitalWrite(Y_STEP_PIN , HIGH);
  digitalWrite(Z_STEP_PIN , HIGH);
  digitalWrite(E_STEP_PIN , HIGH);
  digitalWrite(Q_STEP_PIN , HIGH);

  delay (200);

}

```

As your board isn't a RAMPS you will probably have to change some of the `#defines`, to correspond with your board, but that should just be a simple *search-and-replace* exercise.


---

### Answer by username_2 on 2021-09-17. Score: 0

Well I got some problems with a batch of STM32 boards where some work and some don't. I'm trying to figure out the same thing.

The initial plan is a simple board with a socket for the micro and some LEDs, hopefully not 64 of them, and put in it a simple firmware that just goes around testing all the GPIOs, but I fear that the test could not be enough.

> **Comments:**
> **username_1**: Did you ever manage to come up with some firmware to test your board? Just a thought, but you could use a multiplexer to reduce the number of LEDs required, or (maybe) use a form of [Charlieplexing](https://en.wikipedia.org/wiki/Charlieplexing) instead.  

---

