2024-03-05 12:00 PM - edited 2024-03-05 12:02 PM
I have made a custom 24V drive using the STSPIN32F0 chip. For the first take on this board, I have followed the STEVAL-SPIN3201 design. I have changed the gain values for the op-amps, the MOSFETS, and a few signal inputs to the MCU. I have the custom board working and able to drive the 3 Phase 24V BLDC motor I am working with, everything is normal when using the firmware generated for STEVAL-SPIN3201 (MC Workbench 6.2.1 + CubeMX 6.8.0 + STM32 FW V1.11.4). When the feedback signals for current sensing on the reference board are: PA3 - Phase W Feedback
PA4 - Phase V Feedback
PA5 - Phase U Feedback
I swapped PA5 and PA3 on my board for layout reasons. When I generate firmware without accounting for the swapped pins the firmware runs "correctly" and the motor spins like normal. However, if I update the pins to be what is actually on the board (PA3 Phase U and PA5 Phase W) the motor essentially shorts and hits an undervoltage error due to overdrawing the supply. The generated firmware that is affected by this configuration change is "mc_paramaters.c" from the FOC library.
The difference between the 2 generated firmwares is limited to the file (and the .ioc/main.h file for pin labels).
The difference being:
Unmodified to account for pin swap:
.ADCConfig = {
(uint32_t)(1<< 4U ) | (uint32_t)(1<< 3U ),
(uint32_t)(1<< 5U ) | (uint32_t)(1<< 3U ),
(uint32_t)(1<< 5U ) | (uint32_t)(1<< 3U ),
(uint32_t)(1<< 5U ) | (uint32_t)(1<< 4U ),
(uint32_t)(1<< 5U ) | (uint32_t)(1<< 4U ),
(uint32_t)(1<< 4U ) | (uint32_t)(1<< 3U ),
},
Whereas the modified firmware generated after performing the pin swap is:
.ADCConfig = {
(uint32_t)(1<< 4U ) | (uint32_t)(1<< 5U ),
(uint32_t)(1<< 3U ) | (uint32_t)(1<< 5U ),
(uint32_t)(1<< 3U ) | (uint32_t)(1<< 5U ),
(uint32_t)(1<< 3U ) | (uint32_t)(1<< 4U ),
(uint32_t)(1<< 3U ) | (uint32_t)(1<< 4U ),
(uint32_t)(1<< 4U ) | (uint32_t)(1<< 5U ),
},
I am having trouble finding the effect of this change, I believe it effects the order the currents are sampled in, can someone please point me to the documentation regarding this for 6.2.1? Any insights on why this modification would cause the drive to overcurrent the motor?
Thank you!