完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
想用ST MC电机库进行BLDC开发,实际要求电机可以快速切换正反转,但实际实验过程中却无法实现,两方向切换过程中必须要延时一些时间,否则反向无法正常启动。感觉就像是要“缓一下”才行,但这缓
的时间也太长了,我测试时则需500ms或以上(如下程序红色语句所示),想请教下这是什么原因。 开发套件为NUCLEO-IHM01,电机库版本为5.3,测试代码如下: int main(void) { /* USER CODE BEGIN 1 */ int16_t Motor1Speed,Motor1SpeedAverage; int16_t Motor1Dir; uint16_t Motor1State,Motor1Faults; /* USER CODE END 1 */ /* MCU Configuration--------------------------------------------------------*/ /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init(); /* USER CODE BEGIN Init */ /* USER CODE END Init */ /* Configure the system clock */ SystemClock_Config(); /* USER CODE BEGIN SysInit */ /* USER CODE END SysInit */ /* Initialize all configured peripherals */ MX_GPIO_Init(); MX_ADC1_Init(); MX_DAC_Init(); MX_TIM1_Init(); MX_USART2_UART_Init(); MX_MotorControl_Init(); /* Initialize interrupts */ MX_NVIC_Init(); /* USER CODE BEGIN 2 */ /* USER CODE END 2 */ /* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) { /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ MC_ProgramSpeedRampMotor1(100/6,600); MC_StartMotor1(); HAL_Delay(2000); Motor1Speed = MC_GetMecSpeedReferenceMotor1(); Motor1SpeedAverage = MC_GetMecSpeedAverageMotor1(); Motor1Dir = MC_GetImposedDirectionMotor1(); Motor1State = MC_GetSTMStateMotor1(); Motor1Faults = MC_GetOccurredFaultsMotor1(); if((Motor1State==10)||(Motor1State==11)) { MC_AcknowledgeFaultMotor1(); } MC_StopMotor1(); HAL_Delay(500); MC_ProgramSpeedRampMotor1(-100/6,600); MC_StartMotor1(); HAL_Delay(2000); Motor1Speed = MC_GetMecSpeedReferenceMotor1(); Motor1SpeedAverage = MC_GetMecSpeedAverageMotor1(); Motor1Dir = MC_GetImposedDirectionMotor1(); Motor1State = MC_GetSTMStateMotor1(); Motor1Faults = MC_GetOccurredFaultsMotor1(); if((Motor1State==10)||(Motor1State==11)) { MC_AcknowledgeFaultMotor1(); } MC_StopMotor1(); HAL_Delay(500); } /* USER CODE END 3 */ } |
|
相关推荐
1个回答
|
|
改一下STOPPERMANENCY_MS 宏的值就可以了
|
|
|
|
只有小组成员才能发言,加入小组>>
调试STM32H750的FMC总线读写PSRAM遇到的问题求解?
1213 浏览 1 评论
X-NUCLEO-IHM08M1板文档中输出电流为15Arms,15Arms是怎么得出来的呢?
1228 浏览 1 评论
632 浏览 2 评论
STM32F030F4 HSI时钟温度测试过不去是怎么回事?
477 浏览 2 评论
ST25R3916能否对ISO15693的标签芯片进行分区域写密码?
1157 浏览 2 评论
1686浏览 9评论
STM32仿真器是选择ST-LINK还是选择J-LINK?各有什么优势啊?
344浏览 4评论
STM32F0_TIM2输出pwm2后OLED变暗或者系统重启是怎么回事?
340浏览 3评论
332浏览 3评论
stm32cubemx生成mdk-arm v4项目文件无法打开是什么原因导致的?
311浏览 3评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-9-3 03:18 , Processed in 0.873772 second(s), Total 79, Slave 61 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191