2022-10-05 04:27 AM
Hello community!
I am using a custom PCB based on STM32G431CBU6 with external lowside current sense amplifiers (20V/V amplification). I implemented a fallback variant on the PCB so that I can switch between using the internal OPAMPs of the STM32 or the external ones by populating the external resistor network or not. The problem is, that I found out when I switch from the internal OPAMPs in the workbench to external, it seems as if the workbench now wants to measure all three phase currents U V and W, although in the code the third current is calculated by the other two current measurements using kirchhoff's law. It is not possible to disable the current measurement on phase W. The problem is, I have only 2 current sense amplifiers on my board, namely on Phase U and Phase V. And to make things even more complicated, the ADC for phase V that is used when you activate internal OPAMPs is (PA6) is swapped with phase W when you enable external OPAMPs and I cant even select PA6 in the dropdown menu of Phase V! (see screenshot)
can someone please explain why that is because that really makes it impossible to use my current PCB with external current sense amplifiers.
The funny thing is that even with the setting set to external OPAMP, all three GPIOs are active for current sensing the three phases BUT in the motor control code, the current sensing is only using 2 phase currents and calculated the third.