🛠 GPIO, ADC 16 bits et DAC sur le Nucleo STM32H743ZI : bouton, LED et potentiomètre
What you will build
A hands-on tour of the STM32H743ZI's basic I/O: the board exposes up to 114 GPIO with external interrupt capability through the ST Zio connector (Arduino Uno V3 compatible) and the ST morpho headers, plus serious analog silicon: 3× ADC (16-bit, 36 channels, up to 3.6 MSPS) and 2× 12-bit DAC. We will read the USER button, dim an LED and stream a potentiometer value through the DAC.
Board map (default Zephyr mapping, useful even under Arduino)
- LD1 = PB0, LD2 = PE1, LD3 = PB14 ; USER button = PC13
- ADC example pin: ADC1_INP15 on PA3; DAC example pin: DAC1_OUT1 on PA4
- Arduino SPI1 on PD14/PA5/PA6/PB5 ; I2C on PB8/PB9
- The STM32duino variant exposes 28 analog channels (A0–A27) on this board
Hardware
- 1 Nucleo-144 STM32H743ZI + USB data cable
- 1 potentiometer (wiper to A0, ends to 3V3 and GND)
- 1 jumper wire from PA4 (DAC out) to an oscilloscope probe or a multimeter
Code (STM32duino core, board "Nucleo H743ZI")
const uint8_t BTN = LED_BUILTIN; // USER button is PC13 on the board; on the
// Arduino header use any free pin vs GND
const uint8_t LED = LED1; // LD1 = PB0 via the core alias
const uint8_t POT = A0; // one of 28 analog channels A0..A27
const uint8_t DAC1 = A4; // PA4 = DAC1_OUT1 (Zephyr mapping)
// >
// pin alias depends on your core version
void setup {
pinMode(LED, OUTPUT);
Serial.begin(115200); // ST-LINK virtual COM port
}
void loop {
int raw = analogRead(POT); // 3x 16-bit ADCs, up to 3.6 MSPS
// Map the ADC reading onto the 12-bit DAC output scale
analogWrite(DAC1, map(raw, 0, 4095, 0, 255));
digitalWrite(LED, (raw > 2048) ? HIGH : LOW);
Serial.printf("ADC=%d -> DAC level=%d\n", raw,
map(raw, 0, 4095, 0, 255));
delay(100);
}
Steps
- Wire the potentiometer between 3V3, GND and A0 (never feed more than the board's own rail into a pin).
- Select board Nucleo H743ZI in the STM32duino core and upload.
- Turn the pot: the multimeter on PA4 should follow smoothly — that is the 12-bit DAC working.
- Press the USER button (PC13) if you wired it to a header pin: use
pinMode(pin, INPUT_PULLUP)anddigitalReadthe same way.
Expected result
ADC counts climb while you turn the pot, the DAC voltage follows, and LD1 flips at mid-scale. With three 16-bit ADCs at up to 3.6 MSPS, this board samples far faster than any classic Arduino — the bottleneck is your sketch, not the silicon.
Common pitfalls
- ZI vs ZI2: the two Nucleo boards wire the Arduino header differently — pick the exact board you own or every D/A number is silently remapped.
- Reading A0 while the Zephyr mapping says ADC1_INP15 is PA3: Arduino numbers and ST signal names are two different namespaces ; check the variant file for the mapping.
- Forgetting that the 16-bit ADC may be configured at lower resolution by default in some cores — check the ADC example in STM32CubeH7's
Examples/ADCfor full-control setups.
Autres tutoriels pour cette carte
- Premiers pas sur le Nucleo-144 STM32H743ZI : core STM32duino, ST-LINK et premier Blink
- MicroPython sur le Nucleo STM32H743ZI : le REPL 480 MHz via le port série ST-LINK
- Zephyr RTOS sur le Nucleo STM32H743ZI : west build, flash et le piège des 96 MHz
- STM32Cube HAL à 480 MHz sur le STM32H743ZI : VOS0, latence flash et HSE bypass
- FreeRTOS sur le Nucleo STM32H743ZI : le projet officiel CubeH7, tâches et file d'attente
- Serveur web sur l'Ethernet du STM32H743ZI : démo LwIP officielle, RMII et errata