SkillAgentSearch skills...

FOC

sensorless fixed point foc use smo and pll in stm32

Install / Use

/learn @super1207/FOC
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

FOC

sensorless and fixed point foc use smo and pll

doc

define in gobal:

MotorParams motor;

in main function:

// you may modify this function for different motor
InitMotorParams1(&motor);
SetMotorDir(&motor,0);// 1 or 0,default 0

in pwm timer interrupt function(freq:12K)

int32_t adc_u,adc_v;
...
// read adc,format to Q12(-4096~4096)
...
motor.Iu = adc_u;
motor.Iv = adc_v;
SetMotorVq(&motor,8800);// 0~32768,default 8800
MotorStep(&motor);
// ARR = 3500
TIM1->CCR1 = motor.PWMOut[0];
TIM1->CCR2 = motor.PWMOut[1];
TIM1->CCR3 = motor.PWMOut[2];

..

image image

View on GitHub
GitHub Stars35
CategoryDevelopment
Updated1mo ago
Forks11

Languages

C

Security Score

95/100

Audited on Mar 5, 2026

No findings