完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛扫一扫,分享给好友
|
你好,
抱歉,我不知道它是如何在Keil源示例中配置的。无论如何,STM32 PMSM FOC SDK v3.0中有一个类似的模块来处理霍尔传感器信号,下面是定时器外设配置的摘录: ... / *设置完整的16位工作范围* / TIM_HALLTimeBaseInitStructure.TIM_Period = U16_MAX; TIM_HALLTimeBaseInitStructure.TIM_ClockDivision = TIM_CKD_DIV1; TIM_TimeBaseInit(TIMX,&安培; TIM_HALLTimeBaseInitStructure); TIM_ICStructInit(安培; TIM_HALLICInitStructure); TIM_HALLICInitStructure.TIM_Channel = TIM_Channel_1; TIM_HALLICInitStructure.TIM_ICPolarity = TIM_ICPolarity_Falling; TIM_HALLICInitStructure.TIM_ICFilter = pDParams_str-> hInpCaptFilter; TIM_ICInit(TIMX,&安培; TIM_HALLICInitStructure); / *从TRC强制输入捕获* / / *禁用通道1:重置CC1E位* / TIMx-> CCER& = CCER_CC1E_Reset; TIMx-> CCMR1 | = 0x03u; / * CCS1 = 0b11; * / TIMx-> CCER | = CCER_CC1E_Set; / *强制TIMx预分频器立即访问(无需更新事件) * / TIM_PrescalerConfig(TIMx,(u16)pDVars_str-> hHALLMaxRatio, TIM_PSCReloadMode_Immediate); TIM_InternalClockConfig(TIMX); / *启用通道1,通道2和通道3的XOR * / TIM_SelectHallSensor(TIMx,ENABLE); TIM_SelectInputTrigger(TIMx,TIM_TS_TI1F_ED); TIM_SelectSlaveMode(TIMX,TIM_SlaveMode_Reset); / * Update事件源只是计数器溢出/下溢* / TIM_UpdateRequestConfig(TIMx,TIM_UpdateSource_Regular); ...使用此设置,每次内部异或H1,H2,H3的每一个上升沿或下降沿时,计数器复位(TI1F_ED,即TI1F_Rising的OR,TI1F_Falling,用作从机的触发输入)模式控制器)并将其最后一个值存储在CCR1中(TRC用于强制捕获)。图77-在STM32参考手册(RM0008)中 - 是解释性的。 关于预分频器,在SDK的霍尔传感器模块中,它会不断调整,以便始终保持最佳分辨率。我邀请您查看用户手册UM1052,图44,45和46。 最好的祝福, 迪诺 有帮助吗? 所以,我的电机速度是5000rpm PSC的最佳配置是什么,计时器没有溢出? //定义计时器时钟 //在最低旋转的霍尔传感器线上的两次变化之间 //速度(例如,最大速度的1/100)定时器不得溢出 //定义计时器计数器时钟 //计时器基本配置// 126 => 3,5s直到溢出; 285,714kHz TimerClock [36MHz /预分频器] TIM_TimeBaseStructure.TIM_Prescaler = 126 ; TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; TIM_TimeBaseStructure.TIM_Period = 65535 ; TIM_TimeBaseStructure.TIM_ClockDivision = 0 ; TIM_TimeBaseStructure.TIM_RepetitionCounter = 0 ; TIM_TimeBaseInit( TIM4,& TIM_TimeBaseStructure) ;我不明白为什么126 以上来自于谷歌翻译 以下为原文 Hello, sorry, I do not know how it's configured in the Keil source example. Anyhow, there's a similar module in the STM32 PMSM FOC SDK v3.0 to handle Hall sensor signals, here below an excerpt of the timer peripheral configuration: ... /* Set full 16-bit working range */ TIM_HALLTimeBaseInitStructure.TIM_Period = U16_MAX; TIM_HALLTimeBaseInitStructure.TIM_ClockDivision = TIM_CKD_DIV1; TIM_TimeBaseInit(TIMx,&TIM_HALLTimeBaseInitStructure); TIM_ICStructInit(&TIM_HALLICInitStructure); TIM_HALLICInitStructure.TIM_Channel = TIM_Channel_1; TIM_HALLICInitStructure.TIM_ICPolarity = TIM_ICPolarity_Falling; TIM_HALLICInitStructure.TIM_ICFilter = pDParams_str->hInpCaptFilter; TIM_ICInit(TIMx,&TIM_HALLICInitStructure); /* Force input capture from TRC */ /* Disable the Channel 1: Reset the CC1E Bit */ TIMx->CCER &= CCER_CC1E_Reset; TIMx->CCMR1 |= 0x03u; /* CCS1 = 0b11; */ TIMx->CCER |= CCER_CC1E_Set; /* Force the TIMx prescaler with immediate access (no need of an update event) */ TIM_PrescalerConfig(TIMx, (u16) pDVars_str->hHALLMaxRatio, TIM_PSCReloadMode_Immediate); TIM_InternalClockConfig(TIMx); /* Enables the XOR of channel 1, channel2 and channel3 */ TIM_SelectHallSensor(TIMx, ENABLE); TIM_SelectInputTrigger(TIMx, TIM_TS_TI1F_ED); TIM_SelectSlaveMode(TIMx,TIM_SlaveMode_Reset); /* Source of Update event is only counter overflow/underflow */ TIM_UpdateRequestConfig(TIMx, TIM_UpdateSource_Regular); ...With this setup, the counter is reset every time there's a rising or falling edge on each of the internally XORed H1,H2,H3 (TI1F_ED, which is the OR of TI1F_Rising and TI1F_Falling, is used as trigger input by the slave mode controller) and its last value is stored in the CCR1 (TRC is used to force a capture). Figure 77 - in the STM32 reference Manual (RM0008) - is explanatory. About the prescaler, in the SDK's Hall sensor module, it's constantly adjusted in order to always have the best resolution. I invite you to have a look at the User Manual UM1052, figures 44, 45 and 46. Best regards, Dino Any help? so, my motor speed is 5000rpm what is the best config of PSC for timer not overflow? // define timer clock // between two changes on the hall sensor lines on the lowest rotation // speed (eg. 1/100 from max. speed) the timer must not overflow // define timer counter clock appropriate // timer base configuration // 126 => 3,5s till overflow ; 285,714kHz TimerClock [36MHz/Prescaler] TIM_TimeBaseStructure.TIM_Prescaler = 126 ; TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; TIM_TimeBaseStructure.TIM_Period = 65535 ; TIM_TimeBaseStructure.TIM_ClockDivision = 0 ; TIM_TimeBaseStructure.TIM_RepetitionCounter = 0 ; TIM_TimeBaseInit( TIM4, &TIM_TimeBaseStructure) ; i not understand why 126 |
|
|
|
|
|
你好,
源名称为''HALL_SpeednPosFdbkClass.c'',它属于MC库,是您下载的SDK Web分发中的编译层。该层的源代码 - 除了无传感器状态观察器等特定算法外 - 包含在SDK保密分发中,可以通过联系离您最近的ST销售办事处或支持团队免费和按需获得。 最好的祝福, 迪诺 以上来自于谷歌翻译 以下为原文 Hello, the source name is ''HALL_SpeednPosFdbkClass.c'' and it belongs to the MC library, a compiled layer in the SDK web distribution you have downloaded. Source code of this layer - with the exception of specific algorithms such as the sensorless state observer - is included in the SDK confidential distribution, free of charge and on demand by contacting your nearest ST sales office or support team. Best regards, Dino |
|
|
|
|
只有小组成员才能发言,加入小组>>
stm32mp157的异核通信的rpmsg_sdb的m4固件和a7驱动该如何编写?
1476 浏览 0 评论
stm32f103用freertos对一个采样率为1kHz的传感器,进行采样,数据出差
1531 浏览 0 评论
请教:在使用UDE STK时,单片机使用SPC560D30L1,在配置文件怎么设置或选择?里面只有SPC560D40的选项
3678 浏览 1 评论
3871 浏览 1 评论
请问是否有通过UART连接的两个微处理器之间实现双向值交换的方法?
2485 浏览 1 评论
STM32H7打开DCache后,出现了串口接收信息为空的现象,是哪里出了问题?
757浏览 5评论
用NANO STM32F103RBT6的开发板烧录不了是哪里出了问题?
689浏览 5评论
732浏览 5评论
外部中断触发类型为双边沿触发,进入中断回调后有什么办法判断该边沿是上升沿还是下降沿?
986浏览 5评论
STM32L071CBT6低温环境下无法正常工作是什么原因引起的?
788浏览 5评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-18 04:22 , Processed in 0.632629 second(s), Total 74, Slave 57 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
3484