Frustrated about the buggy firmware being pointlessly closed source? Me too.
Given all the actually clever IP is not owned by ODrive, I believe the community should just put together a firmware from a pin-mapping effort. Counting pins I think gives us:
/**
- ODrive Micro pin mapping — STM32H725ZG
**/
#ifndef PINMAP_H
#define PINMAP_H
/* ---------- SPI3 — MA702 magnetic encoder ---------- /
#define ENC_SPI SPI3 / 0x40003C00 /
#define ENC_SPI_SCK_PIN GPIO_PIN_10 / PC10 — SPI3_SCK AF6 /
#define ENC_SPI_SCK_PORT GPIOC
#define ENC_SPI_MISO_PIN GPIO_PIN_11 / PC11 — SPI3_MISO AF6 /
#define ENC_SPI_MISO_PORT GPIOC
#define ENC_SPI_NCS_PIN GPIO_PIN_2 / PB2 — GPIO output */
#define ENC_SPI_NCS_PORT GPIOB
#define ENC_SPI_AF 6
/* ---------- SPI1 — DRV8316 gate driver ---------- /
#define DRV_SPI SPI1 / 0x40013000 /
#define DRV_SPI_SCK_PIN GPIO_PIN_3 / PB3 — SPI1_SCK AF5 /
#define DRV_SPI_SCK_PORT GPIOB
#define DRV_SPI_MISO_PIN GPIO_PIN_4 / PB4 — SPI1_MISO AF5 /
#define DRV_SPI_MISO_PORT GPIOB
#define DRV_SPI_MOSI_PIN GPIO_PIN_5 / PB5 — SPI1_MOSI AF5 /
#define DRV_SPI_MOSI_PORT GPIOB
#define DRV_SPI_NCS_PIN GPIO_PIN_4 / PA4 — GPIO output /
#define DRV_SPI_NCS_PORT GPIOA
#define DRV_SPI_AF 5
#define DRV_ENABLE_PIN GPIO_PIN_0 / PB0 — nSLEEP/ENABLE /
#define DRV_ENABLE_PORT GPIOB
#define DRV_NFAULT_PIN GPIO_PIN_15 / PC15 — nFAULT input */
#define DRV_NFAULT_PORT GPIOC
/* ---------- PWM — TIM1 3-phase to DRV8316 ---------- /
#define PWM_TIMER TIM1 / 0x40010000 /
#define PWM_AF 1
#define PWM_UH_PIN GPIO_PIN_8 / PA8 — TIM1_CH1 AF1 /
#define PWM_UH_PORT GPIOA
#define PWM_VH_PIN GPIO_PIN_9 / PA9 — TIM1_CH2 AF1 /
#define PWM_VH_PORT GPIOA
#define PWM_WH_PIN GPIO_PIN_10 / PA10 — TIM1_CH3 AF1 /
#define PWM_WH_PORT GPIOA
#define PWM_UL_PIN GPIO_PIN_13 / PB13 — TIM1_CH1N AF1 /
#define PWM_UL_PORT GPIOB
#define PWM_VL_PIN GPIO_PIN_14 / PB14 — TIM1_CH2N AF1 /
#define PWM_VL_PORT GPIOB
#define PWM_WL_PIN GPIO_PIN_15 / PB15 — TIM1_CH3N AF1 /
#define PWM_WL_PORT GPIOB
#define PWM_ARR_VALUE 3434 / ~29kHz center-aligned at 200MHz */
/* ---------- ADC — current sense ---------- /
/ DRV8316 has internal current sense amplifiers; ADC reads amplified shunt voltage /
#define ADC_ISENSE ADC1 / /
#define ADC_ISENSE_A_PIN GPIO_PIN_5 / PA5 — ADC1/2_IN19 /
#define ADC_ISENSE_A_PORT GPIOA
#define ADC_ISENSE_A_CH 19
#define ADC_ISENSE_B_PIN GPIO_PIN_7 / PA7 — ADC1/2_IN7 /
#define ADC_ISENSE_B_PORT GPIOA
#define ADC_ISENSE_B_CH 7
#define ADC_ISENSE_C_PIN GPIO_PIN_5 / PC5 — ADC1/2_IN8, or FET therm /
#define ADC_ISENSE_C_PORT GPIOC
#define ADC_ISENSE_C_CH 8
/ Shunt conductance: 0.0995 S = ~10 mohm shunt /
#define SHUNT_CONDUCTANCE 0.0995f / Siemens /
#define SHUNT_RESISTANCE_OHM 0.010f / ~10 mohm */
/* ---------- ADC — thermistor ---------- /
/ PB1 = ADC1/2_IN5, likely FET or motor thermistor /
#define ADC_THERM_PIN GPIO_PIN_1 / PB1 — ADC_IN5 /
#define ADC_THERM_PORT GPIOB
#define ADC_THERM_CH 5
#define THERM_PULLUP_OHM 1000.0f / [V] per ODrive docs (G01) /
#define THERM_PULLUP_V 3.3f
#define THERM_BETA 3950.0f / [?] needs calibration /
#define THERM_R_NOMINAL 10000.0f / [?] /
#define THERM_T_NOMINAL 25.0f / degrees C */
/* ---------- ADC — bus voltage ---------- /
#define ADC_VBUS_PIN GPIO_PIN_0 / PC0 — ADC1/2/3_IN10 */
#define ADC_VBUS_PORT GPIOC
#define ADC_VBUS_CH 10
/* ---------- FDCAN1 ---------- /
#define CAN_PERIPH FDCAN1 / 0x4000A000 /
#define CAN_RX_PIN GPIO_PIN_8 / PB8 — FDCAN1_RX AF9 /
#define CAN_RX_PORT GPIOB
#define CAN_TX_PIN GPIO_PIN_9 / PB9 — FDCAN1_TX AF9 */
#define CAN_TX_PORT GPIOB
#define CAN_AF 9
/* ---------- USB OTG HS (in FS mode) ---------- /
#define USB_DM_PIN GPIO_PIN_11 / PA11 /
#define USB_DM_PORT GPIOA
#define USB_DP_PIN GPIO_PIN_12 / PA12 */
#define USB_DP_PORT GPIOA
/* ---------- UART ---------- /
#define UART_PERIPH USART3 / 0x40004800 /
#define UART_TX_PIN GPIO_PIN_10 / PB10 — USART3_TX AF7 /
#define UART_TX_PORT GPIOB
#define UART_AF 7
/ RX likely PB11 (USART3_RX AF7) */
/* ---------- User GPIOs ---------- /
/ gpio0 = PA15, gpio1 = PC0 (Vbus), gpio2 = PA0, gpio3 = PA1,
- gpio4 = PC7, gpio5 = PA2, gpio6 = PA3, gpio7 = PB12 */
/* ---------- Uncertain ---------- /
/ PA6, PC9 not standard SPI3 AF.
- May be MA702 auxiliary outputs (MGH/MGL) or encoder index. */
#endif /* PINMAP_H */