Skip to main content
Associate II
June 10, 2025
Solved

Is there an error in the code for bus voltage compensation?

  • June 10, 2025
  • 2 replies
  • 590 views

My configuration:

  • [VERSION]: MCSDK 6.3.2
  • [TOOL]: MC Workbench, ST MOTOR Pilot
  • I am using the HSO on a custom board with an STSPIN32G4 at 15 kHz.

propu_0-1749534917183.png

The basic algorithm here should be the reciprocal of the bus voltage,  using LPF filtering for result. So the code should be modified as follows. Please help me confirm whether my understanding is incorrect or if there is indeed an error here?

propu_1-1749535157651.png

 

Best answer by Gael A

Hello propu,

Although I'm not sure of the exact reason why the current busVoltageComp filtering is implemented this way, it is still a valid filter and I don't see any reason to change it. It is true that the filter you are talking about is the closest way to a LPF. However, it requires a division in that case, which we would rather avoid in an embedded context. The current implementation is therefore more adapted to our constraints.

2 replies

Gael A
Gael ABest answer
ST Employee
July 22, 2025

Hello propu,

Although I'm not sure of the exact reason why the current busVoltageComp filtering is implemented this way, it is still a valid filter and I don't see any reason to change it. It is true that the filter you are talking about is the closest way to a LPF. However, it requires a division in that case, which we would rather avoid in an embedded context. The current implementation is therefore more adapted to our constraints.

If you agree with my answer, please consider accepting it by clicking on 'Accept as solution'.Hope this will help,Gaël A.
propuAuthor
Associate II
August 21, 2025

thanks for your replay.