Should be trivial, maybe you are missing something?
Some copy-pasta which works for me, giving 180 deg phase shift, on STM32F7 advanced control timer. I think these timers are pretty much the same between the products?
// TIM8:
// Create a 50% duty square wave on CH2&CH2N, and another one 180deg apart on CH3&CH3N
TIM8->CR1 = 0UL<<7 /*Auto-reload ARR register is NOT buffered*/ |
0b00UL<<5 /*Edge-aligned mode*/ |
1UL<<4 /*downcounter*/;
// PHA = CH2, PHB = CH3 Positive channel = Hi-side FET, Negative channel = Lo-side FET
// PWM mode 1 "0110": active when CNT<CCR
// PWM mode 2 "0111": inactive when CNT<CCR
// WARNING: Highest mode bit is elsewhere in the register
TIM8->CCMR1 = 0UL<<11 /*CH2 Pre-load OFF*/ |
0b110UL<<12 /*CH2 PWM mode 1*/;
TIM8->CCMR2 = 0UL<<3 /*CH3 Pre-load OFF*/ |
0b111UL<<4 /*CH3 PWM mode 2*/;
TIM8->CCER = 1UL<<4 /*CH2 enable*/ |
1UL<<6 /*CH2N enable*/ |
1UL<<8 /*CH3 enable*/ |
1UL<<10 /*CH3N enable*/;
TIM8->BDTR = 1UL<<15 /*Main Output Enable*/ |
1UL<<11 /*OSSR, In off-state, the idle states are driven*/ |
1UL<<10 /*OSSI, same thing*/ |
10UL /*Deadtime, 8-bit value must begin with 0, max 127*/;
TIM8->ARR = 10000;
TIM8->CCR2 = 5000;
TIM8->CCR3 = 5000;
TIM8->BDTR |= 1UL<<15; // Main Output Enable
TIM8->CNT = 0;
TIM8->EGR = 1UL; // Generate update event
TIM8->CR1 |= 1UL; // Enable counter