cancel
Showing results for 
Search instead for 
Did you mean: 

STEVAL-SPIN3201 used with Hall sensor AND Encoder

FGron.1
Associate II

Hello, I try to control a motor using STEVAL-SPIN3201, a hall sensor and a encoder (in position control). I compile the generated files (generated via ST motor control workbench) via make.

In speed position based on hall-sensor, the compilation work and I'm able to control the motor without problem.

Moreover, when I add auxiliary sensor (Main: encoder, aux: hall sensor) and I start the compilation, I a have a RAM overflow during linking (overflow of 8bytes).

To add the sensor we have modified the board (remove potentiometer) but I cannot found the related option in ST motor control workbench.

Do you know if adding a second sensor on STEVAL-SPIN3201 is possible and if yes what do I have to change to make it works?

Thanks in advance

1 ACCEPTED SOLUTION

Accepted Solutions
Enrico Poli
ST Employee

I guess so too @Karl Hönemann​. In fact I was trying to understand why configure both the Hall and Encoder as position feedback sensors for the FOC algorithm.

The reconstruction of the electrical angle from the encoder feedback introduces a strong overhead to the system (dedicated data structure, functions, etc.).

If @FGron.1​ want to add the management of an encoder into the system I suggest the following:

  • Create the project using the Hall as position feedback for the FOC algorithm. DO NOT enable the encoder as aux sensor.
  • Generate the code selecting LL drivers (HAL adds some overhead too)
  • Open the resulting IOC project using CubeMX
  • Configure TIM3 for the encoder decoding and use the peripheral in you user project
  • If you are using a GCC-based IDE, take care of optimizations! At the moment this compiler is not as optimized as the ones of other IDEs

At the moment the only option for the position algorithm included into the MCSDK uses the Encoder for both positioning and electrical angle reconstruction.

View solution in original post

3 REPLIES 3
Enrico Poli
ST Employee

Hi, can you give some more details?

Do you want to use the encoder as auxiliary sensor for the FOC algorithm or do you want to enable the position control?

Hi 🙂

As far, as i understand the question, he wants to use the Hall´s for "commutation" related stuff and further the external encoder (quadrature enc. ?) to read and control the position of the motor (like a servo drive). After adding all the functions, the compiled program is using too much RAM (or maybe doesn´t fit into flash…) anymore.

Enrico Poli
ST Employee

I guess so too @Karl Hönemann​. In fact I was trying to understand why configure both the Hall and Encoder as position feedback sensors for the FOC algorithm.

The reconstruction of the electrical angle from the encoder feedback introduces a strong overhead to the system (dedicated data structure, functions, etc.).

If @FGron.1​ want to add the management of an encoder into the system I suggest the following:

  • Create the project using the Hall as position feedback for the FOC algorithm. DO NOT enable the encoder as aux sensor.
  • Generate the code selecting LL drivers (HAL adds some overhead too)
  • Open the resulting IOC project using CubeMX
  • Configure TIM3 for the encoder decoding and use the peripheral in you user project
  • If you are using a GCC-based IDE, take care of optimizations! At the moment this compiler is not as optimized as the ones of other IDEs

At the moment the only option for the position algorithm included into the MCSDK uses the Encoder for both positioning and electrical angle reconstruction.