Skip to main content
Ronny Landsverk
Associate III
May 20, 2025
Question

Issues with speed measurements using incremental encoder

  • May 20, 2025
  • 1 reply
  • 415 views

I'm using STMC FOC sdk v4.3 on a STM32F303ZE MCU. The main sensor is an incremental encoder, but I'm experiencing issues with the speed measurements.The issue is pretty consistent in nature, although it appears rather randomly. The figure shows the measured speed in units of 01Hz. 

RonnyLandsverk_0-1747738241392.png

We get a negative spike with value `speed = actualSpeed - 624`, followed by a positive spike   `speed = actualSpeed + 625`  at exactly 16 samples later. Note that the buffer size of `ENCParamsM1` is 16. I'm suspecting that `VirtualSpeedSensor` class is related to the issue as it's parameter struct has a member `hTransitionSteps` with value 625. However, I don't know the details for how this works and the v4.3 sdk is pretty hard to troubleshoot.

Note that the MC is in RUN state at all times, and that neither the return value of `ENC_CalcAvrgMecSpeed01Hz()` in `ENC_F30X_SpeednPosFdbkClass` nor the return value of `SPD_CalcAvrgMecSpeed01Hz()` in `SpeednPosFdbkClass` goes FALSE at any time.

I'm hoping anyone has dealt with this before and found the root cause :)

1 reply

cedric H
Technical Moderator
May 20, 2025

Hello Ronny,

The MCSDK 4.3 is not supported anymore. The STM32F303ZE is supported in the MCSDK 6.4.0.

Could you port your project on this latest version and check if your issue still exists?

Thanks, and Regards.

Cedric.

Ronny Landsverk
Associate III
May 20, 2025

Hi Cedric. I'm aware that v4.3 is outdated. At some point we'll need to port the firmware, but unfortunately a lot of modules for higher power application has been added so it will take time. 

 

Regards Ronny