NULA: UART4 pins and SPI3 configuration for AD9912

Customer:

I successfully compiled the code after your suggested changes. However, the code hung after reset - investigation showed the Serial4 transmitter was blocked and the code hung when the transmit buffer filled.

Looking at the STM32H7742xI/G STM32H743xI/G datasheet Table 10, I found that PA11 is UART4 RX and PA12 is UART4 TX (AF6 on both pins). After making this change, it works great, verified with an oscilloscope.

Now I’m working on SPI3 to control an Analog Devices AD9912 for a control panel for a general coverage receiver.

Originally submitted via the contact form on soldered.com on 17 December 2025. Migrated to the forum for community visibility.

Soldered Support:

Congratulations on identifying the correct UART4 pins! Regarding SPI3, here’s a working code block that was tested:

#include <SPI.h>

#define SPI3_CS_PIN PA12 // Any free GPIO

SPIClass SPI_3(PC12, PC11, PC10);
// MOSI, MISO, SCK

void setup() {
  Serial.begin(115200);
  while (!Serial) {}

  pinMode(SPI3_CS_PIN, OUTPUT);
  digitalWrite(SPI3_CS_PIN, HIGH); // CS inactive

  SPI_3.begin();
}

uint8_t spi3Transfer(uint8_t data) {
  SPI_3.beginTransaction(SPISettings(
    1000000,
    MSBFIRST,
    SPI_MODE0
  ));

  digitalWrite(SPI3_CS_PIN, LOW); // CS active
  uint8_t rx = SPI_3.transfer(data);
  digitalWrite(SPI3_CS_PIN, HIGH); // CS inactive

  SPI_3.endTransaction();
  return rx;
}

void loop() {
  uint8_t rx = spi3Transfer(0x9A);

  Serial.print("Received: 0x");
  Serial.println(rx, HEX);
}