B-G431B-ESC1 + AS5047P: No readings on Hall pins and seeking SPI locations

1. Setup

  • MCU/ESC: STM32G431B-ESC1

  • Motor: 2807 KV1300

  • Encoder: AS5047P

2. Status & Problem I am a beginner. I have successfully controlled the motor in Open Loop, and it spins fine. Now, I am trying to add the AS5047P encoder for closed-loop control.

I connected the pins as follows:

  • ESC Back (Hall Interface): GND / 5V / H3 / H2 / H1

  • Encoder Pins: GND / 5V / I / A / B

Issue: I get zero readings/no angle change in the serial monitor when rotating the motor.

#include <SimpleFOC.h>

// Encoder definition: A-PA0, B-PA1, 4000 CPR, Index-PA2
Encoder encoder = Encoder(PA0, PA1, 4000, PA2);

void doA(){encoder.handleA();}
void doB(){encoder.handleB();}
void doIndex(){encoder.handleIndex();}

void setup() {
Serial.begin(115200);

// Initialize interrupts
encoder.enableInterrupts(doA, doB, doIndex);
encoder.init();
Serial.println(“Encoder ready”);
}

void loop() {
encoder.update();
Serial.println(encoder.getAngle());
}
  1. Question: SPI Pin Locations
    Since ABI mode on the Hall pins is not working, I want to try SPI mode for better precision and absolute position. However, I cannot find the physical locations of the PA5, PA6, and PA7 (SPI1) pins on this specific board.

Could someone please help with:

Where are the SCK, MISO, MOSI, and CS pads/pins located on the B-G431B-ESC1 board?