Mosfets burning in H-Bridge
As I interpret the code:
if(receivedCmd == 0x01) {   //direction1
    GPIO_WriteLow(GPIOD, (GPIO_Pin_TypeDef) (GPIO_PIN_2 | GPIO_PIN_3));    //H1-H4
    GPIO_WriteHigh(GPIOC, (GPIO_Pin_TypeDef) (GPIO_PIN_3 | GPIO_PIN_4));   //H2-H3
}

In the code above, in direction 1, pins 3 and 4 are on.
else if(receivedCmd == 0x02) {  //direction2
    GPIO_WriteLow(GPIOC, (GPIO_Pin_TypeDef) (GPIO_PIN_3 | GPIO_PIN_4));    //H2-H3
    GPIO_WriteHigh(GPIOD, (GPIO_Pin_TypeDef) (GPIO_PIN_2 | GPIO_PIN_3));   //H1-H4
}

Now, in direction 2, pins 2 and 3 are on. Pin 1 is never used.
This means that in both directions pin 3 is on. This would mean a short through Q3 and Q4 during direction 2. Your comments for the lines &quot;H2-H3&quot; and &quot;H1-H4&quot; are correct, but I think the pins not implemented like this.