2022-05-16 03:12 AM
Where can i get the firmware of steval-spin3204?? that is, stsw-spin3204.zip.
I have the steval-spin3204 board for testing a motor.
I try to automatically generate the firmware with X-CUBE-MCSDK-Y tool.
Unfornately, I got the error of "freemarker template error" on mc_tasks.c
And, I suffered from this error of "freemarker template error"
I did not solve this error.
stsw-spin3204.zip is more easy for me.
Thanks in advance.
AShin.
2022-05-16 03:16 AM
I try to automatically generate the firmware with X-CUBE-MCSDK-Y tool.
Unfornately, I got the error of "freemarker template error" on mc_tasks.c
And, I suffered from this error of "freemarker template error"
/**
******************************************************************************
* @file mc_tasks.c
* @author Motor Control SDK Team, ST Microelectronics
* @brief This file implements tasks definition
*
******************************************************************************
* @attention
*
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under Ultimate Liberty license
* SLA0044, the "License"; You may not use this file except in compliance with
* the License. You may obtain a copy of the License at:
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
//cstat -MISRAC2012-Rule-21.1
#include "main.h"
//cstat +MISRAC2012-Rule-21.1
#include "mc_type.h"
#include "mc_math.h"
#include "motorcontrol.h"
#include "regular_conversion_manager.h"
#include "mc_interface.h"
#include "digital_output.h"
#include "pwm_common.h"
#include "mc_tasks.h"
#include "parameters_conversion.h"
#include "mcp_config.h"
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
/* USER CODE BEGIN Private define */
/* Private define ------------------------------------------------------------*/
/* Un-Comment this macro define in order to activate the smooth
braking action on over voltage */
/* #define MC.SMOOTH_BRAKING_ACTION_ON_OVERVOLTAGE */
#define CHARGE_BOOT_CAP_MS ((uint16_t)10)
#define CHARGE_BOOT_CAP_MS2 ((uint16_t)10)
#define OFFCALIBRWAIT_MS ((uint16_t)0)
#define OFFCALIBRWAIT_MS2 ((uint16_t)0)
#define STOPPERMANENCY_MS ((uint16_t)400)
#define STOPPERMANENCY_MS2 ((uint16_t)400)
#define CHARGE_BOOT_CAP_TICKS (uint16_t)((SYS_TICK_FREQUENCY * CHARGE_BOOT_CAP_MS) / ((uint16_t)1000))
#define CHARGE_BOOT_CAP_TICKS2 (uint16_t)((SYS_TICK_FREQUENCY * CHARGE_BOOT_CAP_MS2)/ ((uint16_t)1000))
#define OFFCALIBRWAITTICKS (uint16_t)((SYS_TICK_FREQUENCY * OFFCALIBRWAIT_MS) / ((uint16_t)1000))
#define OFFCALIBRWAITTICKS2 (uint16_t)((SYS_TICK_FREQUENCY * OFFCALIBRWAIT_MS2) / ((uint16_t)1000))
#define STOPPERMANENCY_TICKS (uint16_t)((SYS_TICK_FREQUENCY * STOPPERMANENCY_MS) / ((uint16_t)1000))
#define STOPPERMANENCY_TICKS2 (uint16_t)((SYS_TICK_FREQUENCY * STOPPERMANENCY_MS2) / ((uint16_t)1000))
/* USER CODE END Private define */
#define VBUS_TEMP_ERR_MASK ~(MC_OVER_VOLT | MC_UNDER_VOLT | MC_OVER_TEMP)
/* Private variables----------------------------------------------------------*/
static FOCVars_t FOCVars[NBR_OF_MOTORS];
static PWMC_Handle_t *pwmcHandle[NBR_OF_MOTORS];
static CircleLimitation_Handle_t *pCLM[NBR_OF_MOTORS];
//cstat !MISRAC2012-Rule-8.9_a
static RampExtMngr_Handle_t *pREMNG[NBR_OF_MOTORS]; /*!< Ramp manager used to modify the Iq ref
during the start-up switch over.*/
static uint16_t hMFTaskCounterM1 = 0; //cstat !MISRAC2012-Rule-8.9_a
static volatile uint16_t hBootCapDelayCounterM1 = ((uint16_t)0);
static volatile uint16_t hStopPermanencyCounterM1 = ((uint16_t)0);
static volatile uint8_t bMCBootCompleted = ((uint8_t)0);
/* USER CODE BEGIN Private Variables */
/* USER CODE END Private Variables */
/* Private functions ---------------------------------------------------------*/
void TSK_MediumFrequencyTaskM1(void);
void FOC_Clear(uint8_t bMotor);
void FOC_InitAdditionalMethods(uint8_t bMotor);
void FOC_CalcCurrRef(uint8_t bMotor);
void TSK_MF_StopProcessing( MCI_Handle_t * pHandle, uint8_t motor);
MCI_Handle_t * GetMCI(uint8_t bMotor);
static uint16_t FOC_CurrControllerM1(void);
void TSK_SetChargeBootCapDelayM1(uint16_t hTickCount);
bool TSK_ChargeBootCapDelayHasElapsedM1(void);
void TSK_SetStopPermanencyTimeM1(uint16_t hTickCount);
bool TSK_StopPermanencyTimeHasElapsedM1(void);
void TSK_SafetyTask_PWMOFF(uint8_t motor);
/* USER CODE BEGIN Private Functions */
/* USER CODE END Private Functions */
/**
* @brief It initializes the whole MC core according to user defined
* parameters.
* @param pMCIList pointer to the vector of MCInterface objects that will be
* created and initialized. The vector must have length equal to the
* number of motor drives.
* @retval None
*/
__weak void MCboot( MCI_Handle_t* pMCIList[NBR_OF_MOTORS] )
{
/* USER CODE BEGIN MCboot 0 */
/* USER CODE END MCboot 0 */
if (MC_NULL == pMCIList)
{
/* Nothing to do */
}
else
{
bMCBootCompleted = (uint8_t )0;
pCLM[M1] = &CircleLimitationM1;
/**********************************************************/
/* PWM and current sensing component initialization */
/**********************************************************/
pwmcHandle[M1] = &PWM_Handle_M1._Super;
FreeMarker template error (DEBUG mode; use RETHROW in production!):
The following has evaluated to null or missing:
==> PWM_Init [in template "mc_tasks.c.ftl" at line 765, column 7]
----
Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----
----
FTL stack trace ("~" means nesting-related):
- Failed at: ${PWM_Init} [in template "mc_tasks.c.ftl" at line 765, column 5]
----
Java stack trace (for programmers):
----
freemarker.core.InvalidReferenceException: [... Exception message was already printed; see it above ...]
at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:134)
at freemarker.core.EvalUtil.coerceModelToTextualCommon(EvalUtil.java:481)
at freemarker.core.EvalUtil.coerceModelToStringOrMarkup(EvalUtil.java:401)
at freemarker.core.EvalUtil.coerceModelToStringOrMarkup(EvalUtil.java:370)
at freemarker.core.DollarVariable.calculateInterpolatedStringOrMarkup(DollarVariable.java:100)
at freemarker.core.DollarVariable.accept(DollarVariable.java:63)
at freemarker.core.Environment.visit(Environment.java:334)
at freemarker.core.Environment.visit(Environment.java:340)
at freemarker.core.Environment.visit(Environment.java:340)
at freemarker.core.Environment.process(Environment.java:313)
at freemarker.template.Template.process(Template.java:383)
at com.st.microxplorer.codegenerator.CodeEngine.freemarkerDo(CodeEngine.java:333)
at com.st.microxplorer.codegenerator.CodeEngine.genCode(CodeEngine.java:245)
at com.st.microxplorer.codegenerator.CodeGenerator.generateOutputCode(CodeGenerator.java:5062)
at com.st.microxplorer.codegenerator.CodeGenerator.generateSpecificCode(CodeGenerator.java:4367)
2022-05-22 11:50 PM
steval-spin3204 support 6step only. If you want to generate code by MCSDK, you can only use the example code listed below the MCSDK.
2022-05-23 04:48 AM
Many Thanks, Mr. kelvin ****.