diff options
| author | Avi Levkovich <avi@twine-s.com> | 2018-05-13 12:03:21 +0300 |
|---|---|---|
| committer | Avi Levkovich <avi@twine-s.com> | 2018-05-13 12:03:21 +0300 |
| commit | e74f4da5899eea9abea143771fa2a950a50da963 (patch) | |
| tree | 72be008fda9e7ef36ab501c375bd7f1834afe0b4 /Software/Embedded_SW/Embedded | |
| parent | 93b67561169bb5d2cc5696e3f723aa98ad0523c0 (diff) | |
| download | Tango-e74f4da5899eea9abea143771fa2a950a50da963.tar.gz Tango-e74f4da5899eea9abea143771fa2a950a50da963.zip | |
Use only motor hardware enum + stop using the AMT_OF_Words in the spi communication
Diffstat (limited to 'Software/Embedded_SW/Embedded')
5 files changed, 213 insertions, 95 deletions
diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c index 4d4993952..476289568 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c @@ -8,6 +8,7 @@ #include "Drivers/Motors/Motor.h" #include "modules/control/millisecTask.h" #include "drivers/Heater/TemperatureSensor.h" +#include "PMR/Hardware/HardwareMotor.pb-c.h" extern TempSensorResponseStruct TempSensorResponse[MAX_TEMPERATURE_SENSOR_ID]; @@ -102,13 +103,17 @@ uint8_t FPGA_SPI_Transnit(TimerMotors_t _motorId) { INT2SHORT Int2Short; - if((*FpgaMotMap[_motorId].NBUSY == NOTBUSY) && (*FpgaMotMap[_motorId].SPI_Busy == NOTBUSY)) + //*FpgaMotMap[_motorId].WORDS = 4; + + //if((*FpgaMotMap[_motorId].NBUSY == NOTBUSY) && (*FpgaMotMap[_motorId].SPI_Busy == NOTBUSY)) { Int2Short.uint = Fpga_Spi[_motorId].TX_MOSI; *FpgaMotMap[_motorId].TX_01 = Int2Short.ushort.MSB; + //SysCtlDelay(1); *FpgaMotMap[_motorId].TX_00 = Int2Short.ushort.LSB; - *FpgaMotMap[_motorId].WORDS = Fpga_Spi[_motorId].AMT_OF_Words; + // SysCtlDelay(100); + //*FpgaMotMap[_motorId].WORDS = Fpga_Spi[_motorId].AMT_OF_Words; } return OK; } @@ -130,28 +135,32 @@ uint8_t FPGA_SPI_Receive(TimerMotors_t _motorId) void FPGA_GetClrMotStat_Cmd(TimerMotors_t _motorId) { Fpga_Spi[_motorId].TX_MOSI = x_GET_STATUS; - Fpga_Spi[_motorId].AMT_OF_Words = 1; + Fpga_Spi[_motorId].TX_MOSI = Fpga_Spi[_motorId].TX_MOSI << 8;// move the command to the MSB TODO necessary??? + //Fpga_Spi[_motorId].AMT_OF_Words = 1; FPGA_SPI_Transnit(_motorId); } void FPGA_GetMotSpeed_Cmd(TimerMotors_t _motorId) { Fpga_Spi[_motorId].TX_MOSI = x_GET_PARAM | x_SPEED; - Fpga_Spi[_motorId].AMT_OF_Words = 1; + Fpga_Spi[_motorId].TX_MOSI = Fpga_Spi[_motorId].TX_MOSI << 8;// move the command to the MSB TODO necessary??? + //Fpga_Spi[_motorId].AMT_OF_Words = 1; FPGA_SPI_Transnit(_motorId); } void FPGA_GetMotPosition_Cmd(TimerMotors_t _motorId) { Fpga_Spi[_motorId].TX_MOSI = x_GET_PARAM | x_ABS_POS; - Fpga_Spi[_motorId].AMT_OF_Words = 1; + Fpga_Spi[_motorId].TX_MOSI = Fpga_Spi[_motorId].TX_MOSI << 8;// move the command to the MSB TODO necessary??? + //Fpga_Spi[_motorId].AMT_OF_Words = 1; FPGA_SPI_Transnit(_motorId); } void FPGA_GetMotMicroSteps_Cmd(TimerMotors_t _motorId) { Fpga_Spi[_motorId].TX_MOSI = x_GET_PARAM | x_STEP_MODE; - Fpga_Spi[_motorId].AMT_OF_Words = 1; + Fpga_Spi[_motorId].TX_MOSI = Fpga_Spi[_motorId].TX_MOSI << 8;// move the command to the MSB TODO necessary??? + //Fpga_Spi[_motorId].AMT_OF_Words = 1; FPGA_SPI_Transnit(_motorId); } @@ -342,7 +351,7 @@ int MotorSendFPGARequest(TimerMotors_t MotorId,uint32_t Data, uint32_t Length) *FpgaMotMap[MotorId].TX_01 = Int2Short.ushort.MSB; *FpgaMotMap[MotorId].TX_00 = Int2Short.ushort.LSB; - *FpgaMotMap[MotorId].WORDS = Length; + //*FpgaMotMap[MotorId].WORDS = Length; return OK; } @@ -380,35 +389,114 @@ uint32_t FPGA_MotorConfig(TimerMotors_t _motorId, MotorDriverConfigStruc *MotorC uint32_t temp; if( MillisecWriteToMotor(_motorId, x_HARD_HIZ, 1, NULL) < 0 ) return ERROR; temp = x_SET_PARAM | x_ACC; - temp = temp << 12; - temp |= MotorDriverCfg[_motorId].ACC; - if( MillisecWriteToMotor(_motorId, temp, 3, NULL) < 0 ) return ERROR; + temp = temp << 24; + temp |= ((int)(MotorDriverCfg[_motorId].maxchangeslope)<<8); + if( MillisecWriteToMotor(_motorId, temp, 4, NULL) < 0 ) return ERROR; temp = x_SET_PARAM | x_DEC; - temp = temp << 12; - temp |= MotorDriverCfg[_motorId].DEC; - if( MillisecWriteToMotor(_motorId, temp, 3, NULL) < 0 ) return ERROR; + temp = temp << 24; + temp |= ((int)(MotorDriverCfg[_motorId].maxchangeslope)<<8); + if( MillisecWriteToMotor(_motorId, temp, 4, NULL) < 0 ) return ERROR; temp = x_SET_PARAM | x_MAX_SPEED; - temp = temp << 10; - temp |= MotorDriverCfg[_motorId].MaxSpeed; - if( MillisecWriteToMotor(_motorId, temp, 3, NULL) < 0 ) return ERROR; + temp = temp << 24; + temp |= MotorDriverCfg[_motorId].maxfrequency<<8; + if( MillisecWriteToMotor(_motorId, temp, 4, NULL) < 0 ) return ERROR; - if(MotorDriverCfg[_motorId].HasMicroStep) + if(MotorDriverCfg[_motorId].has_microstep) { temp = x_SET_PARAM | x_STEP_MODE; - temp = temp << 8; - temp |= !x_SYNC_EN | MotorDriverCfg[_motorId].Microstep | x_SYNC_SEL_1; - if( MillisecWriteToMotor(_motorId, temp, 2, NULL) < 0 ) return ERROR; + temp = temp << 24; + temp |= (!x_SYNC_EN | MotorDriverCfg[_motorId].microstep | x_SYNC_SEL_1)<<16; + if( MillisecWriteToMotor(_motorId, temp, 4, NULL) < 0 ) return ERROR; } - if(MotorDriverCfg[_motorId].HasConfigWord) + if(MotorDriverCfg[_motorId].has_configword) { temp = x_SET_PARAM | x_CONFIG; temp = temp << 24; - temp |= MotorDriverCfg[_motorId].ConfigWord; + temp |= MotorDriverCfg[_motorId].configword<<8; + if( MillisecWriteToMotor(_motorId, temp, 4, NULL) < 0 ) return ERROR; + } + /////////////////////////////////////////////////////////////// + + if(MotorDriverCfg[_motorId].has_kvalhold) + { + temp = x_SET_PARAM | x_KVAL_HOLD; + temp = temp << 24; + temp |= MotorDriverCfg[_motorId].kvalhold<<16; + if( MillisecWriteToMotor(_motorId, temp, 4, NULL) < 0 ) return ERROR; + } + if(MotorDriverCfg[_motorId].has_kvalrun) + { + temp = x_SET_PARAM | x_KVAL_RUN; + temp = temp << 24; + temp |= MotorDriverCfg[_motorId].kvalrun<<16; + if( MillisecWriteToMotor(_motorId, temp, 4, NULL) < 0 ) return ERROR; + } + if(MotorDriverCfg[_motorId].has_kvalacc) + { + temp = x_SET_PARAM | x_KVAL_ACC; + temp = temp << 24; + temp |= MotorDriverCfg[_motorId].kvalacc<<16; + if( MillisecWriteToMotor(_motorId, temp, 4, NULL) < 0 ) return ERROR; + } + if(MotorDriverCfg[_motorId].has_kvaldec) + { + temp = x_SET_PARAM | x_KVAL_DEC; + temp = temp << 24; + temp |= MotorDriverCfg[_motorId].kvaldec<<16; + if( MillisecWriteToMotor(_motorId, temp, 4, NULL) < 0 ) return ERROR; + } + + /////////////////////////////////////////////////////////////// + if(MotorDriverCfg[_motorId].has_stslp) + { + temp = x_SET_PARAM | x_ST_SLP; + temp = temp << 24; + temp |= MotorDriverCfg[_motorId].stslp<<16; + if( MillisecWriteToMotor(_motorId, temp, 4, NULL) < 0 ) return ERROR; + } + if(MotorDriverCfg[_motorId].has_intspd) + { + temp = x_SET_PARAM | x_INT_SPD; + temp = temp << 24; + temp |= MotorDriverCfg[_motorId].intspd<<8; + if( MillisecWriteToMotor(_motorId, temp, 4, NULL) < 0 ) return ERROR; + } + if(MotorDriverCfg[_motorId].has_fnslpacc) + { + temp = x_SET_PARAM | x_FN_SLP_ACC; + temp = temp << 24; + temp |= MotorDriverCfg[_motorId].fnslpacc<<16; + if( MillisecWriteToMotor(_motorId, temp, 4, NULL) < 0 ) return ERROR; + } + if(MotorDriverCfg[_motorId].has_fnslpdec) + { + temp = x_SET_PARAM | x_FN_SLP_DEC; + temp = temp << 24; + temp |= MotorDriverCfg[_motorId].fnslpdec<<16; if( MillisecWriteToMotor(_motorId, temp, 4, NULL) < 0 ) return ERROR; } + if(MotorDriverCfg[_motorId].has_overcurrentthreshold) + { + temp = x_SET_PARAM | x_OCD_TH; + temp = temp << 24; + temp |= MotorDriverCfg[_motorId].overcurrentthreshold<<16; + if( MillisecWriteToMotor(_motorId, temp, 4, NULL) < 0 ) return ERROR; + } + + /////////////////////////////////////////////////////////////// +/* + protobuf_c_boolean has_overcurrentthreshold; + int32_t overcurrentthreshold; + protobuf_c_boolean has_stallthreshold; + int32_t stallthreshold; + protobuf_c_boolean has_thermalcompensationfactor; + int32_t thermalcompensationfactor; + protobuf_c_boolean has_lowspeedoptimization; + protobuf_c_boolean lowspeedoptimization; +*/ return OK; } @@ -424,8 +512,8 @@ void FPGA_SetMotSpeed(TimerMotors_t _motorId)//Run MotorDriverRequest[_motorId].Speed = 0xFFFFF; temp |= MotorDriverRequest[_motorId].Speed; - Fpga_Spi[_motorId].TX_MOSI = temp; - Fpga_Spi[_motorId].AMT_OF_Words = 4; + Fpga_Spi[_motorId].TX_MOSI = temp;//<<8; + //Fpga_Spi[_motorId].AMT_OF_Words = 4; FPGA_SPI_Transnit(_motorId); } @@ -442,7 +530,7 @@ void FPGA_SetMotPosition(TimerMotors_t _motorId)//Mov temp |= MotorDriverRequest[_motorId].Position; Fpga_Spi[_motorId].TX_MOSI = temp; - Fpga_Spi[_motorId].AMT_OF_Words = 4; + //Fpga_Spi[_motorId].AMT_OF_Words = 4; FPGA_SPI_Transnit(_motorId); } @@ -451,7 +539,8 @@ void FPGA_SetGoMotHome(TimerMotors_t _motorId) { Fpga_Spi[_motorId].TX_MOSI = x_GO_HOME; //TODO to check how to set the number of bytes to send - Fpga_Spi[_motorId].AMT_OF_Words = 1; + Fpga_Spi[_motorId].TX_MOSI = Fpga_Spi[_motorId].TX_MOSI << 8;// move the command to the MSB TODO necessary??? + //Fpga_Spi[_motorId].AMT_OF_Words = 1; FPGA_SPI_Transnit(_motorId); } @@ -459,8 +548,6 @@ void FPGA_SetGoMotHome(TimerMotors_t _motorId) void FPGA_SetMotStop(TimerMotors_t _motorId) { - Fpga_Spi[_motorId].TX_MOSI = x_GO_HOME; //TODO to check how to set the number of bytes to send - switch(MotorDriverRequest[_motorId].Stop) { case Hard_Stop: @@ -480,8 +567,8 @@ void FPGA_SetMotStop(TimerMotors_t _motorId) break; } - Fpga_Spi[_motorId].TX_MOSI = Fpga_Spi[_motorId].TX_MOSI << 8;// move the command to the MSB TODO necessary??? - Fpga_Spi[_motorId].AMT_OF_Words = 1;//TODO ? + Fpga_Spi[_motorId].TX_MOSI = Fpga_Spi[_motorId].TX_MOSI << 24;// move the command to the MSB TODO necessary??? + //Fpga_Spi[_motorId].AMT_OF_Words = 1;//TODO ? FPGA_SPI_Transnit(_motorId); } diff --git a/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.h b/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.h index 310bbd2af..86dd570b1 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.h +++ b/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.h @@ -10,6 +10,7 @@ #include "include.h" //#include "Modules/thread/thread.h" #include "PMR/Hardware/HardwareMotorType.pb-c.h" +#include "PMR/Hardware/HardwareMotor.pb-c.h" #include <stdint.h> #include <stdbool.h> @@ -46,7 +47,7 @@ // double hightimeoutusec; //}MotorDriverConfigStruc; -typedef struct +/*typedef struct { uint32_t ACC; //set uint32_t DEC; //set @@ -55,19 +56,33 @@ typedef struct uint32_t Microstep; //set bool HasConfigWord; uint16_t ConfigWord; //set - uint32_t Min_Speed_LSPD_OPT; - bool Has_Min_Speed_LSPD_OPT; - uint32_t KVAL_HOLD ; - uint32_t KVAL_RUN ; - uint32_t KVAL_ACC ; - uint32_t KVAL_DEC ; - uint32_t ST_SLP ; - uint32_t INT_SPD ; - uint32_t FN_SLP_ACC ; - uint32_t FN_SLP_DEC ; - + bool has_kvalhold; + int32_t kvalhold; + bool has_kvalrun; + int32_t kvalrun; + bool has_kvalacc; + int32_t kvalacc; + bool has_kvaldec; + int32_t kvaldec; + bool has_overcurrentthreshold; + int32_t overcurrentthreshold; + bool has_stallthreshold; + int32_t stallthreshold; + bool has_thermalcompensationfactor; + int32_t thermalcompensationfactor; + bool has_lowspeedoptimization; + bool lowspeedoptimization; + bool has_stslp; + int32_t stslp; + bool has_intspd; + int32_t intspd; + bool has_fnslpacc; + int32_t fnslpacc; + bool has_fnslpdec; + int32_t fnslpdec; }MotorDriverConfigStruc; - +*/ +#define MotorDriverConfigStruc HardwareMotor typedef struct { bool Direction; diff --git a/Software/Embedded_SW/Embedded/Drivers/SPI/SPI_Comm.c b/Software/Embedded_SW/Embedded/Drivers/SPI/SPI_Comm.c index efc9b932c..111799bce 100644 --- a/Software/Embedded_SW/Embedded/Drivers/SPI/SPI_Comm.c +++ b/Software/Embedded_SW/Embedded/Drivers/SPI/SPI_Comm.c @@ -14,6 +14,7 @@ //#include "graphics_adapter.h" #include "drivers/FPGA/Moters_Driver/L6470.h" +#include "PMR/Hardware/HardwareMotor.pb-c.h" //#include "drivers/FPGA/FPGA_Comm.h" @@ -431,11 +432,11 @@ void setup(MotorDriverConfigStruc *MotorConfig) } } - if(MotorConfig->HasMicroStep) + if(MotorConfig->has_microstep) { SetParam(x_STEP_MODE, !x_SYNC_EN | - MotorConfig->Microstep | + MotorConfig->microstep | x_SYNC_SEL_1); } else @@ -481,9 +482,9 @@ void setup(MotorDriverConfigStruc *MotorConfig) } } - if(MotorConfig->MaxSpeed !=0) + if(MotorConfig->maxfrequency !=0) { - SetParam(x_MAX_SPEED, MaxSpdCalc(MotorConfig->MaxSpeed)); + SetParam(x_MAX_SPEED, MaxSpdCalc(MotorConfig->maxfrequency)); } else { @@ -568,8 +569,8 @@ void setup(MotorDriverConfigStruc *MotorConfig) } // ACC + DEC writable only when motor is stopped - if(MotorConfig->ACC != 0) - SetParam(x_ACC, MotorConfig->ACC);//roll-over after 0x7F - 7 bit ??? (should be 12 bit) AVI + if(MotorConfig->maxchangeslope != 0) + SetParam(x_ACC, MotorConfig->maxchangeslope);//roll-over after 0x7F - 7 bit ??? (should be 12 bit) AVI else SetParam(x_ACC, 0x0FF); /* if(request->set_acc) @@ -594,8 +595,8 @@ void setup(MotorDriverConfigStruc *MotorConfig) } - if(MotorConfig->DEC != 0) - SetParam(x_DEC, MotorConfig->DEC);//roll-over after 0x7F - 7 bit ??? (should be 12 bit) AVI + if(MotorConfig->maxchangeslope != 0) + SetParam(x_DEC, MotorConfig->maxchangeslope);//roll-over after 0x7F - 7 bit ??? (should be 12 bit) AVI else SetParam(x_DEC, 0x0FF); @@ -610,7 +611,7 @@ void setup(MotorDriverConfigStruc *MotorConfig) } */ - if(MotorConfig->HasConfigWord) + if(MotorConfig->has_configword) { //while(SSIBusy(SSI2_BASE)){}; timeout = SSI_SPI_TIMEOUT; @@ -624,7 +625,7 @@ void setup(MotorDriverConfigStruc *MotorConfig) } } - SetParam(x_CONFIG, MotorConfig->ConfigWord);//roll-over after 0x7F - 7 bit ??? (should be 12 bit) AVI + SetParam(x_CONFIG, MotorConfig->configword);//roll-over after 0x7F - 7 bit ??? (should be 12 bit) AVI } // Configure the overcurrent detection threshold. The constants @@ -641,7 +642,13 @@ void setup(MotorDriverConfigStruc *MotorConfig) } } - SetParam(x_OCD_TH, x_OCD_TH_3000mA); + if(MotorConfig->has_overcurrentthreshold) + { + while(SSIBusy(SSI2_BASE)){}; + SetParam(x_OCD_TH, MotorConfig->overcurrentthreshold); + } + else + SetParam(x_OCD_TH, x_OCD_TH_3000mA); // Set up the CONFIG register as follows: // PWM frequency divisor = 1 diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Motor.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Motor.c index fef551748..e6c47597a 100644 --- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Motor.c +++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Motor.c @@ -48,11 +48,13 @@ #include "Modules/thread/thread.h" #include "Drivers/Motors/Motor.h" +#include "drivers/FPGA/FPGA_SPI_Comm.h" + extern unsigned long Run_Value ; extern unsigned long Pos_Value ; extern bool Direction ; -unsigned char Stop_Command = 0 ; +STOP_TYPE_ENUM Stop_Command; int Global_EVB_Motor_Id; @@ -71,30 +73,51 @@ void Stub_MotorInitRequest(MessageContainer* requestContainer) init_BUSY_Pin(); //while(SSIBusy(SSI2_BASE)){}; //init_BUSY_Pin(); -/* - * typedef struct -{ - uint32_t ACC; //set - uint32_t DEC; //set - uint32_t MaxSpeed; //set - bool HasMicroStep; - uint32_t Microstep; //set - bool HasConfigWord; - uint16_t ConfigWord; //set -}MotorDriverConfigStruc; - * */ + +#else + + MotorsInit(); + SysCtlDelay(20000); + //MotorConfig(request->motor_id, &MotorConfig); + +#endif + // MotorsConfigMessage already calls setup!!!!!!!!! MotorDriverConfigStruc MotorDriverConfig; - MotorDriverConfig.ACC = request->acc; - MotorDriverConfig.DEC = request->dec; - MotorDriverConfig.MaxSpeed = request->max_speed; - MotorDriverConfig.HasMicroStep = request->has_micro_steps; - MotorDriverConfig.HasConfigWord = false; - if ( MotorDriverConfig.HasMicroStep) - MotorDriverConfig.Microstep = request->micro_steps; + MotorDriverConfig.maxchangeslope = request->acc; + MotorDriverConfig.maxchangeslope = request->dec; + MotorDriverConfig.maxfrequency = request->max_speed; + MotorDriverConfig.has_setmicrostep = request->has_micro_steps; + + if ( MotorDriverConfig.has_setmicrostep) + MotorDriverConfig.microstep = request->micro_steps; // else // MotorDriverConfig.Microstep = 2; + //MotorDriverConfig.HasConfigWord = false; + + + MotorDriverConfig.has_configword = request->has_config; + MotorDriverConfig.configword = request->config; + MotorDriverConfig.has_lowspeedoptimization = request->has_min_speed_lspd_opt; + MotorDriverConfig.lowspeedoptimization = request->has_min_speed_lspd_opt; + MotorDriverConfig.kvalhold = request->kval_hold; + MotorDriverConfig.kvalrun = request->kval_run; + MotorDriverConfig.kvalacc = request->kval_acc; + MotorDriverConfig.kvaldec = request->kval_dec; + MotorDriverConfig.stslp = request->st_slp; + MotorDriverConfig.intspd = request->int_spd; + MotorDriverConfig.fnslpacc = request->fn_slp_acc; + MotorDriverConfig.fnslpdec = request->fn_slp_dec; + + +#ifdef EVALUATION_BOARD + Global_EVB_Motor_Id = request->motor_id; setup(&MotorDriverConfig); +#else + TimerMotors_t MotorId =(TimerMotors_t) request->motor_id; + + //MotorConfig(MotorId, &MotorDriverConfig); ------------------------------ to open !!!!!!!!!!!!!!!!!!!!!!1 +#endif //setup(); @@ -116,19 +139,10 @@ void Stub_MotorInitRequest(MessageContainer* requestContainer) //SPI_Control(); //temp_init_spi2(); -#endif - - -#ifndef EVALUATION_BOARD - -MotorsInit(); -SysCtlDelay(20000); -//MotorConfig(request->motor_id, &MotorConfig); - -#endif +/* HardwareMotor MotorConfig; HardwareMotorType Motor_Id = (HardwareMotorType)request->motor_id; @@ -137,8 +151,8 @@ SysCtlDelay(20000); MotorConfig.maxfrequency = request->max_speed; MotorConfig.microstep = request->micro_steps; MotorsConfigMessage(&MotorConfig); +*/ - Global_EVB_Motor_Id = request->motor_id; @@ -197,6 +211,9 @@ void Stub_MotorRunRequest(MessageContainer* requestContainer) //status = FPGA_ReadVersion((unsigned char)request->fpgaid, &Version, &Year, &Month, &Day); #else TimerMotors_t Motor_Id = (TimerMotors_t)request->motor_id; //to remove warning + + FPGA_GetBusy(); + MotorSetDirection(Motor_Id,Direction); MotorSetSpeed(Motor_Id, Run_Value, 1); #endif @@ -270,7 +287,7 @@ void Stub_MotorStopRequest(MessageContainer* requestContainer) StubMotorStopRequest* request = stub_motor_stop_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data); - Stop_Command = request->stop_cmd; + Stop_Command = (STOP_TYPE_ENUM)request->stop_cmd; #ifdef EVALUATION_BOARD diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c index 5a8c3df76..0e276fe92 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c @@ -51,7 +51,6 @@ uint32_t MotorsConfigMessage(HardwareMotor * request) { uint32_t status = PASSED; TimerMotors_t Motor_i; - MotorDriverConfigStruc MotorDriverConfig; Motor_i = request->hardwaremotortype; /*for (i=0;i<MAX_THREAD_MOTORS_NUM;i++) { @@ -69,15 +68,8 @@ uint32_t MotorsConfigMessage(HardwareMotor * request) //if (Motor_i< MAX_THREAD_MOTORS_NUM) //{ memcpy (&MotorsCfg[Motor_i],request,sizeof(HardwareMotor)); - MotorDriverConfig.ACC = MotorsCfg[Motor_i].maxchangeslope; - MotorDriverConfig.DEC = MotorsCfg[Motor_i].maxchangeslope; - MotorDriverConfig.MaxSpeed = MotorsCfg[Motor_i].maxfrequency; - MotorDriverConfig.HasMicroStep = MotorsCfg[Motor_i].has_microstep; - MotorDriverConfig.Microstep = MotorsCfg[Motor_i].microstep; - MotorDriverConfig.HasConfigWord = MotorsCfg[Motor_i].has_configword; - MotorDriverConfig.ConfigWord = MotorsCfg[Motor_i].configword; - status = MotorConfig( Motor_i, &MotorDriverConfig); + status = MotorConfig( Motor_i, &MotorsCfg[Motor_i]); // if (Motor_i == MOTOR_RDRIVING) // ThreadInitialTestStub(request); |
