4940 views|0 replies

24

Posts

0

Resources
The OP
 

[ST Motor Evaluation] Task 4 - Differences between MCSDK versions v4 and v5 [Copy link]

The difference between MCSDK v5 and v4
This was a bit difficult. After all, you need to have experience with both version 4 and version 5 to understand the differences, or improvements. Moreover, only by using them in depth can you understand the differences in depth.
The first step was to learn some information from the ReleaseNotes, but this information is not enough. Then continue to learn and compare from other places.
The following are the differences or improvements I saw. 1. Simplified operation flow Version 4 requires 2 steps to produce program code: The first step is to generate the STM32CubeMX project, and then use STM32CubeMX to generate the specified IDE project. After that, you can modify the program, compile, download and debug in the IDE. And there is no monitoring that can be directly connected to the board for use. Version 5 has been simplified. STM32CubeMX is directly called in the background to generate code, and then the IDE can be opened for operation. It hides the connection operation of STM32CubeMX in the middle, simplifying the user's operation. However, the code generation and subsequent operation development can still be completed according to the operation of version 4.
As shown in the figure:
This content is originally created by EEWORLD forum netizen stp111. If you need to reprint or use it for commercial purposes, you must obtain the author's consent and indicate the source
2. developedAPIstyle
In version 5, the clanguage development style was used, and the type MCI_Handle_tpointer was used to identify the library interface. The code is as follows:
```
typedef struct
{
STM_Handle_t *pSTM; /*!< State machine object used by MCI.*/
SpeednTorqCtrl_Handle_t *pSTC; /*!< Speed and torque controller object used by MCI.*/
pFOCVars_t pFOCVars; /*!< Pointer to FOC vars used by MCI.*/
MCI_UserCommands_t lastCommand; /*!< Last command coming from the user.*/
int16_t hFinalSpeed; /*!< Final speed of last ExecSpeedRamp command.*/
int16_t hFinalTorque; /*!< Final torque of last ExecTorqueRamp
command.*/
Curr_Components Iqdref; /*!< Current component of last
SetCurrentReferences command.*/
uint16_t hDurationms; /*!< Duration in ms of last ExecSpeedRamp or
ExecTorqueRamp command.*/
MCI_CommandState_t CommandState; /*!< The status of the buffered command.*/
STC_Modality_t LastModalitySetByUser; /*!< The last STC_Modality_t set by the
                                             user. */
} MCI_Handle_t;
```
Hight-levelAPI使用该指针进行操作:
```
/* Exported functions ------------------------------------------------------- */
void MCI_Init( MCI_Handle_t * pHandle, STM_Handle_t *pSTM, SpeednTorqCtrl_Handle_t *pSTC, pFOCVars_t pFOCVars );
void MCI_ExecBufferedCommands( MCI_Handle_t * pHandle );
void MCI_ExecSpeedRamp( MCI_Handle_t * pHandle,  int16_t hFinalSpeed, uint16_t hDurationms );
void MCI_ExecTorqueRamp( MCI_Handle_t * pHandle,  int16_t hFinalTorque, uint16_t hDurationms );
void MCI_SetCurrentReferences( MCI_Handle_t * pHandle,Curr_Components Iqdref );
bool MCI_StartMotor( MCI_Handle_t * pHandle );
bool MCI_StopMotor( MCI_Handle_t * pHandle );
bool MCI_FaultAcknowledged( MCI_Handle_t * pHandle );
bool MCI_EncoderAlign( MCI_Handle_t * pHandle );
MCI_CommandState_t  MCI_IsCommandAcknowledged( MCI_Handle_t * pHandle );
State_t  MCI_GetSTMState( MCI_Handle_t * pHandle );
uint16_t MCI_GetOccurredFaults( MCI_Handle_t * pHandle );
uint16_t MCI_GetCurrentFaults( MCI_Handle_t * pHandle );
int16_t MCI_GetMecSpeedRef01Hz( MCI_Handle_t * pHandle );
int16_t MCI_GetAvrgMecSpeed01Hz( MCI_Handle_t * pHandle );
/*int16_t MCI_GetTorque( MCI_Handle_t * pHandle );*/
int16_t MCI_GetPhaseCurrentAmplitude( MCI_Handle_t * pHandle );
int16_t MCI_GetPhaseVoltageAmplitude( MCI_Handle_t * pHandle );
STC_Modality_t MCI_GetControlMode( MCI_Handle_t * pHandle );
int16_t MCI_GetImposedMotorDirection( MCI_Handle_t * pHandle );
int16_t MCI_GetLastRampFinalSpeed( MCI_Handle_t * pHandle );
bool MCI_RampCompleted( MCI_Handle_t * pHandle );
bool MCI_StopSpeedRamp( MCI_Handle_t * pHandle );
bool MCI_GetSpdSensorReliability( MCI_Handle_t * pHandle );
int16_t MCI_GetAvrgMecSpeed01Hz( MCI_Handle_t * pHandle );
int16_t MCI_GetMecSpeedRef01Hz( MCI_Handle_t * pHandle );
Curr_Components MCI_GetIab( MCI_Handle_t * pHandle );
Curr_Components MCI_GetIalphabeta( MCI_Handle_t * pHandle );
Curr_Components MCI_GetIqd( MCI_Handle_t * pHandle );
Curr_Components MCI_GetIqdHF( MCI_Handle_t * pHandle );
Curr_Components MCI_GetIqdref( MCI_Handle_t * pHandle );
Volt_Components MCI_GetVqd( MCI_Handle_t * pHandle );
Volt_Components MCI_GetValphabeta( MCI_Handle_t * pHandle );
int16_t MCI_GetElAngledpp( MCI_Handle_t * pHandle );
int16_t MCI_GetTeref( MCI_Handle_t * pHandle );
int16_t MCI_GetPhaseCurrentAmplitude( MCI_Handle_t * pHandle );
int16_t MCI_GetPhaseVoltageAmplitude( MCI_Handle_t * pHandle );
void MCI_SetIdref( MCI_Handle_t * pHandle,int16_t hNewIdref );void MCI_Clear_Iqdref( MCI_Handle_t * pHandle );````Version 5 has completely changed to the C++ style. Version 4 uses C++ to emulate C++ and samples the C++ style. So, all the APIs have changed in form. 3. It has been mentioned that in version 5, the SPL from version 4 is replaced by the HAL layer from the STM32CubeMX firmware. But this is included with the STM32Cube and should not be of much concern to the MC_SDK. 4. In version 5, the codes of various features are separated. For example, there is no SixStep API and code related to FOC control; this makes the code more concise, without a large number of macros, and easier to read. For example, the following API code is the API of 6-Step BLDC, but it is missing in the FOC project.
```
MC_SixStep_INIT()
MC_SixStep_RESET()
```
Reference:
UM2124
AN5143
0)]
0)]
This post is from stm32/stm8
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews

Room 1530, Zhongguancun MOOC Times Building, Block B, 18 Zhongguancun Street, Haidian District, Beijing 100190, China Tel:(010)82350740 Postcode:100190

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list