打印
[STM32F0]

有人用过st的powerstep01吗

[复制链接]
1340|5
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
lss1985|  楼主 | 2017-4-24 13:55 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
用stm32的评估板做步进电机控制很好用
现在打算用别的MCU来控制powerstep01,但是程序移植麻烦很大,想请教下各路大神
有搞过类似的大牛吗
沙发
你那个项目怎样了呢?

使用特权

评论回复
板凳
wahahaheihei| | 2020-6-16 23:41 | 只看该作者
官方不是提供了很多例子吗

使用特权

评论回复
地板
wahahaheihei| | 2020-6-16 23:41 | 只看该作者
论坛的游总好像一直在做电机控制开源项目。

使用特权

评论回复
5
mintspring| | 2020-6-18 23:50 | 只看该作者
步进电机非常容易搞定。

使用特权

评论回复
6
grant_jx| | 2020-6-19 23:37 | 只看该作者
还移植啥啊,ST已经写好了底层驱动,你既然是用STM32驱动,直接调用就好了。

去ST官网下载X-CUBE-SPN3对应的软件就好了,

给的驱动函数已经包装的很全面了。
  * @{
  */
///Motor control board id for L6474
#define BSP_MOTOR_CONTROL_BOARD_ID_L6474  (6474)
///Motor control board id for Powerstep01
#define BSP_MOTOR_CONTROL_BOARD_ID_POWERSTEP01 (0001)
///Motor control board id for L6206
#define BSP_MOTOR_CONTROL_BOARD_ID_L6206 (6206)
/**
  * @}
  */


/** @defgroup MOTOR_CONTROL_Exported_Macros
  * @{
  */
#if  defined ( __GNUC__ )
  #ifndef __weak
    #define __weak   __attribute__((weak))
  #endif /* __weak */
#endif /* __GNUC__ */
/**
  * @}
  */

/** @defgroup MOTOR_CONTROL_Weak_Function_Prototypes
  * @{
  */
__weak motorDrv_t* L6474_GetMotorHandle(void);
__weak motorDrv_t* Powerstep01_GetMotorHandle(void);
__weak motorDrv_t* L6206_GetMotorHandle(void);
/**
  * @}
  */   
   
/** @defgroup MOTOR_CONTROL_Exported_Functions
  * @{
  */
void BSP_MotorControl_AttachErrorHandler(void (*callback)(uint16_t));
void BSP_MotorControl_AttachFlagInterrupt(void (*callback)(void));
void BSP_MotorControl_AttachBusyInterrupt(void (*callback)(void));
void BSP_MotorControl_ErrorHandler(uint16_t error);
void BSP_MotorControl_Init(uint16_t  id, uint8_t nbDevices);
void BSP_MotorControl_FlagInterruptHandler(void);
uint16_t BSP_MotorControl_GetAcceleration(uint8_t deviceId);
uint16_t BSP_MotorControl_GetBoardId(void);
uint16_t BSP_MotorControl_GetCurrentSpeed(uint8_t deviceId);
uint16_t BSP_MotorControl_GetDeceleration(uint8_t deviceId);
motorState_t BSP_MotorControl_GetDeviceState(uint8_t deviceId);
uint8_t BSP_MotorControl_GetFwVersion(void);
int32_t BSP_MotorControl_GetMark(uint8_t deviceId);
uint16_t BSP_MotorControl_GetMaxSpeed(uint8_t deviceId);
uint16_t BSP_MotorControl_GetMinSpeed(uint8_t deviceId);
int32_t BSP_MotorControl_GetPosition(uint8_t deviceId);
void BSP_MotorControl_GoHome(uint8_t deviceId);
void BSP_MotorControl_GoMark(uint8_t deviceId);
void BSP_MotorControl_GoTo(uint8_t deviceId, int32_t targetPosition);
void BSP_MotorControl_HardStop(uint8_t deviceId);
void BSP_MotorControl_Move(uint8_t deviceId, motorDir_t direction, uint32_t stepCount);
void BSP_MotorControl_ResetAllDevices(void);
void BSP_MotorControl_Run(uint8_t deviceId, motorDir_t direction);
bool BSP_MotorControl_SetAcceleration(uint8_t deviceId,uint16_t newAcc);
bool BSP_MotorControl_SetDeceleration(uint8_t deviceId, uint16_t newDec);
void BSP_MotorControl_SetHome(uint8_t deviceId);
void BSP_MotorControl_SetMark(uint8_t deviceId);
bool BSP_MotorControl_SetMaxSpeed(uint8_t deviceId, uint16_t newMaxSpeed);
bool BSP_MotorControl_SetMinSpeed(uint8_t deviceId, uint16_t newMinSpeed);
bool BSP_MotorControl_SoftStop(uint8_t deviceId);
void BSP_MotorControl_StepClockHandler(uint8_t deviceId);
void BSP_MotorControl_WaitWhileActive(uint8_t deviceId);
void BSP_MotorControl_CmdDisable(uint8_t deviceId);
void BSP_MotorControl_CmdEnable(uint8_t deviceId);
uint32_t BSP_MotorControl_CmdGetParam(uint8_t deviceId, uint32_t param);
uint16_t BSP_MotorControl_CmdGetStatus(uint8_t deviceId);
void BSP_MotorControl_CmdNop(uint8_t deviceId);
void BSP_MotorControl_CmdSetParam(uint8_t deviceId, uint32_t param, uint32_t value);
uint16_t BSP_MotorControl_ReadStatusRegister(uint8_t deviceId);
void BSP_MotorControl_ReleaseReset(void) ;
void BSP_MotorControl_Reset(void);
void BSP_MotorControl_SelectStepMode(uint8_t deviceId,  motorStepMode_t stepMod);
void BSP_MotorControl_SetDirection(uint8_t deviceId, motorDir_t dir);
void BSP_MotorControl_CmdGoToDir(uint8_t deviceId, motorDir_t dir, int32_t abs_pos);
uint8_t BSP_MotorControl_CheckBusyHw(void);
uint8_t BSP_MotorControl_CheckStatusHw(void);
void BSP_MotorControl_CmdGoUntil(uint8_t deviceId, motorAction_t action, motorDir_t dir, uint32_t speed);
void BSP_MotorControl_CmdHardHiZ(uint8_t deviceId);
void BSP_MotorControl_CmdReleaseSw(uint8_t deviceId, motorAction_t action, motorDir_t dir);
void BSP_MotorControl_CmdResetDevice(uint8_t deviceId);
void BSP_MotorControl_CmdResetPos(uint8_t deviceId);
void BSP_MotorControl_CmdRun(uint8_t deviceId, motorDir_t dir, uint32_t speed);
void BSP_MotorControl_CmdSoftHiZ(uint8_t deviceId);
void BSP_MotorControl_CmdStepClock(uint8_t deviceId, motorDir_t dir);
void BSP_MotorControl_FetchAndClearAllStatus(void);
uint16_t BSP_MotorControl_GetFetchedStatus(uint8_t deviceId);
uint8_t BSP_MotorControl_GetNbDevices(void);
bool BSP_MotorControl_IsDeviceBusy(uint8_t deviceId);
void BSP_MotorControl_SendQueuedCommands(void);
void BSP_MotorControl_QueueCommands(uint8_t deviceId, uint8_t param, int32_t value);
void BSP_MotorControl_WaitForAllDevicesNotBusy(void);
void BSP_MotorControl_BusyInterruptHandler(void);
void BSP_MotorControl_CmdSoftStop(uint8_t deviceId);
void BSP_MotorControl_StartStepClock(uint16_t newFreq);
void BSP_MotorControl_StopStepClock(void);

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

25

主题

92

帖子

2

粉丝