diff options
| author | Avi Levkovich <avi@twine-s.com> | 2020-06-23 16:24:47 +0300 |
|---|---|---|
| committer | Avi Levkovich <avi@twine-s.com> | 2020-06-23 16:24:47 +0300 |
| commit | 5c9feefa07d31b521beef374697fbda7111816aa (patch) | |
| tree | ceb2aedeebfcfbeb7ea8702bee880ee08deb8c16 /Software/Embedded_SW/Embedded | |
| parent | 6138caa64d75f6580790095e1cdbbb00ed58d795 (diff) | |
| download | Tango-5c9feefa07d31b521beef374697fbda7111816aa.tar.gz Tango-5c9feefa07d31b521beef374697fbda7111816aa.zip | |
Addd define and logic for emc testing with motors internal clock (EMC_FORCE_MOT_CLOCK_INTERNAL)
Diffstat (limited to 'Software/Embedded_SW/Embedded')
5 files changed, 36 insertions, 8 deletions
diff --git a/Software/Embedded_SW/Embedded/DataDef.h b/Software/Embedded_SW/Embedded/DataDef.h index 045bb2349..af252d9b5 100644 --- a/Software/Embedded_SW/Embedded/DataDef.h +++ b/Software/Embedded_SW/Embedded/DataDef.h @@ -26,6 +26,8 @@ #define USE_POWERSTEP01 +//#define EMC_FORCE_MOT_CLOCK_INTERNAL + //#define VAC_TEST //#define SPECIAL_DISPENSERS 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 9255a3c4f..a10c9fa1e 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c @@ -692,7 +692,15 @@ uint32_t FPGA_MotorConfig_callback(TimerMotors_t _motorId, uint32_t ReadValue) if(MotorsCfg[_motorId].has_p01configword == true) { - temp |= MotorsCfg[_motorId].p01configword<<8; + if( (_motorId == HARDWARE_MOTOR_TYPE__MOTO_LDRIVING) || (_motorId == HARDWARE_MOTOR_TYPE__MOTO_RDRIVING) || + (_motorId == HARDWARE_MOTOR_TYPE__MOTO_SCREW) || (_motorId == HARDWARE_MOTOR_TYPE__MOTO_SCREW) ) + { + #ifdef EMC_FORCE_MOT_CLOCK_INTERNAL + temp |= (MotorsCfg[_motorId].p01configword & ~(0x000F))<<8; + #else + temp |= MotorsCfg[_motorId].p01configword<<8; + #endif + } MillisecWriteToMotor(_motorId, temp, 4, FPGA_MotorConfig_callback); } else//backward compatibility @@ -717,8 +725,16 @@ uint32_t FPGA_MotorConfig_callback(TimerMotors_t _motorId, uint32_t ReadValue) } else { - //temp |= 0x1C8F<<8;//need to change in current mode? - temp |= (0x1C80 | (MotorsCfg[_motorId].configword & 0x000F)) <<8;// + if( (_motorId == HARDWARE_MOTOR_TYPE__MOTO_LDRIVING) || (_motorId == HARDWARE_MOTOR_TYPE__MOTO_RDRIVING) || + (_motorId == HARDWARE_MOTOR_TYPE__MOTO_SCREW) || (_motorId == HARDWARE_MOTOR_TYPE__MOTO_SCREW) ) + { + #ifdef EMC_FORCE_MOT_CLOCK_INTERNAL + temp |= 0x1C80<<8; + #else + temp |= (0x1C80 | (MotorsCfg[_motorId].configword & 0x000F)) <<8; + #endif + + } MillisecWriteToMotor(_motorId, temp, 4, FPGA_MotorConfig_callback); } } diff --git a/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.c b/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.c index 190d564e0..8fb0fc573 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.c +++ b/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.c @@ -73,10 +73,18 @@ uint32_t MotorsInit(void) } //option to change itafter initialization (to solve EMC issues) in the function Control_motors_clock_source - F3_Moto_Clk_Src_Sel.Motor.LDRIVING = EXTERNAL; - F3_Moto_Clk_Src_Sel.Motor.RDRIVING = EXTERNAL; - F3_Moto_Clk_Src_Sel.Motor.SCREW = EXTERNAL; - F3_Moto_Clk_Src_Sel.Motor.WINDER = EXTERNAL; + #ifdef EMC_FORCE_MOT_CLOCK_INTERNAL + F3_Moto_Clk_Src_Sel.Motor.LDRIVING = INTERNAL; + F3_Moto_Clk_Src_Sel.Motor.RDRIVING = INTERNAL; + F3_Moto_Clk_Src_Sel.Motor.SCREW = INTERNAL; + F3_Moto_Clk_Src_Sel.Motor.WINDER = INTERNAL; + #else + F3_Moto_Clk_Src_Sel.Motor.LDRIVING = EXTERNAL; + F3_Moto_Clk_Src_Sel.Motor.RDRIVING = EXTERNAL; + F3_Moto_Clk_Src_Sel.Motor.SCREW = EXTERNAL; + F3_Moto_Clk_Src_Sel.Motor.WINDER = EXTERNAL; + #endif + F3_MOTO_CLK_SRC_SEL = F3_Moto_Clk_Src_Sel.ushort; return OK; diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index 0e3bf95a4..80ca05cb7 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -123,7 +123,7 @@ uint32_t InternalWindingConfigMessage(JobSpool* request) InternalWinderCfg.diameter = request->diameter; usnprintf(ScrewStr, 150, "WindingConfig start,offset,head,tail {, %d, %d, %d, %d, %d}",InternalWinderCfg.startoffsetpulses,(int)InternalWinderCfg.segmentoffsetpulses, (int)InternalWinderCfg.spoolbackingrate,(int)InternalWinderCfg.SpoolBottomBackingRate,(int)(InternalWinderCfg.NumberOfRotationPerPassage*1000)); - Report(ScrewStr,__FILE__,__LINE__,(int)InternalWinderCfg.diameter,RpWarning,(int)(InternalWinderCfg.NumberOfRotationPerPassage*1000), 0); + Report(ScrewStr,__FILE__,__LINE__,(int)InternalWinderCfg.startoffsetpulses,RpWarning,(int)(InternalWinderCfg.NumberOfRotationPerPassage*1000), 0); return status; } diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c index b5715ca0a..48ade0798 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c @@ -417,6 +417,7 @@ uint32_t ThreadJoggingFunc(int speed) Tspool->segmentoffsetpulses = 1000; Tspool->startoffsetpulses = 220; Tspool->rotationsperpassage = 3.1415926*2; + Tspool->has_limitswitchstartpointoffset = false; Ticket.spool = Tspool; CurrentJob = &Ticket; InternalWindingConfigMessage(Tspool); @@ -599,6 +600,7 @@ uint32_t ThreadCleaningJob(int speed) Tspool->segmentoffsetpulses = 1000; Tspool->startoffsetpulses = 220; Tspool->rotationsperpassage = 3.1415926*2; + Tspool->has_limitswitchstartpointoffset = false; Ticket.spool = Tspool; CurrentJob = &Ticket; job_length = CurrentJob->length + dryerbufferMeters; |
