From 77e72b9d16522648a350a95382309e9692434011 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Thu, 23 May 2019 14:59:16 +0300 Subject: prints --- Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules/Thread') diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index f1c8956ff..66c2e1659 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -305,11 +305,11 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) ScrewRunningTime = temp;//(SYS_CLK_FREQ*Steps)/ScrewSpeed; //ROM_IntMasterEnable(); //usnprintf(TempScrewStr, 100, "Winder: Horizon,Rotation, PPR, RPP{ %d, %d ,%d, %d} ",(int)screw_horizontal_speed,(int)RotationsPerSecond,(int)InternalWinderCfg.NumberOfRotationPerPassage,(int)MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_WINDER].pulseperround); - //usnprintf(ScrewStr, 100, "Winder: Steps,Speed, Time, WinderSpeed{ %d, %d ,%d, %d} ",(int)ScrewNumberOfSteps,(int)ScrewSpeed,(int)temp,(int)WinderReferenceSpeed); + usnprintf(ScrewStr, 100, "Winder: Steps,Speed, Time, WinderSpeed{ %d, %d ,%d, %d} ",(int)ScrewNumberOfSteps,(int)ScrewSpeed,(int)temp,(int)WinderReferenceSpeed); // Report(logmsg[index],__FILE__,__LINE__,index,RpWarning,index, Counter[index]); // #warning PID is now only proportional (above) //Report(TempScrewStr,__FILE__,__LINE__,0,RpWarning,0, 0); - //Report(ScrewStr,__FILE__,__LINE__,ScrewCurrentDirection,RpWarning,CalculationDirectionChangeCounter, 0); + Report(ScrewStr,__FILE__,__LINE__,ScrewCurrentDirection,RpWarning,CalculationDirectionChangeCounter, 0); //REPORT_MSG(temp , "new winder speed"); //Report("new winder speed",__FILE__,ScrewNumberOfSteps,temp,RpWarning,ScrewSpeed,0); } @@ -372,12 +372,12 @@ uint32_t Winder_Presegment(void *SegmentDetails, uint32_t SegmentId) temp *= ScrewNumberOfSteps; temp /= ScrewSpeed; ScrewRunningTime = temp;//(SYS_CLK_FREQ*InternalWinderCfg.segmentoffsetpulses)/ScrewSpeed; - REPORT_MSG(ScrewNumberOfSteps,"Winder pre segment - ScrewNumberOfSteps"); - REPORT_MSG(ScrewRunningTime,"Winder pre segment - ScrewRunningTime"); + REPORT_MSG((int)ScrewNumberOfSteps,"Winder pre segment - ScrewNumberOfSteps"); + REPORT_MSG((int)ScrewRunningTime,"Winder pre segment - ScrewRunningTime"); // MotorSetDirection (HARDWARE_MOTOR_TYPE__MOTO_SCREW, ScrewCurrentDirection); //ScrewDirection = 1-ScrewDirection; REPORT_MSG(SegmentId,"Winder pre segment - SegmentId"); - REPORT_MSG(ScrewSpeed,"Winder pre segment - ScrewSpeed"); + REPORT_MSG((int)ScrewSpeed,"Winder pre segment - ScrewSpeed"); //MotorSetSpeedDirect(HARDWARE_MOTOR_TYPE__MOTO_SCREW,ScrewSpeed); ScrewsStartControlTimer (); ScrewControlId = AddControlCallback(Screw100msecDirectionChange, eHundredMillisecond,TemplateDataReadCBFunction,0,0,0); -- cgit v1.3.1 From d7d99dc7d1fa11845c5d4df3bbff16fec33b406c Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Sun, 26 May 2019 18:13:17 +0300 Subject: Version 1.4.0.2 improve winding (simplify). incorporate screw encoder reading. fix length/time problem between IDS and Thread. --- .../Embedded/Common/SWUpdate/FileSystem.c | 3 +- .../Embedded_SW/Embedded/Common/SW_Info/SW_Info.c | 2 +- .../Embedded/Drivers/FPGA/FPGA_SPI_Comm.c | 15 ++- .../Embedded/Drivers/FPGA/FPGA_SPI_Comm.h | 1 + .../Embedded_SW/Embedded/Drivers/Motors/Motor.c | 42 ++++++-- .../Embedded_SW/Embedded/Drivers/Motors/Motor.h | 13 ++- .../Embedded_SW/Embedded/Modules/Control/PIDAlgo.c | 2 +- Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h | 1 + .../Embedded_SW/Embedded/Modules/IDS/IDS_print.c | 41 +++++++- .../Embedded/Modules/Stubs_Handler/Stub_Motor.c | 2 +- .../Embedded_SW/Embedded/Modules/Thread/Thread.h | 6 +- .../Embedded/Modules/Thread/ThreadLoad.c | 2 +- .../Embedded/Modules/Thread/Thread_Winder.c | 116 +++++++++++++-------- .../Embedded/Modules/Thread/Thread_ex.h | 2 +- .../Embedded/Modules/Thread/Thread_init.c | 2 +- .../Embedded/Modules/Thread/Thread_print.c | 26 +++-- .../Embedded/StateMachines/Printing/JobSTM.c | 38 ++++--- .../Embedded/StateMachines/Printing/PrintingSTM.c | 30 +++++- 18 files changed, 237 insertions(+), 107 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules/Thread') diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c index 68745b390..68500ac88 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c @@ -154,7 +154,8 @@ uint32_t FileChunkUploadRequestFunc(MessageContainer* requestContainer) // memcpy (&ReceivedFileHandle,request->uploadid,sizeof(ReceivedFileHandle)); //if (ReceivedFileHandle == FileHandle) //{ - KeepAliveOneSecondCounter = 0; + Control_WD(ENABLE,10); //activate heaters/dispenser watchdog, 0.5 seconds + KeepAliveOneSecondCounter = 0; Fresult = f_write(ReceivedFileHandle,request->buffer.data,request->buffer.len,&WrittenBytes ); lFresult = Fresult; if(Fresult != FR_OK) diff --git a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c index 21c7eb041..b2590abab 100644 --- a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c +++ b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c @@ -20,7 +20,7 @@ typedef struct } TangoVersion_t; -TangoVersion_t _gTangoVersion = {1,4,0,0}; +TangoVersion_t _gTangoVersion = {1,4,0,2}; #define BUILD_DATE __DATE__ char Dat[50] = BUILD_DATE; char _gTangoName [MAX_STRING_LEN] = "Tango01 ";//d 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 26f6d5c56..5cfaddb1e 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c @@ -225,6 +225,17 @@ void FPGA_GetClrMotStat_Cmd(TimerMotors_t _motorId) } +void FPGA_GetFPGAMotSpeed_Cmd(TimerMotors_t _motorId) +{ + uint32_t temp; + Fpga_Spi[_motorId].TX_MOSI = x_GET_PARAM | x_SPEED; + 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; + temp = Fpga_Spi[_motorId].TX_MOSI; + + MillisecReadFromMotor(_motorId, temp, 4, MotorGetSpeedFromFPGA_Callback); +} + void FPGA_GetMotSpeed_Cmd(TimerMotors_t _motorId) { Fpga_Spi[_motorId].TX_MOSI = x_GET_PARAM | x_SPEED; @@ -769,7 +780,9 @@ void FPGA_SetMotSpeedDirect(TimerMotors_t _motorId)//Run Fpga_Spi[_motorId].TX_MOSI = temp; Fpga_Spi[_motorId].AMT_OF_Words = 4; - FPGA_SPI_Transnit(_motorId); + //FPGA_SPI_Transnit(_motorId); + MotorSendFPGARequest(_motorId,temp, 4); //returns -1 on busy or other error + } void FPGA_SetMotMaxSpeed(TimerMotors_t _motorId)//Mov { diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.h b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.h index e2937e597..114d24a85 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.h +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.h @@ -14,6 +14,7 @@ uint32_t Read_Motors_Driver_Type(TimerMotors_t i); void FPGA_GetClrMotStat_Cmd(TimerMotors_t _motorId); void FPGA_GetMotSpeed_Cmd(TimerMotors_t _motorId); void FPGA_Get_ADC_OUT_Cmd(TimerMotors_t _motorId); +void FPGA_GetFPGAMotSpeed_Cmd(TimerMotors_t _motorId); void FPGA_Get_Res(TimerMotors_t _motorId); void FPGA_GetBusy(); diff --git a/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.c b/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.c index 106e60316..202021282 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.c +++ b/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.c @@ -117,9 +117,13 @@ uint32_t MotorSetDirection(TimerMotors_t _motorId,bool _direction) return OK; } -uint32_t MotorSetSpeed(TimerMotors_t _motorId, uint32_t _freq)//TODO MicroSteps? +uint32_t MotorSetSpeed(TimerMotors_t _motorId, float _freq)//TODO MicroSteps? { - int RunSpeed = SpdCalc(_freq); + if (_motorId == HARDWARE_MOTOR_TYPE__MOTO_SCREW) + { + LOG_ERROR ((int)_freq, "SCREW SET SPEED CALLED"); + } + uint32_t RunSpeed = SpdCalc(_freq); #ifdef EVALUATION_BOARD Run_Value = RunSpeed; Mot_Run(); @@ -130,9 +134,9 @@ uint32_t MotorSetSpeed(TimerMotors_t _motorId, uint32_t _freq)//TODO MicroSteps? return OK; } -uint32_t MotorSetSpeedDirect(TimerMotors_t _motorId, uint32_t _freq) +uint32_t MotorSetSpeedDirect(TimerMotors_t _motorId, float _freq) { - int RunSpeed = SpdCalc(_freq); + uint32_t RunSpeed = SpdCalc(_freq); MotorDriverRequest[_motorId].Speed = RunSpeed; FPGA_SetMotSpeedDirect(_motorId); @@ -140,7 +144,7 @@ uint32_t MotorSetSpeedDirect(TimerMotors_t _motorId, uint32_t _freq) } -uint32_t MotorGetSpeed(TimerMotors_t _motorId) +float MotorGetSpeed(TimerMotors_t _motorId) { return MotorDriverResponse[_motorId].Speed; } @@ -174,6 +178,25 @@ uint32_t MotorGetPositionFromFPGA_Callback(TimerMotors_t _motorId,uint32_t Data) return MotorDriverResponse[_motorId].Position; } +uint32_t MotorGetSpeedFromFPGA1(TimerMotors_t _motorId) +{ + #ifdef EVALUATION_BOARD + MotorDriverResponse[_motorId].Speed = (CurrentSpdCalc(Get_Param(x_SPEED))); + return (uint32_t)(MotorDriverResponse[_motorId].Speed); + #else + FPGA_GetFPGAMotSpeed_Cmd(_motorId); + return OK; + #endif +} +float MotorGetSpeedFromFPGA_Callback(TimerMotors_t _motorId,uint32_t Data) +{ + #ifndef EVALUATION_BOARD + // FPGA_Get_Res(_motorId); + MotorDriverResponse[_motorId].Speed = CurrentSpdCalc(Data); + #endif + return MotorDriverResponse[_motorId].Speed; +} + //uint32_t MotorGetPositionFromFPGA_Res(TimerMotors_t _motorId) //{ // #ifndef EVALUATION_BOARD @@ -190,20 +213,19 @@ uint32_t MotorGetSpeedFromFPGA(TimerMotors_t _motorId) // MotorDriverResponse[_motorId].Speed = (float)(CurrentSpdCalc(MotFPGA_Spi.RX_MISO)); // return MotorDriverResponse[_motorId].Speed; #ifdef EVALUATION_BOARD - uint32_t temp = (uint32_t)(CurrentSpdCalc(Get_Param(x_SPEED))); - MotorDriverResponse[_motorId].Speed = temp; - return temp; + MotorDriverResponse[_motorId].Speed = (CurrentSpdCalc(Get_Param(x_SPEED))); + return (uint32_t)(MotorDriverResponse[_motorId].Speed); #else FPGA_GetMotSpeed_Cmd(_motorId); return OK; #endif } -uint32_t MotorGetSpeedFromFPGA_Res(TimerMotors_t _motorId) +float MotorGetSpeedFromFPGA_Res(TimerMotors_t _motorId) { #ifndef EVALUATION_BOARD FPGA_Get_Res(_motorId); - MotorDriverResponse[_motorId].Speed = (float)(CurrentSpdCalc(Fpga_Spi[_motorId].RX_MISO)); + MotorDriverResponse[_motorId].Speed = CurrentSpdCalc(Fpga_Spi[_motorId].RX_MISO); #endif return MotorDriverResponse[_motorId].Speed; } diff --git a/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.h b/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.h index 894f60c09..81cc7828b 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.h +++ b/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.h @@ -96,7 +96,7 @@ typedef struct typedef struct { bool Direction; - uint32_t Speed; + float Speed; uint32_t Position; uint32_t Status; uint8_t MicroSteps; @@ -125,14 +125,14 @@ uint32_t MotorGetDirection(TimerMotors_t _motorId); uint32_t MotorSetDirection(TimerMotors_t _motorId,bool _direction); -uint32_t MotorSetSpeed(TimerMotors_t _motorId, uint32_t _freq); -uint32_t MotorSetSpeedDirect(TimerMotors_t _motorId, uint32_t _freq); // call directly and not from millisec task +uint32_t MotorSetSpeed(TimerMotors_t _motorId, float _freq); +uint32_t MotorSetSpeedDirect(TimerMotors_t _motorId, float _freq); // call directly and not from millisec task uint32_t MotorSetMaxSpeed(TimerMotors_t _motorId, uint32_t MaxSpeed); uint32_t MotorSetMicroStep(TimerMotors_t _motorId, uint32_t microstep); -uint32_t MotorGetSpeed(TimerMotors_t _motorId); +float MotorGetSpeed(TimerMotors_t _motorId); uint32_t MotorGetADC(TimerMotors_t _motorId); uint32_t MotorGetPosition(TimerMotors_t _motorId); @@ -142,7 +142,10 @@ uint32_t MotorGetPositionFromFPGA_Callback(TimerMotors_t _motorId,uint32_t Data) //uint32_t MotorGetPositionFromFPGA_Res(TimerMotors_t _motorId); uint32_t MotorGetSpeedFromFPGA(TimerMotors_t _motorId); -uint32_t MotorGetSpeedFromFPGA_Res(TimerMotors_t _motorId); +float MotorGetSpeedFromFPGA_Res(TimerMotors_t _motorId); +uint32_t MotorGetSpeedFromFPGA1(TimerMotors_t _motorId); +float MotorGetSpeedFromFPGA_Callback(TimerMotors_t _motorId,uint32_t Data); + uint32_t MotorGetADCFromFPGA(TimerMotors_t _motorId); uint32_t MotorGetADCFromFPGA_Res(TimerMotors_t _motorId); diff --git a/Software/Embedded_SW/Embedded/Modules/Control/PIDAlgo.c b/Software/Embedded_SW/Embedded/Modules/Control/PIDAlgo.c index dd9841777..6c1b647be 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/PIDAlgo.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/PIDAlgo.c @@ -11,7 +11,7 @@ float PIDAlgorithmCalculation(float _setPoint,float _mesuredParam , PID_Config_P error = _setPoint - _mesuredParam; //In case of error too small then stop integration - if(abs(error) > params->epsilon) + if(fabs(error) > params->epsilon) { *_integral = *_integral + error*params->dt; } diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h index a5165e7f2..4dbd2e89e 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h @@ -44,6 +44,7 @@ uint32_t IDSPrepareState(void *JobDetails); void IDSPrepareStart(void); uint32_t IDSPreSegmentState(void *SegmentDetails, int SegmentId); +uint32_t IDSCheckSegmentData(void *SegmentDetails, int SegmentId); uint32_t IDSSegmentState(void *SegmentDetails, int SegmentId); uint32_t IDSDistanceToSpoolState(void); uint32_t IDSEndState(void); diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c index efedfe545..1d395ec8c 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c @@ -850,6 +850,40 @@ uint32_t IDS_Cleaning_Stop_Cleaning_Solution (callback_fptr callback); } return OK; } +uint32_t IDSCheckSegmentData(void *SegmentDetails, int SegmentId) +{ + JobDescriptionFileSegment* PrevSegment = SegmentDetails; + uint32_t status = OK; + JobDescriptionFileBrushStop * tFileBrushStop; + int Brush_i; + +//check and close previous segment + if (PrevSegment) + { + if (JobBrushStopIdbrushstopscount) //we did not finish reading the brushstops of the previous segment + { + Report("Unhandled brushstops remained",__FILE__,__LINE__,(int)JobBrushStopId,RpWarning,(int)PrevSegment->brushstopscount,0); + //REPORT_MSG (Segment->brushstopscount, "Segment->brushstopscount"); + for (Brush_i=JobBrushStopId;Brush_ibrushstopscount;Brush_i++) + { + if (status == ERROR) + break; + tFileBrushStop = GetNextBrushStopFromJobFile(); + if (tFileBrushStop) + { + FreeBrushStopFileData(tFileBrushStop); + Report("Unhandled brushstops handled",__FILE__,__LINE__,(int)Brush_i,RpWarning,(int)PrevSegment->brushstopscount,0); + } + else + { + status = ERROR; + break; + } + }//for brushstops + } + } + return status; +} uint32_t IDSPreSegmentState(void *SegmentDetails, int SegmentId) { JobSegment* Segment = SegmentDetails; @@ -864,7 +898,7 @@ uint32_t IDSPreSegmentState(void *SegmentDetails, int SegmentId) /* wait for all dispensers to get to the required pressure * move the presegment ready when all dispensers are ready. */ - REPORT_MSG(SegmentId,"IDSPreSegmentState"); + REPORT_MSG(Segment->n_brushstops,"IDSPreSegmentState"); if (JobBrushStopId>=Segment->n_brushstops) { LOG_ERROR(Segment->n_brushstops,"Error JobBrushStopId"); @@ -873,7 +907,6 @@ uint32_t IDSPreSegmentState(void *SegmentDetails, int SegmentId) return ERROR; } - if ((EnableIntersegment == true)&&(IntersegmentLength>0)) { Valve_Set(VALVE_MIXCHIP_WASTECH, Mixer_Waste); //if intersegment is defined throw the ink away @@ -1026,7 +1059,7 @@ void IDS_StartBrushStop(int n_dispensers, JobDispenser** Dispensers) /*IDS_Dispenser_Start_Motor_and_Open_Valve(DispenserId, segmentfirst_speed, NULL);*/ - Control3WayValvesWithCallback (DispenserId, Dispenser_Mixer, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer + //Control3WayValvesWithCallback (DispenserId, Dispenser_Mixer, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer MotorSetSpeed(HW_Motor_Id, segmentfirst_speed); CurrentDispenserSpeed[DispenserId] = segmentfirst_speed; usnprintf(IdsMessage, 80, @@ -1034,7 +1067,7 @@ void IDS_StartBrushStop(int n_dispensers, JobDispenser** Dispensers) DispenserId, (int) Dispensers[Dispenser_i]->nanolitterpersecond, (int) Dispensers[Dispenser_i]->nanoliterperpulse, - (int) segmentfirst_speed,Dispensers[Dispenser_i]->dispenserstepdivision,MotorsCfg[HW_Motor_Id].microstep); + (int) (segmentfirst_speed*1000),Dispensers[Dispenser_i]->dispenserstepdivision,MotorsCfg[HW_Motor_Id].microstep); //REPORT_MSG(segmentfirst_speed,IdsMessage); Report(IdsMessage, __FILE__, __LINE__, Dispenser_i, RpWarning, segmentfirst_speed, 0); //SendJobProgress(0.0, 0, false, IdsMessage); 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 0854aba40..53a860970 100644 --- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Motor.c +++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Motor.c @@ -449,7 +449,7 @@ void Stub_MotorSpeedRequest(MessageContainer* requestContainer) //deley TODO SysCtlDelay(10000); //response.speed = (double)(CurrentSpdCalc(MotorGetSpeedFromFPGA_Res(Motor_Id))); - response.speed = MotorGetSpeedFromFPGA_Res(Motor_Id); + response.speed = (double)(MotorGetSpeedFromFPGA_Res(Motor_Id)); #endif ////////////////////////////////////////////////////////////////// diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h b/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h index 19201c708..0093a5a2a 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h @@ -56,8 +56,8 @@ extern int32_t BreakSensordebouncetimemilli; extern HardwarePidControl MotorsControl[MAX_THREAD_MOTORS_NUM]; //extern InternalWinderConfigStruc InternalWinderCfg; extern HardwareDancer DancersCfg[MAX_SYSTEM_DANCERS]; -extern uint32_t CurrentControlledSpeed[MAX_THREAD_MOTORS_NUM]; -extern int OriginalMotorSpd_2PPS[MAX_THREAD_MOTORS_NUM]; +extern double CurrentControlledSpeed[MAX_THREAD_MOTORS_NUM]; +extern double OriginalMotorSpd_2PPS[MAX_THREAD_MOTORS_NUM]; #define MAX_CONTROL_SAMPLES 10 extern int32_t MotorSamples[MAX_THREAD_MOTORS_NUM][MAX_CONTROL_SAMPLES]; @@ -65,7 +65,7 @@ extern int MotorSamplePointer[MAX_THREAD_MOTORS_NUM]; extern double NormalizedErrorCoEfficient[MAX_THREAD_MOTORS_NUM]; extern int DancerStopActivityLimit[MAX_THREAD_MOTORS_NUM]; extern MotorControlConfig_t MotorControlConfig[MAX_THREAD_MOTORS_NUM]; -extern int32_t MotorSpeedSamples[MAX_THREAD_MOTORS_NUM][MAX_CONTROL_SAMPLES]; +extern double MotorSpeedSamples[MAX_THREAD_MOTORS_NUM][MAX_CONTROL_SAMPLES]; extern int MotorSpeedSamplePointer[MAX_THREAD_MOTORS_NUM]; diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c index ab5075ab9..66d6baed5 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c @@ -594,7 +594,7 @@ uint32_t ThreadLoadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) MotorControlConfig[index].m_calculatedError = (-1*MotorControlConfig[index].m_calculatedError); }*/ calculated_speed = (1-MotorControlConfig[index].m_calculatedError)*OriginalMotorSpd_2PPS[index]; - if (abs(calculated_speed-CurrentControlledSpeed[index])> MotorControlConfig[index].m_ingnoreValue) + if (fabs(calculated_speed-CurrentControlledSpeed[index])> MotorControlConfig[index].m_ingnoreValue) { CurrentControlledSpeed[index] = calculated_speed; MotorSetSpeed(ThreadMotorIdToMotorId[index], calculated_speed); diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index 66c2e1659..9ebc32f57 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -43,10 +43,11 @@ uint32_t ScrewDirectionChangeCounter = 1; //holds the current number of runs of //uint32_t ScrewChangeCounter = 0; //uint32_t ScrewChangeLimit = 0; uint32_t CalculationDirectionChangeCounter = 1; //holds the current number of runs of the screw - will be used to build the cone -uint16_t WinderMotorSpeed[MAX_WINDER_SPEED_CALCULATION]; +double WinderMotorSpeed[MAX_WINDER_SPEED_CALCULATION]; uint16_t WinderMotorSpeedCounter = 0; bool WinderMotorSpeedRollOver = false; -double ScrewSpeed = 0; +#define DEFAULT_SCREW_SPEED 1400 +double ScrewSpeed = DEFAULT_SCREW_SPEED; double ScrewRunningTime = 0; uint32_t ScrewNumberOfSteps = 0; //holds the current number of steps for the next screw run - will be used to build the cone bool SCREW_TimerActivated = false; @@ -96,7 +97,7 @@ uint32_t Winder_Prepare(void) uint32_t status = 0; //JobTicket* JobTicket = JobDetails; //float process_speed = JobTicket->processparameters->dyeingspeed; - double ScrewSpeed = 1500;//(process_speed*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].pulleyradius); // we will use pulley radius of the screw for this purpose, as of now + double ScrewSpeed = DEFAULT_SCREW_SPEED;//(process_speed*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].pulleyradius); // we will use pulley radius of the screw for this purpose, as of now //MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_SCREW,InternalWinderCfg.segmentoffsetpulses); //REPORT_MSG(ScrewSpeed, "Winder_Prepare"); /* @@ -143,9 +144,9 @@ uint32_t Winder_PrepareStage2(uint32_t deviceID, uint32_t ReadValue) //MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_SCREW,InternalWinderCfg.segmentoffsetpulses); //REPORT_MSG(numOfSteps, "Winder_PrepareStage2"); - //Read_Screw_Encoder(); - //ScrewLocationLimitSwitch = Screw_RotEnc.Position; - //REPORT_MSG(ScrewLocationLimitSwitch, "Winder_PrepareStage2 Encoder Location"); + Read_Screw_Encoder(); + ScrewLocationLimitSwitch = Screw_RotEnc.Position; + REPORT_MSG(ScrewLocationLimitSwitch, "Winder_PrepareStage2 Encoder Location"); REPORT_MSG(millisecondCounter/*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].maxfrequency*/, "Winder_PrepareStage2"); @@ -169,8 +170,13 @@ uint32_t Winder_ScrewAtOffsetCallback(uint32_t deviceID, uint32_t BusyFlag) //SetMotHome(HARDWARE_MOTOR_TYPE__MOTO_SCREW); //set this point as the spool home //MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_SCREW,temp_MaxFrequency); - //Read_Screw_Encoder(); - //ScrewLocationStart = Screw_RotEnc.Position; + MotorStop (HARDWARE_MOTOR_TYPE__MOTO_SCREW,Soft_Hiz); //per L6470 errata between mov and run commands + Task_sleep(5); + Reset_Screw_Encoder(); + Task_sleep(5); + Read_Screw_Encoder(); + Task_sleep(5); + ScrewLocationStart = Screw_RotEnc.Position; REPORT_MSG(ScrewLocationStart, "Winder_ScrewAtOffsetCallback Encoder Location"); @@ -180,7 +186,6 @@ uint32_t Winder_ScrewAtOffsetCallback(uint32_t deviceID, uint32_t BusyFlag) ScrewControlId = 0xFF; ScrewNumberOfSteps = 0; REPORT_MSG(millisecondCounter, "Winder_ScrewAtOffsetCallback"); - MotorStop (HARDWARE_MOTOR_TYPE__MOTO_SCREW,Soft_Hiz); //per L6470 errata between mov and run commands PrepareReady(Module_Winder, ModuleDone); return OK; } @@ -212,26 +217,28 @@ InternalWinderCfg.segmentoffsetpulses numOfSteps = InternalWinderCfg.startoffsetpulses*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].microstep; */ -char ScrewStr[100]; +char ScrewStr[150]; //char TempScrewStr[100]; double WinderReferenceSpeed=0; -int32_t TotalWinderSpeed=0; +double TotalWinderSpeed=0; bool Add100 = false; double Rotations = 6.0; +bool flipflop = false; +uint32_t motspeed; +float speedf; +int WinderCalculation = 0; uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) { //uint32_t Steps; double temp,tempScrewSpeed; double screw_horizontal_speed = 0; double RotationsPerSecond; - int32_t Averagewinderspeed = 0; + double Averagewinderspeed = 0; - //ScrewChangeCounter++; - //if ((ScrewChangeCounter>3)&&(ScrewChangeCounter<(ScrewChangeLimit-2))) //do not take the winder speed near the limits - { - TotalWinderSpeed-=WinderMotorSpeed[WinderMotorSpeedCounter]; - WinderMotorSpeed[WinderMotorSpeedCounter] = CurrentControlledSpeed[WINDER_MOTOR]; - TotalWinderSpeed+=WinderMotorSpeed[WinderMotorSpeedCounter]; +// { +// TotalWinderSpeed-=WinderMotorSpeed[WinderMotorSpeedCounter]; +// WinderMotorSpeed[WinderMotorSpeedCounter] = CurrentControlledSpeed[WINDER_MOTOR]; +// TotalWinderSpeed+=WinderMotorSpeed[WinderMotorSpeedCounter]; if (WinderMotorSpeedCounter++>=MAX_WINDER_SPEED_CALCULATION) { if (WinderMotorSpeedRollOver == false) @@ -239,20 +246,34 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) Add100 = true; LOG_ERROR(Add100, "Add100 = true"); } - WinderMotorSpeedCounter=0; +// WinderMotorSpeedCounter=0; WinderMotorSpeedRollOver=true; } +// } + if (flipflop) + { + speedf = MotorGetSpeedFromFPGA_Res(HARDWARE_MOTOR_TYPE__MOTO_SCREW); } + else + { + MotorGetSpeedFromFPGA1(HARDWARE_MOTOR_TYPE__MOTO_SCREW); + } + flipflop = 1-flipflop; if (ScrewDirectionChangeCounter == CalculationDirectionChangeCounter) return OK; + //deley TODO + ScrewCurrentDirection = 1-ScrewCurrentDirection; CalculationDirectionChangeCounter++; - //REPORT_MSG(ScrewLocationRun[1] - ScrewLocationRun[0], "Screw Run NumberOfSteps"); - //usnprintf(ScrewStr, 100, "Winder Encoder: 0 0x%x 1 0x%x diff %d ",ScrewLocationRun[0],ScrewLocationRun[1],abs(ScrewLocationRun[1] - ScrewLocationRun[0])); + //double calcsteps = (ScrewRunningTime/SYS_CLK_FREQ)*ScrewSpeed; + //REPORT_MSG((abs(ScrewLocationRun[1] - ScrewLocationRun[0]), "Screw Run NumberOfSteps"); +// usnprintf(ScrewStr, 100, "Winder Encoder: 0 0x%x 1 0x%x diff %d intent %d rot %d",ScrewLocationRun[0],ScrewLocationRun[1],abs(ScrewLocationRun[1] - ScrewLocationRun[0]),ScrewNumberOfSteps,Rotations*10); + usnprintf(ScrewStr, 150, "Winder Encoder:id, diff, intended, winderspeed, rotation, speed, time, mot speed {, %d, %d, %d, %d, %d, %d, %d, %d, }",CalculationDirectionChangeCounter, + abs(ScrewLocationRun[1] - ScrewLocationRun[0]),ScrewNumberOfSteps,(int)(WinderReferenceSpeed),(int)(Rotations*10),(int)ScrewSpeed,(int)ScrewRunningTime,(int)speedf); //usnprintf(ScrewStr, 100, "Winder Encoder: 0 %d 1 %d diff %d ",ScrewLocationRun[0],ScrewLocationRun[1],ScrewLocationRun[1] - ScrewLocationRun[0]); - //Report(ScrewStr,__FILE__,__LINE__,ScrewLocationLimitSwitch,RpWarning,ScrewLocationStart, 0); + Report(ScrewStr,__FILE__,__LINE__,CalculationDirectionChangeCounter,RpWarning,ScrewLocationStart, 0); if (ScrewCurrentDirection == 1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize) //next time going out { @@ -265,8 +286,7 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) if ((CalculationDirectionChangeCounter/2)%InternalWinderCfg.spoolbackingrate == 0) { ScrewNumberOfSteps--; - REPORT_MSG(ScrewNumberOfSteps, "Head Backing ScrewNumberOfSteps"); - + Report("Head Backing",__FILE__,__LINE__,CalculationDirectionChangeCounter,RpWarning,ScrewNumberOfSteps, 0); } } else //next time going back @@ -274,34 +294,38 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) if ((CalculationDirectionChangeCounter/2)%InternalWinderCfg.SpoolBottomBackingRate == 0) { ScrewNumberOfSteps++; - REPORT_MSG(ScrewNumberOfSteps, "Bottom Backing ScrewNumberOfSteps"); + Report("Bottom Backing ",__FILE__,__LINE__,CalculationDirectionChangeCounter,RpWarning,ScrewNumberOfSteps, 0); } } - if (WinderMotorSpeedRollOver) + /* if (WinderMotorSpeedRollOver) { - /*for (i=0;i 6.6)//7.0) - Rotations = 6.0; + // if (Rotations > 6.6)//7.0) + // Rotations = 6.0; RotationsPerSecond = WinderReferenceSpeed / (double)MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_WINDER].pulseperround; tempScrewSpeed = screw_horizontal_speed*RotationsPerSecond; //ROM_IntMasterDisable(); + tempScrewSpeed = DEFAULT_SCREW_SPEED; + CurrentControlledSpeed[SCREW_MOTOR] = ScrewSpeed; + temp = SYS_CLK_FREQ; temp *= ScrewNumberOfSteps; temp /= tempScrewSpeed; if ((ScrewRunningTime != temp)||(ScrewSpeed != tempScrewSpeed)) { ScrewSpeed = tempScrewSpeed; + ScrewSpeed = DEFAULT_SCREW_SPEED; ScrewRunningTime = temp;//(SYS_CLK_FREQ*Steps)/ScrewSpeed; //ROM_IntMasterEnable(); //usnprintf(TempScrewStr, 100, "Winder: Horizon,Rotation, PPR, RPP{ %d, %d ,%d, %d} ",(int)screw_horizontal_speed,(int)RotationsPerSecond,(int)InternalWinderCfg.NumberOfRotationPerPassage,(int)MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_WINDER].pulseperround); @@ -353,6 +377,7 @@ uint32_t Winder_Presegment(void *SegmentDetails, uint32_t SegmentId) RotationsPerSecond = OriginalMotorSpd_2PPS[WINDER_MOTOR] / MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_WINDER].pulseperround; // calculation input#3: speed = rotation per second * traverse per rotation = traverse per second. speed set: traverse per second (mm) * pulses per mm. ScrewSpeed = screw_horizontal_speed*RotationsPerSecond; + ScrewSpeed = DEFAULT_SCREW_SPEED; //MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_SCREW,ScrewSpeed); usnprintf(ScrewStr, 100, "SCREW speed Rot/sec %d horizon %d pulses %d",(int)RotationsPerSecond,(int)screw_horizontal_speed,(int)ScrewSpeed); @@ -372,12 +397,12 @@ uint32_t Winder_Presegment(void *SegmentDetails, uint32_t SegmentId) temp *= ScrewNumberOfSteps; temp /= ScrewSpeed; ScrewRunningTime = temp;//(SYS_CLK_FREQ*InternalWinderCfg.segmentoffsetpulses)/ScrewSpeed; - REPORT_MSG((int)ScrewNumberOfSteps,"Winder pre segment - ScrewNumberOfSteps"); - REPORT_MSG((int)ScrewRunningTime,"Winder pre segment - ScrewRunningTime"); + REPORT_MSG(ScrewNumberOfSteps,"Winder pre segment - ScrewNumberOfSteps"); + REPORT_MSG(ScrewRunningTime,"Winder pre segment - ScrewRunningTime"); // MotorSetDirection (HARDWARE_MOTOR_TYPE__MOTO_SCREW, ScrewCurrentDirection); //ScrewDirection = 1-ScrewDirection; REPORT_MSG(SegmentId,"Winder pre segment - SegmentId"); - REPORT_MSG((int)ScrewSpeed,"Winder pre segment - ScrewSpeed"); + REPORT_MSG(ScrewSpeed,"Winder pre segment - ScrewSpeed"); //MotorSetSpeedDirect(HARDWARE_MOTOR_TYPE__MOTO_SCREW,ScrewSpeed); ScrewsStartControlTimer (); ScrewControlId = AddControlCallback(Screw100msecDirectionChange, eHundredMillisecond,TemplateDataReadCBFunction,0,0,0); @@ -458,20 +483,20 @@ void ScrewsStartControlTimer (void) return; } -int random = 0; + void ScrewTimerInterrupt(int ARG0) { ROM_TimerIntClear(Screw_timerBase, TIMER_TIMA_TIMEOUT); // Clear the timer interrupt ROM_IntMasterDisable(); - //Read_Screw_Encoder(); - //ScrewLocationRun[ScrewCurrentDirection] = Screw_RotEnc.Position; if (SCREW_TimerActivated == true) { + Read_Screw_Encoder(); ROM_TimerLoadSet(Screw_timerBase, TIMER_A,(int)ScrewRunningTime); MotorSetDirection (HARDWARE_MOTOR_TYPE__MOTO_SCREW, ScrewCurrentDirection); - MotorSetSpeedDirect(HARDWARE_MOTOR_TYPE__MOTO_SCREW,ScrewSpeed+random); + MotorSetSpeedDirect(HARDWARE_MOTOR_TYPE__MOTO_SCREW,ScrewSpeed); + ScrewLocationRun[ScrewCurrentDirection] = Screw_RotEnc.Position; // ScrewChangeCounter = 0; // ScrewChangeLimit = ScrewRunningTime/12000000; ScrewDirectionChangeCounter++; @@ -481,7 +506,8 @@ void ScrewTimerInterrupt(int ARG0) TimerDisable(Screw_timerBase, TIMER_A); } ROM_IntMasterEnable(); - Rotations+=0.03; + //MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_SCREW,ScrewSpeed); + //Rotations+=0.03; return ; diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h index 91eedeb6b..ead318758 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h @@ -28,7 +28,7 @@ void ThreadSetBreakSensorLimit(int limit); uint32_t InternalWindingConfigMessage(JobSpool* request); uint32_t ThreadConfigBreakSensor(void *request); -uint32_t ThreadGetMotorSpeed(threadMotorsEnum MotorId); +double ThreadGetMotorSpeed(threadMotorsEnum MotorId); double ThreadGetMotorCalculatedError(int DancerId); uint32_t ThreadPrepareState(void *JobDetails); uint32_t ThreadPreSegmentState(void *SegmentDetails, uint32_t SegmentId); diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c index 265c751c6..0acb587b2 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c @@ -22,7 +22,7 @@ MotorDriverConfigStruc MotorsCfg[NUM_OF_MOTORS]={0}; HardwarePidControl MotorsControl[MAX_THREAD_MOTORS_NUM] = {0}; -int32_t MotorSpeedSamples[MAX_THREAD_MOTORS_NUM][MAX_CONTROL_SAMPLES] = {0}; +double MotorSpeedSamples[MAX_THREAD_MOTORS_NUM][MAX_CONTROL_SAMPLES] = {0}; int MotorSpeedSamplePointer[MAX_THREAD_MOTORS_NUM] = {0}; int32_t MotorSamples[MAX_THREAD_MOTORS_NUM][MAX_CONTROL_SAMPLES] = {0}; diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c index 25485290b..a285d4194 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c @@ -39,7 +39,7 @@ //by recieved esign flow of the user from the UI /////////////////////////////////////////////////////////////////////////////////////////// -uint32_t CurrentControlledSpeed[MAX_THREAD_MOTORS_NUM] = {0}; +double CurrentControlledSpeed[MAX_THREAD_MOTORS_NUM] = {0}; TimerMotors_t ThreadMotorIdToMotorId[MAX_THREAD_MOTORS_NUM] = {HARDWARE_MOTOR_TYPE__MOTO_RDRIVING,HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING,HARDWARE_MOTOR_TYPE__MOTO_LDRIVING,HARDWARE_MOTOR_TYPE__MOTO_WINDER,HARDWARE_MOTOR_TYPE__MOTO_SCREW}; HardwareDancerType ThreadMotorIdToDancerId[MAX_THREAD_MOTORS_NUM] = {FEEDER_DANCER,NUM_OF_DANCERS,POOLER_DANCER,WINDER_DANCER,NUM_OF_DANCERS}; @@ -48,7 +48,7 @@ uint32_t SpeedControlId=0xFF; uint32_t PoolerSpeedControlId=0xFF; double DancerError[NUM_OF_DANCERS] = {0.0}; -int OriginalMotorSpd_2PPS[MAX_THREAD_MOTORS_NUM] = {0}; +double OriginalMotorSpd_2PPS[MAX_THREAD_MOTORS_NUM] = {0}; uint32_t JobCounter = 0; MotorControlConfig_t MotorControlConfig[MAX_THREAD_MOTORS_NUM]; @@ -186,6 +186,7 @@ uint32_t ThreadLengthCBFunction(uint32_t IfIndex, uint32_t ReadValue) usnprintf(Lenstr, 100, "length huge: length %d, diff 0x%x, pos 0x%x prev 0x%x",(int)length*100,(int)positionDiff,PreviousPosition,prevprev); SendJobProgress(0.0,0,false, Lenstr); Report(Lenstr,__FILE__,__LINE__,(int)TotalProcessedLength,RpWarning,(int)PoolerTotalProcessedLength,0); + length = 0; } @@ -275,7 +276,7 @@ uint32_t ThreadSpeedControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) int index=MAX_THREAD_MOTORS_NUM; int32_t i, avreageSampleValue = 0; //double tempcalcspeed = 0; - uint32_t calculated_speed; + double calculated_speed; float speed = getSensorSpeedData(); if (IfIndex>>8 != IfTypeThread) { @@ -297,7 +298,7 @@ uint32_t ThreadSpeedControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) &MotorControlConfig[index].m_params, &MotorControlConfig[index].m_preError, &MotorControlConfig[index].m_integral); //SetMotorFreq (index, MotorControlConfig[index].m_calculatedError); calculated_speed = (1-MotorControlConfig[index].m_calculatedError)*OriginalMotorSpd_2PPS[index]; - if (abs(calculated_speed-CurrentControlledSpeed[index])>2) + if (fabs(calculated_speed-CurrentControlledSpeed[index])>2) { CurrentControlledSpeed[index] = calculated_speed; MotorSetSpeed(ThreadMotorIdToMotorId[index], calculated_speed); @@ -305,7 +306,7 @@ uint32_t ThreadSpeedControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) } return OK; } -uint32_t _speed; +float _speed; uint32_t ThreadControlSpeedReadFunction(uint32_t IfIndex, uint32_t ReadValue) { int index; @@ -393,7 +394,7 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) int DancerId; int32_t TranslatedReadValue, avreageSampleValue = 0,avreageMotorSampleValue = 0; //double tempcalcspeed = 0; - uint32_t calculated_speed; + double calculated_speed; double NormalizedError; if (ThreadControlActive == false) @@ -551,17 +552,17 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) calculated_speed = (1-MotorControlConfig[index].m_calculatedError)*OriginalMotorSpd_2PPS[index]; //calculated_speed = (1-MotorControlConfig[index].m_calculatedError)*CurrentControlledSpeed[index]; #ifndef TEST_PID_THREAD - if (abs(calculated_speed-CurrentControlledSpeed[index])> MotorControlConfig[index].m_ingnoreValue) + if (fabs(calculated_speed-CurrentControlledSpeed[index])> MotorControlConfig[index].m_ingnoreValue) #else if (index == FEEDER_MOTOR) //feeder unit handles errors opposite to left unit #endif { CurrentControlledSpeed[index] = calculated_speed; MotorSetSpeed(ThreadMotorIdToMotorId[index], calculated_speed); - if (((JobCounter % 2000) == index*100)&&(index == WINDER_MOTOR)) //feeder unit handles errors opposite to left unit + /*if (((JobCounter % 2000) == index*100)&&(index == WINDER_MOTOR)) //feeder unit handles errors opposite to left unit { - Report("MotorSpeedUpdated",__FILE__,index,OriginalMotorSpd_2PPS[index],RpWarning,CurrentControlledSpeed[index],0); - } + Report("MotorSpeedUpdated",__FILE__,index,(int)OriginalMotorSpd_2PPS[index],RpWarning,(int)CurrentControlledSpeed[index],0); + }*/ #ifdef TEST_PID_THREAD int len; if ((JobCounter % 2000) == index*100) @@ -587,7 +588,10 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) #endif } else + { MotorFailedSample[index]++; + //LOG_ERROR(index,"No change in speed"); + } } @@ -595,7 +599,7 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) } //******************************************************************************************************************** -uint32_t ThreadGetMotorSpeed(threadMotorsEnum MotorId) +double ThreadGetMotorSpeed(threadMotorsEnum MotorId) { return CurrentControlledSpeed[MotorId]; } diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c index 7269354f9..7ad887925 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c @@ -782,23 +782,6 @@ void SendJobProgress(double ProcessedLength, int SegmentId, bool done, char *Mes { responseContainer.has_error = true; responseContainer.error = JobError_to_ErrorCode[JobEndReason]; - switch (JobEndReason) - { - case JOB_THREAD_BREAK: - AlarmHandlingSetAlarm(EVENT_TYPE__THREAD_BREAK,true); - break; - case JOB_POOLER_DANCER_FAIL: - AlarmHandlingSetAlarm(EVENT_TYPE__THREAD_TENSION_CONTROL_FAILURE_PULLER_DANCER,true); - break; - case JOB_FEEDER_DANCER_FAIL: - AlarmHandlingSetAlarm(EVENT_TYPE__THREAD_TENSION_CONTROL_FAILURE_FEEDER_DANCER,true); - break; - case JOB_WINDER_DANCER_FAIL: - AlarmHandlingSetAlarm(EVENT_TYPE__THREAD_TENSION_CONTROL_FAILURE_WINDER_DANCER,true); - break; - default: - break; - } } if (JobAbortedByUser == true) { @@ -827,6 +810,26 @@ void SendJobProgress(double ProcessedLength, int SegmentId, bool done, char *Mes CurrentRequest = NULL; } JobStopReporting(); + if(JobEndReason != JOB_OK) + { + switch (JobEndReason) + { + case JOB_THREAD_BREAK: + AlarmHandlingSetAlarm(EVENT_TYPE__THREAD_BREAK,true); + break; + case JOB_POOLER_DANCER_FAIL: + AlarmHandlingSetAlarm(EVENT_TYPE__THREAD_TENSION_CONTROL_FAILURE_PULLER_DANCER,true); + break; + case JOB_FEEDER_DANCER_FAIL: + AlarmHandlingSetAlarm(EVENT_TYPE__THREAD_TENSION_CONTROL_FAILURE_FEEDER_DANCER,true); + break; + case JOB_WINDER_DANCER_FAIL: + AlarmHandlingSetAlarm(EVENT_TYPE__THREAD_TENSION_CONTROL_FAILURE_WINDER_DANCER,true); + break; + default: + break; + } + } JobMessageStruc JobMessage; JobMessage.messageId = PrintingResultsOk; @@ -841,6 +844,7 @@ void SendJobProgress(double ProcessedLength, int SegmentId, bool done, char *Mes } void JobStopReporting(void) { + LOG_ERROR(0,"JobStopReporting"); JobToken[0] = 0; } diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c index 46241c3a0..2aa260e9f 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c @@ -665,7 +665,7 @@ void PrintSTMMsgHandler(void * msg) if (SegmentId >= n_segments) { if (dryerbufferlength == 0) - EndState(CurrentJob, "Job Ended"); + EndState(CurrentJob, "Job Ended"); else DistanceToSpoolState(CurrentJob); } @@ -673,12 +673,34 @@ void PrintSTMMsgHandler(void * msg) { if (CurrentJob->uploadstrategy == JOB_UPLOAD_STRATEGY__JobDescriptionFile) { - if (Segment->base.descriptor->sizeof_message != 40) - LOG_ERROR (Segment->base.descriptor->sizeof_message, "Segment size error. not freeing"); + if ((Segment) && (Segment->base.descriptor->sizeof_message != 40)) + LOG_ERROR(SegmentId, "Error releasing Segment"); else if (Segment) - FreeSegmentFileData(Segment); + { + if (IDSCheckSegmentData(Segment, SegmentId) == OK) + { + FreeSegmentFileData(Segment); + } + else + { + JobEndReason = JOB_OTHER_ALARM; + if (dryerbufferlength == 0) + EndState(CurrentJob, "Job Ended"); + else + DistanceToSpoolState(CurrentJob); + } + + } Segment = GetNextSegmentFromJobFile(); + if (Segment == NULL) + { + JobEndReason = JOB_OTHER_ALARM; + if (dryerbufferlength == 0) + EndState(CurrentJob, "Job Ended"); + else + DistanceToSpoolState(CurrentJob); + } SSegment.length = Segment->length; SSegment.has_length = Segment->has_length; SSegment.n_brushstops = Segment->brushstopscount; -- cgit v1.3.1 From aacf8b3ae866d99d78870899c9b80184a66e0167 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Tue, 28 May 2019 17:05:30 +0300 Subject: Version 1.4.0.3 fix priming on empty dispenser. other small bugs --- .../Embedded/Common/SWUpdate/FileSystem.c | 1 + .../Embedded_SW/Embedded/Common/SW_Info/SW_Info.c | 2 +- .../Embedded/Drivers/Motors/MotorActions.c | 2 +- .../Embedded/Modules/AlarmHandling/AlarmHandling.c | 28 ++++++++------- .../Embedded/Modules/Diagnostics/Diagnostics.c | 1 + .../Embedded/Modules/General/GeneralHardware.c | 2 ++ .../Embedded_SW/Embedded/Modules/IDS/IDS_maint.c | 41 +++++++++++++++++++++- .../Embedded_SW/Embedded/Modules/IDS/IDS_print.c | 1 + .../Embedded/Modules/Thread/Thread_Winder.c | 14 ++++---- .../Embedded/Software Release Notes.txt | 11 ++++++ .../Embedded/StateMachines/Printing/JobSTM.c | 7 ++-- 11 files changed, 85 insertions(+), 25 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules/Thread') diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c index 68500ac88..6c0262f66 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c @@ -35,6 +35,7 @@ #include "third_party/fatfs/src/diskio.h" #include "drivers/Flash_Memory/Flash_Memory.h" #include "drivers/Flash_Memory/fatfs/ff.h" +#include "drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h" #include "third_party/fatfs/src/ffconf.h" diff --git a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c index b2590abab..bee894585 100644 --- a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c +++ b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c @@ -20,7 +20,7 @@ typedef struct } TangoVersion_t; -TangoVersion_t _gTangoVersion = {1,4,0,2}; +TangoVersion_t _gTangoVersion = {1,4,0,3}; #define BUILD_DATE __DATE__ char Dat[50] = BUILD_DATE; char _gTangoName [MAX_STRING_LEN] = "Tango01 ";//d diff --git a/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c b/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c index bf96335e1..3177dc787 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c +++ b/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c @@ -469,7 +469,7 @@ uint32_t MotorMovetoLimitSwitch (TimerMotors_t MotorId,bool direction, uint32_t MotorTimeLag[MotorId] = eTenMillisecond; MotorTimeLimit[MotorId] = timeout; - if ((MotorId == HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANHEAD)||(HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANMECH)) + if ((MotorId == HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANHEAD)||(HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANMECH)||(HARDWARE_MOTOR_TYPE__MOTO_SCREW)) MotorTimeLag[MotorId] = 2; MotorSetDirection( MotorId, direction); diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c index 931b6674f..73532a7d2 100644 --- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c +++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c @@ -669,6 +669,8 @@ uint32_t AlarmHandling_ControlTrigger(uint32_t IfIndex, uint32_t ReadValue) return OK; } +void AlarmHandlingInternalSetAlarm(uint32_t AlarmId, bool value); + void AlarmHandlingSetAlarm(uint32_t AlarmId, bool value) { AlarmHandlingInternalSetAlarm( AlarmId, value); @@ -1024,12 +1026,12 @@ void AlarmHandlingTask(UArg arg0, UArg arg1) } } //StartEventsNotificationResponse StartEventsNotification = START_EVENTS_NOTIFICATION_RESPONSE__INIT; -StartEventsNotificationResponse response = START_EVENTS_NOTIFICATION_RESPONSE__INIT; +StartEventsNotificationResponse EventsResponse = START_EVENTS_NOTIFICATION_RESPONSE__INIT; int LargeMessagesAH = 0; void SendEventNotifications(void) { MessageContainer responseContainer; - //StartEventsNotificationResponse response = START_EVENTS_NOTIFICATION_RESPONSE__INIT; + //StartEventsNotificationResponse EventsResponse = START_EVENTS_NOTIFICATION_RESPONSE__INIT; int i,e=0; if (AlarmHandlingActive == false) @@ -1042,20 +1044,20 @@ void SendEventNotifications(void) return; } - response.n_events = 0; + EventsResponse.n_events = 0; UInt Key = Task_disable(); for (i = 0;itoken, true, &response, &upload_hardware_configuration_response__pack, &upload_hardware_configuration_response__get_packed_size); if (status!= OK) { diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c index d312dcb78..0907c4a67 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c @@ -205,6 +205,10 @@ uint32_t IDS_StopHomeDispenser (uint32_t DispenserId) Disable_MidTank_Pressure_Reading(DispenserId); Valve_Set(IDS_Id_to_AirValve[DispenserId], Atm_MidTank_OFF); Control3WayValvesWithCallback ((Valves_t)DispenserId, MidTank_Dispenser, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer + if (DispenserId == LUBRICANT_DISPENSER) + { + Lubricant_2Way_Valve (START); + } MotorSetMicroStep(MotorId, MotorsCfg[MotorId].microstep); CurrentDispenserSpeed[DispenserId] = 0; @@ -227,6 +231,36 @@ uint32_t IDS_CheckDispenserLimitSwitch (LimitSwitchAlarms LS_Id) else return FPGA_Read_limit_Switches(Dispenser_Id_to_Alarm_LS_Id[LS_Id]); } +uint32_t IDS_EmptyDispenserCallback(uint32_t motorId, uint32_t ReadValue) +{ + uint8_t DispenserId = motorId-HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1; + + Read_MidTank_Pressure_Sensor(DispenserId); + //close dry air valve in the dispenser + Valve_Set(IDS_Id_to_AirValve[DispenserId], Atm_MidTank_OFF); + Disable_MidTank_Pressure_Reading(DispenserId); + + MotorStop(motorId,Hard_Hiz); + CurrentDispenserSpeed[DispenserId] = 0; + MotorSetMicroStep(motorId, MotorsCfg[motorId].microstep); + HomingActive[DispenserId]= false; + if (DispenserId == LUBRICANT_DISPENSER) + { + Lubricant_2Way_Valve (STOP); + } + + Report("End Priming",__FILE__,millisecondCounter,(int)DispenserId,RpWarning,(int)DispenserHomingTime[DispenserId],0); + //MotorSetMicroStep(motorId, MotorsCfg[motorId].microstep); + if (HomingRequestCallback[DispenserId]) + { + HomingRequestCallback[DispenserId](DispenserId,0); + HomingRequestCallback[DispenserId] = NULL; + } + + +return OK; + +} uint32_t IDS_EmptyDispenser (uint32_t DispenserId, uint32_t speed , callback_fptr callback) { @@ -254,8 +288,13 @@ uint32_t IDS_EmptyDispenser (uint32_t DispenserId, uint32_t speed , callback_fpt IDS_Dispenser_RefillStarted(DispenserId); IDS_Dispenser_MovingDirection(DispenserId,UP); + if (DispenserId == LUBRICANT_DISPENSER) + { + Lubricant_2Way_Valve (START); + } + - MotorMovetoLimitSwitch (MotorId,MotorsCfg[MotorId].directionthreadwize, speed, Dispenser_Id_to_LS_Empty_Id[DispenserId], IDS_HomeDispenserCallback,0); + MotorMovetoLimitSwitch (MotorId,MotorsCfg[MotorId].directionthreadwize, speed, Dispenser_Id_to_LS_Empty_Id[DispenserId], IDS_EmptyDispenserCallback,0); CurrentDispenserSpeed[DispenserId] = speed; return OK; } diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c index 1d395ec8c..aea16bb60 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c @@ -7,6 +7,7 @@ #include "ids.h" #include "ids_ex.h" #include "../control/control.h" +#include "../control/MillisecTask.h" #include "../general/process.h" #include "../control/pidalgo.h" #include "../thread/thread.h" diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index 9ebc32f57..a68995168 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -223,7 +223,7 @@ double WinderReferenceSpeed=0; double TotalWinderSpeed=0; bool Add100 = false; double Rotations = 6.0; -bool flipflop = false; +int flipflop = 0; uint32_t motspeed; float speedf; int WinderCalculation = 0; @@ -250,20 +250,20 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) WinderMotorSpeedRollOver=true; } // } - if (flipflop) + if (flipflop == 0) { - speedf = MotorGetSpeedFromFPGA_Res(HARDWARE_MOTOR_TYPE__MOTO_SCREW); + MotorGetSpeedFromFPGA1(HARDWARE_MOTOR_TYPE__MOTO_SCREW); } - else + else if (flipflop == 1) { - MotorGetSpeedFromFPGA1(HARDWARE_MOTOR_TYPE__MOTO_SCREW); + speedf = MotorGetSpeedFromFPGA_Res(HARDWARE_MOTOR_TYPE__MOTO_SCREW); } - flipflop = 1-flipflop; + flipflop ++; if (ScrewDirectionChangeCounter == CalculationDirectionChangeCounter) return OK; //deley TODO - + flipflop = 0; ScrewCurrentDirection = 1-ScrewCurrentDirection; CalculationDirectionChangeCounter++; diff --git a/Software/Embedded_SW/Embedded/Software Release Notes.txt b/Software/Embedded_SW/Embedded/Software Release Notes.txt index a6a82ae6d..32d5e73b2 100644 --- a/Software/Embedded_SW/Embedded/Software Release Notes.txt +++ b/Software/Embedded_SW/Embedded/Software Release Notes.txt @@ -1,3 +1,14 @@ +Embedded SW Release note - Version 1.3.10.6 - Itma Candidate 5 +============================================================= +change winding - fixed speed + +Embedded SW Release note - Version 1.3.10.5 - Itma Candidate 4 +============================================================= +bug fixes and work around: segment free, usb log, job length, length measurements, heating +better support for new and older dispensers +waste indication - empty and full + + Embedded SW Release note - Version 1.3.10.2 - Itma Candidate 3 ============================================================= Machine: diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c index 7ad887925..f5ae89368 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c @@ -743,6 +743,7 @@ void SendJobProgress(double ProcessedLength, int SegmentId, bool done, char *Mes Report(infomsg,__FILE__,__LINE__,55,RpWarning,33, 44); }*/ UInt Key = Task_disable(); + double totlength = 0; if (JobToken[0] != 0) { @@ -753,12 +754,14 @@ void SendJobProgress(double ProcessedLength, int SegmentId, bool done, char *Mes } //previousJobLength = ProcessedLength; jobStatus.has_progress = true; + totlength = TotalProcessedLength; if (TotalProcessedLength > job_length) { Report("job length bigger than assigned",__FILE__,__LINE__,TotalProcessedLength,RpWarning,job_length, done); - TotalProcessedLength = job_length; + //TotalProcessedLength = job_length; + totlength = job_length; } - jobStatus.progress = TotalProcessedLength; + jobStatus.progress = totlength; jobStatus.has_currentsegmentindex = true; jobStatus.currentsegmentindex = SegmentId; -- cgit v1.3.1 From a12577b0c2a81435ce8a9ca72cc21411c15321eb Mon Sep 17 00:00:00 2001 From: Avi Levkovich Date: Thu, 30 May 2019 15:03:01 +0300 Subject: change the motors drivers ditection logic --- .../Embedded_SW/Embedded/.config/.productview.dat | Bin 0 -> 24477 bytes .../Embedded/.config/xconfig_Embedded/.buildtime | 1 + .../Embedded/.config/xconfig_Embedded/.interfaces | 0 .../Embedded/.config/xconfig_Embedded/.xdcenv.mak | 16 ++ .../.config/xconfig_Embedded/compiler.opt.defs | 1 + .../Embedded/.config/xconfig_Embedded/config.bld | 24 ++ .../Embedded/.config/xconfig_Embedded/custom.mak | 11 + .../Embedded/.config/xconfig_Embedded/package.bld | 78 ++++++ .../Embedded/.config/xconfig_Embedded/package.mak | 256 ++++++++++++++++++++ .../Embedded/.config/xconfig_Embedded/package.xdc | 7 + .../Embedded/.config/xconfig_Embedded/package.xs | 20 ++ .../.config/xconfig_Embedded/package/.vers_b160 | 0 .../.config/xconfig_Embedded/package/.vers_g180 | 0 .../.config/xconfig_Embedded/package/.vers_r170 | 0 .../.config/xconfig_Embedded/package/.xdc-B06 | 0 .../.config/xconfig_Embedded/package/build.cfg | 9 + .../package/cfg/Embedded.xem4f.mak | 11 + .../package/cfg/Embedded_pem4f.cfg | 268 +++++++++++++++++++++ .../package/cfg/Embedded_pem4f.mak | 46 ++++ .../xconfig_Embedded/package/package.bld.xml | 84 +++++++ .../xconfig_Embedded/package/package.defs.h | 13 + .../xconfig_Embedded/package/package.xdc.dep | 53 ++++ .../xconfig_Embedded/package/package.xdc.inc | 12 + .../package/package_xconfig_Embedded.c | 21 ++ .../package/rel/xconfig_Embedded.xdc.inc | 3 + .../package/rel/xconfig_Embedded.xdc.ninc | 0 .../xconfig_Embedded/package/xconfig_Embedded.ccs | Bin 0 -> 1245 bytes .../package/xconfig_Embedded.class | Bin 0 -> 6801 bytes .../xconfig_Embedded/package/xconfig_Embedded.java | 143 +++++++++++ .../xconfig_Embedded/package/xconfig_Embedded.sch | 0 Software/Embedded_SW/Embedded/DataDef.h | 19 +- .../Embedded/Drivers/FPGA/FPGA_SPI_Comm.c | 76 +++++- .../Drivers/I2C_Communication/DAC/Blower.c | 76 ++++++ .../Embedded_SW/Embedded/Drivers/Motors/Motor.c | 21 ++ .../Embedded_SW/Embedded/Drivers/Motors/Motor.h | 6 +- .../Embedded_SW/Embedded/Drivers/SPI/SPI_Comm.c | 7 + .../Embedded/Modules/Control/MillisecTask.c | 5 + .../Embedded/Modules/Thread/Thread_init.c | 2 +- 38 files changed, 1273 insertions(+), 16 deletions(-) create mode 100644 Software/Embedded_SW/Embedded/.config/.productview.dat create mode 100644 Software/Embedded_SW/Embedded/.config/xconfig_Embedded/.buildtime create mode 100644 Software/Embedded_SW/Embedded/.config/xconfig_Embedded/.interfaces create mode 100644 Software/Embedded_SW/Embedded/.config/xconfig_Embedded/.xdcenv.mak create mode 100644 Software/Embedded_SW/Embedded/.config/xconfig_Embedded/compiler.opt.defs create mode 100644 Software/Embedded_SW/Embedded/.config/xconfig_Embedded/config.bld create mode 100644 Software/Embedded_SW/Embedded/.config/xconfig_Embedded/custom.mak create mode 100644 Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package.bld create mode 100644 Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package.mak create mode 100644 Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package.xdc create mode 100644 Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package.xs create mode 100644 Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/.vers_b160 create mode 100644 Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/.vers_g180 create mode 100644 Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/.vers_r170 create mode 100644 Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/.xdc-B06 create mode 100644 Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/build.cfg create mode 100644 Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/cfg/Embedded.xem4f.mak create mode 100644 Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/cfg/Embedded_pem4f.cfg create mode 100644 Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/cfg/Embedded_pem4f.mak create mode 100644 Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/package.bld.xml create mode 100644 Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/package.defs.h create mode 100644 Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/package.xdc.dep create mode 100644 Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/package.xdc.inc create mode 100644 Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/package_xconfig_Embedded.c create mode 100644 Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/rel/xconfig_Embedded.xdc.inc create mode 100644 Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/rel/xconfig_Embedded.xdc.ninc create mode 100644 Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/xconfig_Embedded.ccs create mode 100644 Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/xconfig_Embedded.class create mode 100644 Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/xconfig_Embedded.java create mode 100644 Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/xconfig_Embedded.sch (limited to 'Software/Embedded_SW/Embedded/Modules/Thread') diff --git a/Software/Embedded_SW/Embedded/.config/.productview.dat b/Software/Embedded_SW/Embedded/.config/.productview.dat new file mode 100644 index 000000000..01bba8454 Binary files /dev/null and b/Software/Embedded_SW/Embedded/.config/.productview.dat differ diff --git a/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/.buildtime b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/.buildtime new file mode 100644 index 000000000..7f6d56957 --- /dev/null +++ b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/.buildtime @@ -0,0 +1 @@ +C:\Tango\Software\Embedded_SW\Embedded\.config\xconfig_Embedded\.buildtime \ No newline at end of file diff --git a/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/.interfaces b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/.interfaces new file mode 100644 index 000000000..e69de29bb diff --git a/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/.xdcenv.mak b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/.xdcenv.mak new file mode 100644 index 000000000..7654ecd27 --- /dev/null +++ b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/.xdcenv.mak @@ -0,0 +1,16 @@ +# +_XDCBUILDCOUNT = +ifneq (,$(findstring path,$(_USEXDCENV_))) +override XDCPATH = C:/TI/tirtos_tivac_2_16_00_08/packages;C:/TI/tirtos_tivac_2_16_00_08/products/tidrivers_tivac_2_16_00_08/packages;C:/TI/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages;C:/TI/tirtos_tivac_2_16_00_08/products/ndk_2_25_00_09/packages;C:/TI/tirtos_tivac_2_16_00_08/products/uia_2_00_05_50/packages;C:/TI/tirtos_tivac_2_16_00_08/products/ns_1_11_00_10/packages;C:/TI/TivaWare_C_Series-2.1.2.111;C:/TI/ccsv7/ccs_base;C:/Tango/Software/Embedded_SW/Embedded/.config +override XDCROOT = C:/TI/xdctools_3_32_00_06_core +override XDCBUILDCFG = ./config.bld +endif +ifneq (,$(findstring args,$(_USEXDCENV_))) +override XDCARGS = +override XDCTARGETS = +endif +# +ifeq (0,1) +PKGPATH = C:/TI/tirtos_tivac_2_16_00_08/packages;C:/TI/tirtos_tivac_2_16_00_08/products/tidrivers_tivac_2_16_00_08/packages;C:/TI/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages;C:/TI/tirtos_tivac_2_16_00_08/products/ndk_2_25_00_09/packages;C:/TI/tirtos_tivac_2_16_00_08/products/uia_2_00_05_50/packages;C:/TI/tirtos_tivac_2_16_00_08/products/ns_1_11_00_10/packages;C:/TI/TivaWare_C_Series-2.1.2.111;C:/TI/ccsv7/ccs_base;C:/Tango/Software/Embedded_SW/Embedded/.config;C:/TI/xdctools_3_32_00_06_core/packages;.. +HOSTOS = Windows +endif diff --git a/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/compiler.opt.defs b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/compiler.opt.defs new file mode 100644 index 000000000..c48b1a33d --- /dev/null +++ b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/compiler.opt.defs @@ -0,0 +1 @@ +-I"C:/TI/tirtos_tivac_2_16_00_08/packages" -I"C:/TI/tirtos_tivac_2_16_00_08/products/tidrivers_tivac_2_16_00_08/packages" -I"C:/TI/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages" -I"C:/TI/tirtos_tivac_2_16_00_08/products/ndk_2_25_00_09/packages" -I"C:/TI/tirtos_tivac_2_16_00_08/products/uia_2_00_05_50/packages" -I"C:/TI/tirtos_tivac_2_16_00_08/products/ns_1_11_00_10/packages" -I"C:/TI/TivaWare_C_Series-2.1.2.111" -I"C:/TI/ccsv7/ccs_base" -I"C:/Tango/Software/Embedded_SW/Embedded/.config" -I"C:/TI/xdctools_3_32_00_06_core/packages" -I"C:/Tango/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/.." -IC:/TI/ccsv7/tools/compiler/ti-cgt-arm_16.9.4.LTS/include/rts -IC:/TI/ccsv7/tools/compiler/ti-cgt-arm_16.9.4.LTS/include -Dxdc_target_types__="ti/targets/arm/elf/std.h" -Dxdc_target_name__=M4F -Dxdc_cfg__xheader__="\"C:/Tango/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/cfg/Embedded_pem4f.h\"" diff --git a/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/config.bld b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/config.bld new file mode 100644 index 000000000..74ff6d21b --- /dev/null +++ b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/config.bld @@ -0,0 +1,24 @@ +/* THIS IS A GENERATED FILE -- DO NOT EDIT */ + +var target; /* the target used for this build */ + +/* configuro was passed the target's name explicitly */ +try { + target = xdc.module('ti.targets.arm.elf.M4F'); +} +catch (e) { + throw new Error("Can't find the target named '" + 'ti.targets.arm.elf.M4F' + + "' along the path '" + environment["xdc.path"] + + "': please check the spelling of the target's name and that it exists along this path."); +} +if (!(target instanceof xdc.module("xdc.bld.ITarget").Module)) { + throw new Error("The module named 'ti.targets.arm.elf.M4F' exists but it's not a target: please check the spelling of the target's name"); +} + +/* configuro was passed compiler options explicitly */ +target.ccOpts.prefix = unescape("%22--code_state%3D16%20--float_support%3DFPv4SPD16%20-me%20") + target.ccOpts.prefix; + +/* configuro was passed the target's rootDir explicitly */ +target.rootDir = 'C:/TI/ccsv7/tools/compiler/ti-cgt-arm_16.9.4.LTS'; + +Build.targets = [target]; diff --git a/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/custom.mak b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/custom.mak new file mode 100644 index 000000000..776a3cb74 --- /dev/null +++ b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/custom.mak @@ -0,0 +1,11 @@ +## THIS IS A GENERATED FILE -- DO NOT EDIT +.configuro: .libraries,em4f linker.cmd package/cfg/Embedded_pem4f.oem4f + +# To simplify configuro usage in makefiles: +# o create a generic linker command file name +# o set modification times of compiler.opt* files to be greater than +# or equal to the generated config header +# +linker.cmd: package/cfg/Embedded_pem4f.xdl + $(SED) 's"^\"\(package/cfg/Embedded_pem4fcfg.cmd\)\"$""\"C:/Tango/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/\1\""' package/cfg/Embedded_pem4f.xdl > $@ + -$(SETDATE) -r:max package/cfg/Embedded_pem4f.h compiler.opt compiler.opt.defs diff --git a/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package.bld b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package.bld new file mode 100644 index 000000000..30e81adf6 --- /dev/null +++ b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package.bld @@ -0,0 +1,78 @@ +/* THIS IS A GENERATED FILE -- DO NOT EDIT */ + +var targ = xdc.module('ti.targets.arm.elf.M4F'); +/* configuro was told the platform explicitly */ +var platform = 'ti.platforms.tiva:TM4C129XNCZAD'; + +/* decide whether to make an assembly or an executable */ +var makeAssembly = false; + + +var Executable = xdc.module('xdc.bld.Executable'); + +var exeOpts = new Executable.Attrs({ + cfgScript: 'C:/Tango/Software/Embedded_SW/Embedded/Embedded.cfg', + profile: 'release', + cfgHome: 'xconfig_Embedded', +}); + +exeOpts.cfgArgs = 'null'; +exeOpts.cfgArgsEncoded = true; + +var exe = Pkg[makeAssembly ? 'addAssembly': 'addExecutable']( + 'Embedded', + targ, + platform, + exeOpts +); + +/* + * Generate the compiler.opt file + * Do this here instead of during the initial creation of the configuro + * package, because the contents of any config.bld script are unknown + * at that time. Config.bld can't be executed until the XDC build phase. + */ +if (makeAssembly) { + var suffix = targ.dllExt || '.p' + targ.suffix; +} +else { + var suffix = '.p' + targ.suffix; +} + +var thisObj = { + cfg: 'C:/Tango/Software/Embedded_SW/Embedded/Embedded.cfg', + outputPath: 'C:/Tango/Software/Embedded_SW/Embedded/.config/xconfig_Embedded', + exeName: 'Embedded' + suffix, + exeIntName: 'Embedded' + suffix.replace('.', '_'), + targ: targ, + linkerCommandFile: 'linker.cmd', + compilerOptFile: 'compiler.opt', + compilerDefsFile: 'compiler.opt' + ".defs", + makeAssembly: makeAssembly +}; +var tmpl = xdc.loadTemplate('xdc/tools/configuro/template/compiler.opt.xdt'); +tmpl.genFile('compiler.opt', thisObj, [], false); + +/* + * Generate the custom makefile. + */ +var tmpl = xdc.loadTemplate('xdc/tools/configuro/template/' + + (makeAssembly? 'custom.mak.asm.xdt' : 'custom.mak.exe.xdt')); +tmpl.genFile('custom.mak', thisObj, [], false); +Pkg.makeEpilogue = "include custom.mak"; + +/* + * Generate the package script. + */ +var tmpl = xdc.loadTemplate('xdc/tools/configuro/template/package.xs.xdt'); +tmpl.genFile('package.xs', thisObj, [], false); + +if (makeAssembly) { +/* + * Generate the linker options into a staging file, so that the presence or + * age of the advertised linker command file can be the makefile trigger to + * rebuild the package from the user's config script. + */ + var tmpl = xdc.loadTemplate('xdc/tools/configuro/template/linker.cmd.asm.xdt'); + tmpl.genFile('linker.cmd.cp', thisObj, [], false); +} diff --git a/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package.mak b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package.mak new file mode 100644 index 000000000..6f18e8d3b --- /dev/null +++ b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package.mak @@ -0,0 +1,256 @@ +# +# Do not edit this file. This file is generated from +# package.bld. Any modifications to this file will be +# overwritten whenever makefiles are re-generated. +# + +unexport MAKEFILE_LIST +MK_NOGENDEPS := $(filter clean,$(MAKECMDGOALS)) +override PKGDIR = xconfig_Embedded +XDCINCS = -I. -I$(strip $(subst ;, -I,$(subst $(space),\$(space),$(XPKGPATH)))) +XDCCFGDIR = package/cfg/ + +# +# The following dependencies ensure package.mak is rebuilt +# in the event that some included BOM script changes. +# +ifneq (clean,$(MAKECMDGOALS)) +C:/TI/xdctools_3_32_00_06_core/packages/xdc/utils.js: +package.mak: C:/TI/xdctools_3_32_00_06_core/packages/xdc/utils.js +C:/TI/xdctools_3_32_00_06_core/packages/xdc/xdc.tci: +package.mak: C:/TI/xdctools_3_32_00_06_core/packages/xdc/xdc.tci +C:/TI/xdctools_3_32_00_06_core/packages/xdc/template.xs: +package.mak: C:/TI/xdctools_3_32_00_06_core/packages/xdc/template.xs +C:/TI/xdctools_3_32_00_06_core/packages/xdc/om2.xs: +package.mak: C:/TI/xdctools_3_32_00_06_core/packages/xdc/om2.xs +C:/TI/xdctools_3_32_00_06_core/packages/xdc/xmlgen.xs: +package.mak: C:/TI/xdctools_3_32_00_06_core/packages/xdc/xmlgen.xs +C:/TI/xdctools_3_32_00_06_core/packages/xdc/xmlgen2.xs: +package.mak: C:/TI/xdctools_3_32_00_06_core/packages/xdc/xmlgen2.xs +C:/TI/xdctools_3_32_00_06_core/packages/xdc/Warnings.xs: +package.mak: C:/TI/xdctools_3_32_00_06_core/packages/xdc/Warnings.xs +C:/TI/xdctools_3_32_00_06_core/packages/xdc/IPackage.xs: +package.mak: C:/TI/xdctools_3_32_00_06_core/packages/xdc/IPackage.xs +C:/TI/xdctools_3_32_00_06_core/packages/xdc/package.xs: +package.mak: C:/TI/xdctools_3_32_00_06_core/packages/xdc/package.xs +C:/TI/xdctools_3_32_00_06_core/packages/xdc/services/global/Clock.xs: +package.mak: C:/TI/xdctools_3_32_00_06_core/packages/xdc/services/global/Clock.xs +C:/TI/xdctools_3_32_00_06_core/packages/xdc/services/global/Trace.xs: +package.mak: C:/TI/xdctools_3_32_00_06_core/packages/xdc/services/global/Trace.xs +C:/TI/xdctools_3_32_00_06_core/packages/xdc/bld/bld.js: +package.mak: C:/TI/xdctools_3_32_00_06_core/packages/xdc/bld/bld.js +C:/TI/xdctools_3_32_00_06_core/packages/xdc/bld/BuildEnvironment.xs: +package.mak: C:/TI/xdctools_3_32_00_06_core/packages/xdc/bld/BuildEnvironment.xs +C:/TI/xdctools_3_32_00_06_core/packages/xdc/bld/PackageContents.xs: +package.mak: C:/TI/xdctools_3_32_00_06_core/packages/xdc/bld/PackageContents.xs +C:/TI/xdctools_3_32_00_06_core/packages/xdc/bld/_gen.xs: +package.mak: C:/TI/xdctools_3_32_00_06_core/packages/xdc/bld/_gen.xs +C:/TI/xdctools_3_32_00_06_core/packages/xdc/bld/Library.xs: +package.mak: C:/TI/xdctools_3_32_00_06_core/packages/xdc/bld/Library.xs +C:/TI/xdctools_3_32_00_06_core/packages/xdc/bld/Executable.xs: +package.mak: C:/TI/xdctools_3_32_00_06_core/packages/xdc/bld/Executable.xs +C:/TI/xdctools_3_32_00_06_core/packages/xdc/bld/Repository.xs: +package.mak: C:/TI/xdctools_3_32_00_06_core/packages/xdc/bld/Repository.xs +C:/TI/xdctools_3_32_00_06_core/packages/xdc/bld/Configuration.xs: +package.mak: C:/TI/xdctools_3_32_00_06_core/packages/xdc/bld/Configuration.xs +C:/TI/xdctools_3_32_00_06_core/packages/xdc/bld/Script.xs: +package.mak: C:/TI/xdctools_3_32_00_06_core/packages/xdc/bld/Script.xs +C:/TI/xdctools_3_32_00_06_core/packages/xdc/bld/Manifest.xs: +package.mak: C:/TI/xdctools_3_32_00_06_core/packages/xdc/bld/Manifest.xs +C:/TI/xdctools_3_32_00_06_core/packages/xdc/bld/Utils.xs: +package.mak: C:/TI/xdctools_3_32_00_06_core/packages/xdc/bld/Utils.xs +C:/TI/xdctools_3_32_00_06_core/packages/xdc/bld/ITarget.xs: +package.mak: C:/TI/xdctools_3_32_00_06_core/packages/xdc/bld/ITarget.xs +C:/TI/xdctools_3_32_00_06_core/packages/xdc/bld/ITarget2.xs: +package.mak: C:/TI/xdctools_3_32_00_06_core/packages/xdc/bld/ITarget2.xs +C:/TI/xdctools_3_32_00_06_core/packages/xdc/bld/ITarget3.xs: +package.mak: C:/TI/xdctools_3_32_00_06_core/packages/xdc/bld/ITarget3.xs +C:/TI/xdctools_3_32_00_06_core/packages/xdc/bld/ITargetFilter.xs: +package.mak: C:/TI/xdctools_3_32_00_06_core/packages/xdc/bld/ITargetFilter.xs +C:/TI/xdctools_3_32_00_06_core/packages/xdc/bld/package.xs: +package.mak: C:/TI/xdctools_3_32_00_06_core/packages/xdc/bld/package.xs +package.mak: config.bld +C:/TI/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/ti/targets/ITarget.xs: +package.mak: C:/TI/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/ti/targets/ITarget.xs +C:/TI/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/ti/targets/C28_large.xs: +package.mak: C:/TI/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/ti/targets/C28_large.xs +C:/TI/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/ti/targets/C28_float.xs: +package.mak: C:/TI/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/ti/targets/C28_float.xs +C:/TI/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/ti/targets/package.xs: +package.mak: C:/TI/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/ti/targets/package.xs +C:/TI/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/ti/targets/arm/elf/IArm.xs: +package.mak: C:/TI/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/ti/targets/arm/elf/IArm.xs +C:/TI/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/ti/targets/arm/elf/package.xs: +package.mak: C:/TI/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/ti/targets/arm/elf/package.xs +package.mak: package.bld +C:/TI/xdctools_3_32_00_06_core/packages/xdc/tools/configuro/template/compiler.opt.xdt: +package.mak: C:/TI/xdctools_3_32_00_06_core/packages/xdc/tools/configuro/template/compiler.opt.xdt +C:/TI/xdctools_3_32_00_06_core/packages/xdc/services/io/File.xs: +package.mak: C:/TI/xdctools_3_32_00_06_core/packages/xdc/services/io/File.xs +C:/TI/xdctools_3_32_00_06_core/packages/xdc/services/io/package.xs: +package.mak: C:/TI/xdctools_3_32_00_06_core/packages/xdc/services/io/package.xs +C:/TI/xdctools_3_32_00_06_core/packages/xdc/tools/configuro/template/compiler.defs.xdt: +package.mak: C:/TI/xdctools_3_32_00_06_core/packages/xdc/tools/configuro/template/compiler.defs.xdt +C:/TI/xdctools_3_32_00_06_core/packages/xdc/tools/configuro/template/custom.mak.exe.xdt: +package.mak: C:/TI/xdctools_3_32_00_06_core/packages/xdc/tools/configuro/template/custom.mak.exe.xdt +C:/TI/xdctools_3_32_00_06_core/packages/xdc/tools/configuro/template/package.xs.xdt: +package.mak: C:/TI/xdctools_3_32_00_06_core/packages/xdc/tools/configuro/template/package.xs.xdt +endif + +ti.targets.arm.elf.M4F.rootDir ?= C:/TI/ccsv7/tools/compiler/ti-cgt-arm_16.9.4.LTS +ti.targets.arm.elf.packageBase ?= C:/TI/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/ti/targets/arm/elf/ +.PRECIOUS: $(XDCCFGDIR)/%.oem4f +.PHONY: all,em4f .dlls,em4f .executables,em4f test,em4f +all,em4f: .executables,em4f +.executables,em4f: .libraries,em4f +.executables,em4f: .dlls,em4f +.dlls,em4f: .libraries,em4f +.libraries,em4f: .interfaces + @$(RM) $@ + @$(TOUCH) "$@" + +.help:: + @$(ECHO) xdc test,em4f + @$(ECHO) xdc .executables,em4f + @$(ECHO) xdc .libraries,em4f + @$(ECHO) xdc .dlls,em4f + + +all: .executables +.executables: .libraries .dlls +.libraries: .interfaces + +PKGCFGS := $(wildcard package.xs) package/build.cfg +.interfaces: package/package.xdc.inc package/package.defs.h package.xdc $(PKGCFGS) + +-include package/package.xdc.dep +package/%.xdc.inc package/%_xconfig_Embedded.c package/%.defs.h: %.xdc $(PKGCFGS) + @$(MSG) generating interfaces for package xconfig_Embedded" (because $@ is older than $(firstword $?))" ... + $(XSRUN) -f xdc/services/intern/cmd/build.xs $(MK_IDLOPTS) -m package/package.xdc.dep -i package/package.xdc.inc package.xdc + +.dlls,em4f .dlls: Embedded.pem4f + +-include package/cfg/Embedded_pem4f.mak +-include package/cfg/Embedded_pem4f.cfg.mak +ifeq (,$(MK_NOGENDEPS)) +-include package/cfg/Embedded_pem4f.dep +endif +Embedded.pem4f: package/cfg/Embedded_pem4f.xdl + @ + + +ifeq (,$(wildcard .libraries,em4f)) +Embedded.pem4f package/cfg/Embedded_pem4f.c: .libraries,em4f +endif + +package/cfg/Embedded_pem4f.c package/cfg/Embedded_pem4f.h package/cfg/Embedded_pem4f.xdl: override _PROG_NAME := Embedded.xem4f +package/cfg/Embedded_pem4f.c: package/cfg/Embedded_pem4f.cfg +package/cfg/Embedded_pem4f.xdc.inc: package/cfg/Embedded_pem4f.xdl +package/cfg/Embedded_pem4f.xdl package/cfg/Embedded_pem4f.c: .interfaces + +clean:: clean,em4f + -$(RM) package/cfg/Embedded_pem4f.cfg + -$(RM) package/cfg/Embedded_pem4f.dep + -$(RM) package/cfg/Embedded_pem4f.c + -$(RM) package/cfg/Embedded_pem4f.xdc.inc + +clean,em4f:: + -$(RM) Embedded.pem4f +.executables,em4f .executables: Embedded.xem4f + +Embedded.xem4f: |Embedded.pem4f + +-include package/cfg/Embedded.xem4f.mak +Embedded.xem4f: package/cfg/Embedded_pem4f.oem4f + $(RM) $@ + @$(MSG) lnkem4f $@ ... + $(RM) $(XDCCFGDIR)/$@.map + $(ti.targets.arm.elf.M4F.rootDir)/bin/armcl -fs $(XDCCFGDIR)$(dir $@). -q -u _c_int00 --silicon_version=7M4 -z --strict_compatibility=on -o $@ package/cfg/Embedded_pem4f.oem4f package/cfg/Embedded_pem4f.xdl -w -c -m $(XDCCFGDIR)/$@.map -l $(ti.targets.arm.elf.M4F.rootDir)/lib/libc.a + +Embedded.xem4f: export C_DIR= +Embedded.xem4f: PATH:=$(ti.targets.arm.elf.M4F.rootDir)/bin/;$(PATH) +Embedded.xem4f: Path:=$(ti.targets.arm.elf.M4F.rootDir)/bin/;$(PATH) + +Embedded.test test,em4f test: Embedded.xem4f.test + +Embedded.xem4f.test:: Embedded.xem4f +ifeq (,$(_TESTLEVEL)) + @$(MAKE) -R -r --no-print-directory -f $(XDCROOT)/packages/xdc/bld/xdc.mak _TESTLEVEL=1 Embedded.xem4f.test +else + @$(MSG) running $< ... + $(call EXEC.Embedded.xem4f, ) +endif + +clean,em4f:: + -$(RM) $(wildcard .tmp,Embedded.xem4f,*) + + +clean:: clean,em4f + +clean,em4f:: + -$(RM) Embedded.xem4f +%,copy: + @$(if $<,,$(MSG) don\'t know how to build $*; exit 1) + @$(MSG) cp $< $@ + $(RM) $@ + $(CP) $< $@ +Embedded_pem4f.oem4f,copy : package/cfg/Embedded_pem4f.oem4f +Embedded_pem4f.sem4f,copy : package/cfg/Embedded_pem4f.sem4f + +$(XDCCFGDIR)%.c $(XDCCFGDIR)%.h $(XDCCFGDIR)%.xdl: $(XDCCFGDIR)%.cfg $(XDCROOT)/packages/xdc/cfg/Main.xs | .interfaces + @$(MSG) "configuring $(_PROG_NAME) from $< ..." + $(CONFIG) $(_PROG_XSOPTS) xdc.cfg $(_PROG_NAME) $(XDCCFGDIR)$*.cfg $(XDCCFGDIR)$* + +.PHONY: release,xconfig_Embedded +ifeq (,$(MK_NOGENDEPS)) +-include package/rel/xconfig_Embedded.tar.dep +endif +package/rel/xconfig_Embedded/xconfig_Embedded/package/package.rel.xml: package/package.bld.xml +package/rel/xconfig_Embedded/xconfig_Embedded/package/package.rel.xml: package/build.cfg +package/rel/xconfig_Embedded/xconfig_Embedded/package/package.rel.xml: package/package.xdc.inc +package/rel/xconfig_Embedded/xconfig_Embedded/package/package.rel.xml: .force + @$(MSG) generating external release references $@ ... + $(XS) $(JSENV) -f $(XDCROOT)/packages/xdc/bld/rel.js $(MK_RELOPTS) . $@ + +xconfig_Embedded.tar: package/rel/xconfig_Embedded.xdc.inc package/rel/xconfig_Embedded/xconfig_Embedded/package/package.rel.xml + @$(MSG) making release file $@ "(because of $(firstword $?))" ... + -$(RM) $@ + $(call MKRELTAR,package/rel/xconfig_Embedded.xdc.inc,package/rel/xconfig_Embedded.tar.dep) + + +release release,xconfig_Embedded: all xconfig_Embedded.tar +clean:: .clean + -$(RM) xconfig_Embedded.tar + -$(RM) package/rel/xconfig_Embedded.xdc.inc + -$(RM) package/rel/xconfig_Embedded.tar.dep + +clean:: .clean + -$(RM) .libraries $(wildcard .libraries,*) +clean:: + -$(RM) .dlls $(wildcard .dlls,*) +# +# The following clean rule removes user specified +# generated files or directories. +# + +ifneq (clean,$(MAKECMDGOALS)) +ifeq (,$(wildcard package)) + $(shell $(MKDIR) package) +endif +ifeq (,$(wildcard package/cfg)) + $(shell $(MKDIR) package/cfg) +endif +ifeq (,$(wildcard package/lib)) + $(shell $(MKDIR) package/lib) +endif +ifeq (,$(wildcard package/rel)) + $(shell $(MKDIR) package/rel) +endif +ifeq (,$(wildcard package/internal)) + $(shell $(MKDIR) package/internal) +endif +endif +clean:: + -$(RMDIR) package + +include custom.mak diff --git a/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package.xdc b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package.xdc new file mode 100644 index 000000000..5ae1a0aa5 --- /dev/null +++ b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package.xdc @@ -0,0 +1,7 @@ +/*! + * Package generated by xdc.tools.configuro + * + * @_nodoc + */ +package xconfig_Embedded { +} diff --git a/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package.xs b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package.xs new file mode 100644 index 000000000..373d44f5e --- /dev/null +++ b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package.xs @@ -0,0 +1,20 @@ +/* THIS IS A GENERATED FILE -- DO NOT EDIT */ + +/* return the names of the generated config objects */ +function getLibs(prog) { + /* for programs, push the generated config object file into the + * generated linker command file. + */ + /* replace the last period in the name by an underscore */ + var name = "package/cfg/" + prog.name.replace(/\.([^.]*)$/, "_$1"); + /* base is a hack until we add cfgName to Program */ + var base = "package/cfg/" + prog.name.replace(/\.([^.]*)$/, ""); + var suffix = prog.build.target.suffix; + + var libs = [ +// name + '.o' + suffix, + base + '_p' + suffix + '.o' + suffix + ]; + + return libs.join(';'); +} diff --git a/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/.vers_b160 b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/.vers_b160 new file mode 100644 index 000000000..e69de29bb diff --git a/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/.vers_g180 b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/.vers_g180 new file mode 100644 index 000000000..e69de29bb diff --git a/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/.vers_r170 b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/.vers_r170 new file mode 100644 index 000000000..e69de29bb diff --git a/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/.xdc-B06 b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/.xdc-B06 new file mode 100644 index 000000000..e69de29bb diff --git a/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/build.cfg b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/build.cfg new file mode 100644 index 000000000..5ec1eb102 --- /dev/null +++ b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/build.cfg @@ -0,0 +1,9 @@ +if (pkg.$vers.length >= 3) { + pkg.$vers.push(Packages.xdc.services.global.Vers.getDate(xdc.csd() + '/..')); +} + +pkg.build.libraries = [ +]; + +pkg.build.libDesc = [ +]; diff --git a/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/cfg/Embedded.xem4f.mak b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/cfg/Embedded.xem4f.mak new file mode 100644 index 000000000..f7ad36e1c --- /dev/null +++ b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/cfg/Embedded.xem4f.mak @@ -0,0 +1,11 @@ +# +# Do not edit this file. This file is generated from +# package.bld. Any modifications to this file will be +# overwritten whenever makefiles are re-generated. +# +# target compatibility key = ti.targets.arm.elf.M4F{1,0,16.9,4 +# +Embedded.xem4f: package/cfg/Embedded.xem4f.mak + +clean:: + -$(RM) package/cfg/Embedded.xem4f.mak diff --git a/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/cfg/Embedded_pem4f.cfg b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/cfg/Embedded_pem4f.cfg new file mode 100644 index 000000000..5e7fdeb7d --- /dev/null +++ b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/cfg/Embedded_pem4f.cfg @@ -0,0 +1,268 @@ +/* + * ======== package/cfg/Embedded_pem4f.cfg ======== + * This generated configuration script runs the user's configuration script + * the context of a specific target and platform in order to generate + * all the files necessary to create an executable; e.g., linker command + * files, static C/C++ data structures, etc. + */ + +/* + * ======== _applyChanges ======== + * Changes that bring the build target to the state at the end of the build + * model + */ +function _applyChanges(obj, chgObj) { + var wasSealed = false; + if (obj.$sealed) { + wasSealed = true; + obj.$unseal(); + } + for (var prop in chgObj) { + if (typeof obj[prop] == 'object' && obj[prop] != undefined) { + if ("$category" in obj[prop] && obj[prop].$category == "Vector") { + obj[prop].length = chgObj[prop].length; + for (var i = 0; i < chgObj[prop].length; i++) { + if (obj[prop].length < i + 1) { + obj[prop].length++; + } + obj[prop][i] = chgObj[prop][i]; + } + } + else { + _applyChanges(obj[prop], chgObj[prop]); + } + } + else { + obj[prop] = chgObj[prop]; + } + } + if (wasSealed) { + obj.$seal(); + } +} + +/* + * ======== _runescape ======== + * Recursive unescape to decode serialized strings + */ +function _runescape(obj) { + for (var i in obj) { + if (obj[i] != null) { + if (typeof obj[i] == 'string') { + obj[i] = unescape(obj[i]); + } + else if (typeof obj[i] == 'object') { + _runescape(obj[i]); + } + } + } +} + +/* + * ======== _getPlatCfg ======== + */ +function _getPlatCfg() { + var tmp = {}; + _runescape(tmp); + return (tmp); +} +/* + * ======== _cfginit ======== + */ +function _cfginit() { + xdc.loadPackage('xdc.services.intern.cmd'); + var prog = xdc.om['xdc.cfg.Program']; + + /* initialize prog attrs from build model */ + var build = { + profile: "release", + cfgScript: "C%3A/Tango/Software/Embedded_SW/Embedded/Embedded.cfg", + cfgHome: "xconfig_Embedded", + cfgArgs: "null", + cfgArgsEncoded: true, + releases: { + 0: { + name: "xconfig_Embedded", + attrs: { + prefix: "", + label: "default" + }, + otherFiles: {}, + excludeDirs: {} + } + }, + prelink: false + }; + _runescape(build); + build.cfgArgs = null; + build.target = xdc.module("ti.targets.arm.elf.M4F"); + var targChange = { + platforms: [ + "ti.platforms.tiva%3ATM4C1294NCPDT%3A1" + ], + version: "ti.targets.arm.elf.M4F%7B1%2C0%2C16.9%2C4", + extensions: { + ".sem4fe": { + suf: ".sem4fe", + typ: "asm" + }, + ".sem4f": { + suf: ".sem4f", + typ: "asm" + }, + ".sv7M4": { + suf: ".sv7M4", + typ: "asm" + }, + ".sv7M": { + suf: ".sv7M", + typ: "asm" + } + }, + rootDir: "C%3A/TI/ccsv7/tools/compiler/ti-cgt-arm_16.9.4.LTS", + ccOpts: { + prefix: "%22--code_state%3D16%20--float_support%3DFPv4SPD16%20-me%20-qq%20-pdsw225" + }, + rawVersion: "16.9.4" + }; + _runescape(targChange); + _applyChanges(build.target, targChange); + + prog.build = build; + + prog.name = "Embedded.xem4f"; + prog.cfgBase = "package/cfg/Embedded_pem4f"; + + prog.endian = prog.build.target.model.endian; + prog.codeModel = prog.build.target.model.codeModel; + + /* use the platform package's Platform module */ + var Platform = xdc.useModule("ti.platforms.tiva.Platform"); + var platParams = _getPlatCfg(); + var invalidParams = []; + for (var prop in platParams) { + if (!(prop in Platform.PARAMS)) { + delete platParams[prop]; + invalidParams.push(prop); + } + } + prog.platformName = "ti.platforms.tiva:TM4C129XNCZAD"; + prog.platform = Platform.create("TM4C129XNCZAD", platParams); + for (var i = 0; i < invalidParams.length; i++) { + Platform.$logWarning("The parameter '" + invalidParams[i] + "' is " + + "passed to this platform instance through Build.platformTable, " + + "but the instance does not have a configuration parameter with " + + "that name.", prog.platform, "TM4C129XNCZAD"); + } + + /* record the executable's package name */ + prog.buildPackage = "xconfig_Embedded"; + + /* record build-model information required during config generation */ + prog.$$bind("$$isasm", 0); + prog.$$bind("$$isrom", 0); + prog.$$bind("$$gentab", [ + ]); + + /* bind prog to an appropriate execution context */ + prog.cpu = prog.platform.getExeContext(prog); + + /* import the target's run-time support pkg */ + xdc.loadPackage("ti.targets.arm.rtsarm"); +} + +/* function to import the cfg script's package */ +function _userscript(script) { + var home; + var spath; + home = xdc.loadPackage("xconfig_Embedded"); + + xdc.om.$$bind('$homepkg', home); + + var cfgScript = "C:/Tango/Software/Embedded_SW/Embedded/Embedded.cfg"; + if (!script) { + utils.loadCapsule(cfgScript, false, spath); + } + else { + /* set up the same environment that loadCapsule would */ + var $saveCsd = utils.csd; + var $cfgFile = utils.findFile(cfgScript, spath); + var cname = cfgScript; + if ($cfgFile) { + $cfgFile = java.io.File($cfgFile); + utils.csd = $cfgFile.getParentFile().getCanonicalPath(); + cname = "" + $cfgFile.getCanonicalPath(); + } + + /* create the capsule object */ + var cap = { + prototype: utils.global, + $path: cname, + $private: {path: cname}, + $capsule: undefined, /* set to cap below */ + }; + + /* 'this.$capsule' is always cap object */ + cap.$capsule = cap; + + /* save the capsule object */ + utils.$$capmap[cname] = cap; + + try { + var cx = + Packages.org.mozilla.javascript.Context.getCurrentContext(); + var rdr = new + java.io.BufferedReader(new java.io.StringReader(script)); + Packages.config.Shell.evaluateLoad(cx, cap, rdr, cname, 1); + } + finally { + rdr.close(); + utils.csd = $saveCsd; + } + } +} + +function _postinit() { + var cout = null; + + var Program = xdc.om['xdc.cfg.Program']; + /* get the exec command for this executable */ + if (Program.execCmd == null) { + Program.execCmd = Program.platform.getExecCmd(Program, + xdc.om["ti.platforms.tiva"].packageBase); + } + cout = "define EXEC." + Program.name + '\n\n'; + cout += Program.execCmd; + cout += "\nendef\n\n"; + + /* if SourceDir generates a makefile, we need to run it */ + _genSourceDirMak("package/cfg/Embedded_pem4f", "Embedded.pem4f"); + + utils.genDep("package/cfg/Embedded_pem4f", "xconfig_Embedded", utils.loadedFiles, cout, null); +} + +function _genSourceDirMak(cfgBase, cfgName) +{ + var SourceDir = xdc.om['xdc.cfg.SourceDir']; + + if (SourceDir && SourceDir.$instances.length > 0) { + /* construct rule to run SourceDir generated makefile */ + var make = "\t$(MAKE) -f " + + SourceDir.outputDir + "/" + SourceDir.makefileName; + + /* this file is included by package.mak (if it exists) */ + var file = new java.io.File(cfgBase + ".cfg.mak"); + file["delete"](); + var out = new java.io.BufferedWriter(new java.io.FileWriter(file)); + + /* add rules to run SourceDir generated makefile */ + out.write("# invoke SourceDir generated makefile for " + cfgName + + "\n" + cfgName + ": .libraries," + cfgName + + "\n.libraries," + cfgName + ": " + cfgBase + ".xdl\n" + + make + "\n\n" + + "clean::\n" + make + " clean\n\n" + ); + out.close(); + out = null; + } +} diff --git a/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/cfg/Embedded_pem4f.mak b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/cfg/Embedded_pem4f.mak new file mode 100644 index 000000000..ba42567df --- /dev/null +++ b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/cfg/Embedded_pem4f.mak @@ -0,0 +1,46 @@ +# +# Do not edit this file. This file is generated from +# package.bld. Any modifications to this file will be +# overwritten whenever makefiles are re-generated. +# +# target compatibility key = ti.targets.arm.elf.M4F{1,0,16.9,4 +# +ifeq (,$(MK_NOGENDEPS)) +-include package/cfg/Embedded_pem4f.oem4f.dep +package/cfg/Embedded_pem4f.oem4f.dep: ; +endif + +package/cfg/Embedded_pem4f.oem4f: | .interfaces +package/cfg/Embedded_pem4f.oem4f: package/cfg/Embedded_pem4f.c package/cfg/Embedded_pem4f.mak + @$(RM) $@.dep + $(RM) $@ + @$(MSG) clem4f $< ... + $(ti.targets.arm.elf.M4F.rootDir)/bin/armcl -c "--code_state=16 --float_support=FPv4SPD16 -me -qq -pdsw225 -ms --fp_mode=strict --endian=little -mv7M4 --abi=eabi --float_support=fpv4spd16 -eo.oem4f -ea.sem4f -Dxdc_cfg__xheader__='"xconfig_Embedded/package/cfg/Embedded_pem4f.h"' -Dxdc_target_name__=M4F -Dxdc_target_types__=ti/targets/arm/elf/std.h -Dxdc_bld__profile_release -Dxdc_bld__vers_1_0_16_9_4 -O2 $(XDCINCS) -I$(ti.targets.arm.elf.M4F.rootDir)/include/rts -I$(ti.targets.arm.elf.M4F.rootDir)/include -fs=./package/cfg -fr=./package/cfg -fc $< + $(MKDEP) -a $@.dep -p package/cfg -s oem4f $< -C "--code_state=16 --float_support=FPv4SPD16 -me -qq -pdsw225 -ms --fp_mode=strict --endian=little -mv7M4 --abi=eabi --float_support=fpv4spd16 -eo.oem4f -ea.sem4f -Dxdc_cfg__xheader__='"xconfig_Embedded/package/cfg/Embedded_pem4f.h"' -Dxdc_target_name__=M4F -Dxdc_target_types__=ti/targets/arm/elf/std.h -Dxdc_bld__profile_release -Dxdc_bld__vers_1_0_16_9_4 -O2 $(XDCINCS) -I$(ti.targets.arm.elf.M4F.rootDir)/include/rts -I$(ti.targets.arm.elf.M4F.rootDir)/include -fs=./package/cfg -fr=./package/cfg + -@$(FIXDEP) $@.dep $@.dep + +package/cfg/Embedded_pem4f.oem4f: export C_DIR= +package/cfg/Embedded_pem4f.oem4f: PATH:=$(ti.targets.arm.elf.M4F.rootDir)/bin/;$(PATH) +package/cfg/Embedded_pem4f.oem4f: Path:=$(ti.targets.arm.elf.M4F.rootDir)/bin/;$(PATH) + +package/cfg/Embedded_pem4f.sem4f: | .interfaces +package/cfg/Embedded_pem4f.sem4f: package/cfg/Embedded_pem4f.c package/cfg/Embedded_pem4f.mak + @$(RM) $@.dep + $(RM) $@ + @$(MSG) clem4f -n $< ... + $(ti.targets.arm.elf.M4F.rootDir)/bin/armcl -c -n -s --symdebug:none "--code_state=16 --float_support=FPv4SPD16 -me -qq -pdsw225 --endian=little -mv7M4 --abi=eabi --float_support=fpv4spd16 -eo.oem4f -ea.sem4f -Dxdc_cfg__xheader__='"xconfig_Embedded/package/cfg/Embedded_pem4f.h"' -Dxdc_target_name__=M4F -Dxdc_target_types__=ti/targets/arm/elf/std.h -Dxdc_bld__profile_release -Dxdc_bld__vers_1_0_16_9_4 -O2 $(XDCINCS) -I$(ti.targets.arm.elf.M4F.rootDir)/include/rts -I$(ti.targets.arm.elf.M4F.rootDir)/include -fs=./package/cfg -fr=./package/cfg -fc $< + $(MKDEP) -a $@.dep -p package/cfg -s oem4f $< -C -n -s --symdebug:none "--code_state=16 --float_support=FPv4SPD16 -me -qq -pdsw225 --endian=little -mv7M4 --abi=eabi --float_support=fpv4spd16 -eo.oem4f -ea.sem4f -Dxdc_cfg__xheader__='"xconfig_Embedded/package/cfg/Embedded_pem4f.h"' -Dxdc_target_name__=M4F -Dxdc_target_types__=ti/targets/arm/elf/std.h -Dxdc_bld__profile_release -Dxdc_bld__vers_1_0_16_9_4 -O2 $(XDCINCS) -I$(ti.targets.arm.elf.M4F.rootDir)/include/rts -I$(ti.targets.arm.elf.M4F.rootDir)/include -fs=./package/cfg -fr=./package/cfg + -@$(FIXDEP) $@.dep $@.dep + +package/cfg/Embedded_pem4f.sem4f: export C_DIR= +package/cfg/Embedded_pem4f.sem4f: PATH:=$(ti.targets.arm.elf.M4F.rootDir)/bin/;$(PATH) +package/cfg/Embedded_pem4f.sem4f: Path:=$(ti.targets.arm.elf.M4F.rootDir)/bin/;$(PATH) + +clean,em4f :: + -$(RM) package/cfg/Embedded_pem4f.oem4f + -$(RM) package/cfg/Embedded_pem4f.sem4f + +Embedded.pem4f: package/cfg/Embedded_pem4f.oem4f package/cfg/Embedded_pem4f.mak + +clean:: + -$(RM) package/cfg/Embedded_pem4f.mak diff --git a/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/package.bld.xml b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/package.bld.xml new file mode 100644 index 000000000..b80ad50de --- /dev/null +++ b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/package.bld.xml @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/package.defs.h b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/package.defs.h new file mode 100644 index 000000000..0a0250f07 --- /dev/null +++ b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/package.defs.h @@ -0,0 +1,13 @@ +/* + * Do not modify this file; it is automatically + * generated and any modifications will be overwritten. + * + * @(#) xdc-B06 + */ + +#ifndef xconfig_Embedded__ +#define xconfig_Embedded__ + + + +#endif /* xconfig_Embedded__ */ diff --git a/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/package.xdc.dep b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/package.xdc.dep new file mode 100644 index 000000000..f3d85fb1c --- /dev/null +++ b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/package.xdc.dep @@ -0,0 +1,53 @@ +clean:: + $(RM) package/xconfig_Embedded.sch + $(RM) package/.vers_g180 + $(RM) package/.vers_r170 + $(RM) package/.vers_b160 + $(RM) package/.xdc-B06 + $(RM) package/xconfig_Embedded.java + $(RM) package/xconfig_Embedded.class + $(RM) package/package_xconfig_Embedded.c + $(RM) package/package.defs.h + $(RM) package/xconfig_Embedded.ccs + +.interfaces: package/xconfig_Embedded.sch package/.vers_g180 package/.vers_r170 package/.vers_b160 package/.xdc-B06 package/xconfig_Embedded.java package/package_xconfig_Embedded.c package/package.defs.h package/xconfig_Embedded.ccs +package/package.xdc.inc: package/.vers_g180 +package/.vers_g180: +package/package.xdc.inc: package/.vers_r170 +package/.vers_r170: +package/package.xdc.inc: package/.vers_b160 +package/.vers_b160: + +.interfaces: + +# schema include file dependencies +package.xs: +package/package.xdc.inc: package.xs + +# schema update dependencies +package/package.xdc.inc: xdc/IPackage.xdc +xdc/IPackage.xdc: +vpath xdc/IPackage.xdc $(XPKGVPATH) + +ifneq (clean,$(MAKECMDGOALS)) +C:/TI/xdctools_3_32_00_06_core/packages/xdc/shelf/java/antlr.jar: +package/package.xdc.inc: C:/TI/xdctools_3_32_00_06_core/packages/xdc/shelf/java/antlr.jar +C:/TI/xdctools_3_32_00_06_core/packages/xdc/services/intern/gen/java/package.jar: +package/package.xdc.inc: C:/TI/xdctools_3_32_00_06_core/packages/xdc/services/intern/gen/java/package.jar +C:/TI/xdctools_3_32_00_06_core/packages/xdc/services/intern/cmd/java/package.jar: +package/package.xdc.inc: C:/TI/xdctools_3_32_00_06_core/packages/xdc/services/intern/cmd/java/package.jar +C:/TI/xdctools_3_32_00_06_core/packages/xdc/shelf/java/js.jar: +package/package.xdc.inc: C:/TI/xdctools_3_32_00_06_core/packages/xdc/shelf/java/js.jar +C:/TI/xdctools_3_32_00_06_core/packages/xdc/shelf/java/tar.jar: +package/package.xdc.inc: C:/TI/xdctools_3_32_00_06_core/packages/xdc/shelf/java/tar.jar +C:/TI/xdctools_3_32_00_06_core/packages/xdc/services/global/java/package.jar: +package/package.xdc.inc: C:/TI/xdctools_3_32_00_06_core/packages/xdc/services/global/java/package.jar +C:/TI/xdctools_3_32_00_06_core/packages/xdc/services/spec/java/package.jar: +package/package.xdc.inc: C:/TI/xdctools_3_32_00_06_core/packages/xdc/services/spec/java/package.jar +C:/TI/xdctools_3_32_00_06_core/packages/xdc/shelf/java/ecj.jar: +package/package.xdc.inc: C:/TI/xdctools_3_32_00_06_core/packages/xdc/shelf/java/ecj.jar +C:/TI/xdctools_3_32_00_06_core/packages/xdc/services/intern/xsr/java/package.jar: +package/package.xdc.inc: C:/TI/xdctools_3_32_00_06_core/packages/xdc/services/intern/xsr/java/package.jar +endif +# goals for files generated during schema generation but unspecified by schema's pattern rule + diff --git a/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/package.xdc.inc b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/package.xdc.inc new file mode 100644 index 000000000..e002a7470 --- /dev/null +++ b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/package.xdc.inc @@ -0,0 +1,12 @@ +package.xdc +package.xs +package/xconfig_Embedded.sch +package/.vers_g180 +package/.vers_r170 +package/.vers_b160 +package/.xdc-B06 +package/xconfig_Embedded.java +package/xconfig_Embedded.class +package/package_xconfig_Embedded.c +package/package.defs.h +package/xconfig_Embedded.ccs diff --git a/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/package_xconfig_Embedded.c b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/package_xconfig_Embedded.c new file mode 100644 index 000000000..e62997303 --- /dev/null +++ b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/package_xconfig_Embedded.c @@ -0,0 +1,21 @@ +/* + * Do not modify this file; it is automatically + * generated and any modifications will be overwritten. + * + * @(#) xdc-B06 + */ + +#include + +__FAR__ char xconfig_Embedded__dummy__; + +#define __xdc_PKGVERS null +#define __xdc_PKGNAME xconfig_Embedded +#define __xdc_PKGPREFIX xconfig_Embedded_ + +#ifdef __xdc_bld_pkg_c__ +#define __stringify(a) #a +#define __local_include(a) __stringify(a) +#include __local_include(__xdc_bld_pkg_c__) +#endif + diff --git a/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/rel/xconfig_Embedded.xdc.inc b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/rel/xconfig_Embedded.xdc.inc new file mode 100644 index 000000000..0f839efb2 --- /dev/null +++ b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/rel/xconfig_Embedded.xdc.inc @@ -0,0 +1,3 @@ +package/package.bld.xml +package/build.cfg +package/package.xdc.inc diff --git a/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/rel/xconfig_Embedded.xdc.ninc b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/rel/xconfig_Embedded.xdc.ninc new file mode 100644 index 000000000..e69de29bb diff --git a/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/xconfig_Embedded.ccs b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/xconfig_Embedded.ccs new file mode 100644 index 000000000..8eec3a496 Binary files /dev/null and b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/xconfig_Embedded.ccs differ diff --git a/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/xconfig_Embedded.class b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/xconfig_Embedded.class new file mode 100644 index 000000000..eb25f2af0 Binary files /dev/null and b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/xconfig_Embedded.class differ diff --git a/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/xconfig_Embedded.java b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/xconfig_Embedded.java new file mode 100644 index 000000000..7699c0f1b --- /dev/null +++ b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/xconfig_Embedded.java @@ -0,0 +1,143 @@ +/* + * Do not modify this file; it is automatically + * generated and any modifications will be overwritten. + * + * @(#) xdc-B06 + */ +import java.util.*; +import org.mozilla.javascript.*; +import xdc.services.intern.xsr.*; +import xdc.services.spec.Session; + +public class xconfig_Embedded +{ + static final String VERS = "@(#) xdc-B06\n"; + + static final Proto.Elm $$T_Bool = Proto.Elm.newBool(); + static final Proto.Elm $$T_Num = Proto.Elm.newNum(); + static final Proto.Elm $$T_Str = Proto.Elm.newStr(); + static final Proto.Elm $$T_Obj = Proto.Elm.newObj(); + + static final Proto.Fxn $$T_Met = new Proto.Fxn(null, null, 0, -1, false); + static final Proto.Map $$T_Map = new Proto.Map($$T_Obj); + static final Proto.Arr $$T_Vec = new Proto.Arr($$T_Obj); + + static final XScriptO $$DEFAULT = Value.DEFAULT; + static final Object $$UNDEF = Undefined.instance; + + static final Proto.Obj $$Package = (Proto.Obj)Global.get("$$Package"); + static final Proto.Obj $$Module = (Proto.Obj)Global.get("$$Module"); + static final Proto.Obj $$Instance = (Proto.Obj)Global.get("$$Instance"); + static final Proto.Obj $$Params = (Proto.Obj)Global.get("$$Params"); + + static final Object $$objFldGet = Global.get("$$objFldGet"); + static final Object $$objFldSet = Global.get("$$objFldSet"); + static final Object $$proxyGet = Global.get("$$proxyGet"); + static final Object $$proxySet = Global.get("$$proxySet"); + static final Object $$delegGet = Global.get("$$delegGet"); + static final Object $$delegSet = Global.get("$$delegSet"); + + Scriptable xdcO; + Session ses; + Value.Obj om; + + boolean isROV; + boolean isCFG; + + Proto.Obj pkgP; + Value.Obj pkgV; + + ArrayList imports = new ArrayList(); + ArrayList loggables = new ArrayList(); + ArrayList mcfgs = new ArrayList(); + ArrayList icfgs = new ArrayList(); + ArrayList inherits = new ArrayList(); + ArrayList proxies = new ArrayList(); + ArrayList sizes = new ArrayList(); + ArrayList tdefs = new ArrayList(); + + void $$IMPORTS() + { + Global.callFxn("loadPackage", xdcO, "xdc"); + Global.callFxn("loadPackage", xdcO, "xdc.corevers"); + } + + void $$OBJECTS() + { + pkgP = (Proto.Obj)om.bind("xconfig_Embedded.Package", new Proto.Obj()); + pkgV = (Value.Obj)om.bind("xconfig_Embedded", new Value.Obj("xconfig_Embedded", pkgP)); + } + + void $$SINGLETONS() + { + pkgP.init("xconfig_Embedded.Package", (Proto.Obj)om.findStrict("xdc.IPackage.Module", "xconfig_Embedded")); + Scriptable cap = (Scriptable)Global.callFxn("loadCapsule", xdcO, "xconfig_Embedded/package.xs"); + om.bind("xdc.IPackage$$capsule", cap); + Object fxn; + fxn = Global.get(cap, "init"); + if (fxn != null) pkgP.addFxn("init", (Proto.Fxn)om.findStrict("xdc.IPackage$$init", "xconfig_Embedded"), fxn); + fxn = Global.get(cap, "close"); + if (fxn != null) pkgP.addFxn("close", (Proto.Fxn)om.findStrict("xdc.IPackage$$close", "xconfig_Embedded"), fxn); + fxn = Global.get(cap, "validate"); + if (fxn != null) pkgP.addFxn("validate", (Proto.Fxn)om.findStrict("xdc.IPackage$$validate", "xconfig_Embedded"), fxn); + fxn = Global.get(cap, "exit"); + if (fxn != null) pkgP.addFxn("exit", (Proto.Fxn)om.findStrict("xdc.IPackage$$exit", "xconfig_Embedded"), fxn); + fxn = Global.get(cap, "getLibs"); + if (fxn != null) pkgP.addFxn("getLibs", (Proto.Fxn)om.findStrict("xdc.IPackage$$getLibs", "xconfig_Embedded"), fxn); + fxn = Global.get(cap, "getSects"); + if (fxn != null) pkgP.addFxn("getSects", (Proto.Fxn)om.findStrict("xdc.IPackage$$getSects", "xconfig_Embedded"), fxn); + pkgP.bind("$capsule", cap); + pkgV.init2(pkgP, "xconfig_Embedded", Value.DEFAULT, false); + pkgV.bind("$name", "xconfig_Embedded"); + pkgV.bind("$category", "Package"); + pkgV.bind("$$qn", "xconfig_Embedded."); + pkgV.bind("$vers", Global.newArray()); + Value.Map atmap = (Value.Map)pkgV.getv("$attr"); + atmap.seal("length"); + imports.clear(); + pkgV.bind("$imports", imports); + StringBuilder sb = new StringBuilder(); + sb.append("var pkg = xdc.om['xconfig_Embedded'];\n"); + sb.append("if (pkg.$vers.length >= 3) {\n"); + sb.append("pkg.$vers.push(Packages.xdc.services.global.Vers.getDate(xdc.csd() + '/..'));\n"); + sb.append("}\n"); + sb.append("if ('xconfig_Embedded$$stat$base' in xdc.om) {\n"); + sb.append("pkg.packageBase = xdc.om['xconfig_Embedded$$stat$base'];\n"); + sb.append("pkg.packageRepository = xdc.om['xconfig_Embedded$$stat$root'];\n"); + sb.append("}\n"); + sb.append("pkg.build.libraries = [\n"); + sb.append("];\n"); + sb.append("pkg.build.libDesc = [\n"); + sb.append("];\n"); + Global.eval(sb.toString()); + } + + void $$INITIALIZATION() + { + Value.Obj vo; + + if (isCFG) { + }//isCFG + Global.callFxn("init", pkgV); + ((Value.Arr)om.findStrict("$packages", "xconfig_Embedded")).add(pkgV); + } + + public void exec( Scriptable xdcO, Session ses ) + { + this.xdcO = xdcO; + this.ses = ses; + om = (Value.Obj)xdcO.get("om", null); + + Object o = om.geto("$name"); + String s = o instanceof String ? (String)o : null; + isCFG = s != null && s.equals("cfg"); + isROV = s != null && s.equals("rov"); + + $$IMPORTS(); + $$OBJECTS(); + if (isROV) { + }//isROV + $$SINGLETONS(); + $$INITIALIZATION(); + } +} diff --git a/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/xconfig_Embedded.sch b/Software/Embedded_SW/Embedded/.config/xconfig_Embedded/package/xconfig_Embedded.sch new file mode 100644 index 000000000..e69de29bb diff --git a/Software/Embedded_SW/Embedded/DataDef.h b/Software/Embedded_SW/Embedded/DataDef.h index 0cf75637c..bbc2d3c24 100644 --- a/Software/Embedded_SW/Embedded/DataDef.h +++ b/Software/Embedded_SW/Embedded/DataDef.h @@ -130,12 +130,29 @@ enum #define DOUBLE_BUFFER 2 - +/* #define CurrentMotDriver 0x08 #define VoltageMotDriver 0x00 #define CurrentCombinedMotDriver 0x0108 // 01 Combined Driver, 08 Current #define VoltageCombinedMotDriver 0x0100 // 01 Combined Driver, 00 Voltage #define CombinrdMotDriver 0x0300 // 03 Combined Driver + Combined Modes , 00 Voltage mode enabled +*/ + +typedef enum +{ + //Don't change the value! + Current = 0x08, + Voltage = 0x00, +}MOTDRIVER_MODE; + + +typedef enum +{ + CurrentMotDriver, + VoltageMotDriver, + CombinrdMotDriver, +}MOTDRIVER_TYPE; + //#define MagneticLImitSwitch 0x01 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 26f6d5c56..cfe466d01 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c @@ -136,24 +136,61 @@ uint8_t FPGA_SPI_Receive(TimerMotors_t _motorId) //---------------- GET ------------------------------ -uint32_t Read_Motors_Driver_Type(TimerMotors_t i) +void Read_Motors_Driver_ADC(TimerMotors_t i) { - uint32_t status = OK; - SysCtlDelay(12000); Fpga_Spi[i].TX_MOSI = (x_GET_PARAM | x_ADC_OUT)<<8; FPGA_SPI_Transnit(i); SysCtlDelay(12000); FPGA_Get_Res(i); MotorDriverResponse[i].ADC = Fpga_Spi[i].RX_MISO; +} + +uint32_t Read_Motors_Driver_Type(TimerMotors_t i) +{ + uint32_t status = OK; + + Read_Motors_Driver_ADC(i); + +/* int nop = 0; + + if((i == 7) || (i==9)) + { + nop ++; + } + +*/ if(MotorDriverResponse[i].ADC < 14) { MotorDriverResponse[i].DriverType = CurrentMotDriver; //(L6472, ADC = 11) + MotorDriverResponse[i].DriverMode = Current; } else + if((MotorDriverResponse[i].ADC >= 14) && (MotorDriverResponse[i].ADC < 20)) { MotorDriverResponse[i].DriverType = VoltageMotDriver; //(L6470, ADC = 17) + MotorDriverResponse[i].DriverMode = Voltage; + } + else + { + //TODO cross between MISO and MOSI in the SPI communication + Read_Motors_Driver_ADC(i); + + if(MotorDriverResponse[i].ADC >= 20) // //(powerSTEP01, ADC = 24) + { + MotorDriverResponse[i].DriverType = CombinrdMotDriver; + + //default for dispensers- Voltage mode, for other motors Current mode + if((i >= HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1) && (i <= HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_8)) + MotorDriverResponse[i].DriverMode = Voltage; + else + MotorDriverResponse[i].DriverMode = Current; + } + else + { + status = ERROR; + } } /* if(MotorsCfg[_motorId].microstep == 0)//voltage mode @@ -542,8 +579,17 @@ uint32_t FPGA_MotorConfig_callback(TimerMotors_t _motorId, uint32_t ReadValue) // CM_VM = VoltageMotDriver; // } // }*/ - CM_VM = MotorDriverResponse[_motorId].DriverType & 0xFF; +/* + if(MotorDriverResponse[_motorId].DriverType == CombinrdMotDriver) + { + CM_VM = CurrentMotDriver; + } + else + CM_VM = MotorDriverResponse[_motorId].DriverType & 0xFF; + +*/ + CM_VM = MotorDriverResponse[_motorId].DriverMode; temp |= (!x_SYNC_EN | CM_VM | good | x_SYNC_SEL_1)<<16; MillisecWriteToMotor(_motorId, temp, 4, FPGA_MotorConfig_callback); break; @@ -554,7 +600,7 @@ uint32_t FPGA_MotorConfig_callback(TimerMotors_t _motorId, uint32_t ReadValue) if(MotorsCfg[_motorId].configword!=0) { //temp = x_SET_PARAM | x_CONFIG; - if(MotorDriverResponse[_motorId].DriverType == VoltageCombinedMotDriver) + if(MotorDriverResponse[_motorId].DriverType == CombinrdMotDriver) { temp = x_SET_PARAM | x_POWERSTEP01_CONFIG; } @@ -690,18 +736,19 @@ uint32_t FPGA_MotorConfig_callback(TimerMotors_t _motorId, uint32_t ReadValue) } case MOTOR_CONFIG_GATECFG1: ConfigStages[_motorId]++; - if(MotorDriverResponse[_motorId].DriverType == VoltageCombinedMotDriver) + if(MotorDriverResponse[_motorId].DriverType == CombinrdMotDriver) { temp = x_SET_PARAM | x_POWERSTEP01_GATECFG1; temp = temp << 24; //Gate Current of 8mA for 2000 ns (boost: 125 ns) Clock watchdog disabled - temp |= (POWERSTEP01_TCC_2000ns | POWERSTEP01_IGATE_16mA | POWERSTEP01_TBOOST_125ns | POWERSTEP01_WD_EN_DISABLE)<<8; + //temp |= (POWERSTEP01_TCC_2000ns | POWERSTEP01_IGATE_16mA | POWERSTEP01_TBOOST_125ns | POWERSTEP01_WD_EN_DISABLE)<<8; + temp |= (POWERSTEP01_TCC_2000ns | POWERSTEP01_IGATE_8mA | POWERSTEP01_TBOOST_125ns | POWERSTEP01_WD_EN_DISABLE)<<8; if( MillisecWriteToMotor(_motorId, temp, 4, FPGA_MotorConfig_callback) < 0 ) return ERROR; break; } case MOTOR_CONFIG_GATECFG2: ConfigStages[_motorId]++; - if(MotorDriverResponse[_motorId].DriverType == VoltageCombinedMotDriver) + if(MotorDriverResponse[_motorId].DriverType == CombinrdMotDriver) { temp = x_SET_PARAM | x_POWERSTEP01_GATECFG2; temp = temp << 24; @@ -831,7 +878,10 @@ void FPGA_SetMotMicroStep(TimerMotors_t _motorId)// // } // }*/ - CM_VM = MotorDriverResponse[_motorId].DriverType & 0xFF; + //CM_VM = MotorDriverResponse[_motorId].DriverType & 0xFF; + + //The CM_VM bit sets the current control method between voltage and current mode: + CM_VM = MotorDriverResponse[_motorId].DriverMode; temp |= (!x_SYNC_EN | CM_VM | good | x_SYNC_SEL_1)<<16; @@ -938,7 +988,7 @@ void FPGA_SetMotKvalHold(TimerMotors_t _motorId) temp = x_SET_PARAM | x_KVAL_HOLD; temp = temp << 24; - if((MotorDriverResponse[_motorId].DriverType == CurrentMotDriver) && (MotorDriverRequest[_motorId].KvalHold > 0x7F)) + if((MotorDriverResponse[_motorId].DriverMode == Current) && (MotorDriverRequest[_motorId].KvalHold > 0x7F)) MotorDriverRequest[_motorId].KvalHold = 0x7F; temp |= MotorDriverRequest[_motorId].KvalHold<<16; @@ -955,7 +1005,7 @@ void FPGA_SetMotKvalRun(TimerMotors_t _motorId) temp = x_SET_PARAM | x_KVAL_RUN; temp = temp << 24; - if((MotorDriverResponse[_motorId].DriverType == CurrentMotDriver) && (MotorDriverRequest[_motorId].KvalRun > 0x7F)) + if((MotorDriverResponse[_motorId].DriverMode == Current) && (MotorDriverRequest[_motorId].KvalRun > 0x7F)) MotorDriverRequest[_motorId].KvalRun = 0x7F; temp |= MotorDriverRequest[_motorId].KvalRun<<16; @@ -972,7 +1022,7 @@ void FPGA_SetMotKvalAcc(TimerMotors_t _motorId) temp = x_SET_PARAM | x_KVAL_ACC; temp = temp << 24; - if((MotorDriverResponse[_motorId].DriverType == CurrentMotDriver) && (MotorDriverRequest[_motorId].KvalAcc > 0x7F)) + if((MotorDriverResponse[_motorId].DriverMode == Current) && (MotorDriverRequest[_motorId].KvalAcc > 0x7F)) MotorDriverRequest[_motorId].KvalAcc = 0x7F; temp |= MotorDriverRequest[_motorId].KvalAcc<<16; @@ -989,7 +1039,7 @@ void FPGA_SetMotKvalDec(TimerMotors_t _motorId) temp = x_SET_PARAM | x_KVAL_DEC; temp = temp << 24; - if((MotorDriverResponse[_motorId].DriverType == CurrentMotDriver) && (MotorDriverRequest[_motorId].KvalDec > 0x7F)) + if((MotorDriverResponse[_motorId].DriverMode == Current) && (MotorDriverRequest[_motorId].KvalDec > 0x7F)) MotorDriverRequest[_motorId].KvalDec = 0x7F; temp |= MotorDriverRequest[_motorId].KvalDec<<16; diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.c index 5534a710c..6ee02783d 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.c @@ -54,6 +54,22 @@ uint32_t Write_DAC_and_Input_Register(uint32_t Bits) return status; } +uint32_t Write_DAC_and_Input_Register_temp(uint32_t Bits)//to test enc +{ + uint32_t status = OK; + + DAC.Bytes.Command = AD5691R_CMD_WRITE_INPUT_N_UPDATE_REG; + + + DAC.Bytes.Data_High = (Bits >> 4); + + DAC.Bytes.Data_Low = ((Bits & 0xf)<<4); + + status = I2C_Write(DAC_I2C_BASE, I2C_DAC_ADDRESS, DAC.Write_DAC_I2C_Buf, 3); + + return status; +} + uint32_t Write_Input_Register() { uint32_t status = OK; @@ -219,6 +235,66 @@ uint32_t Cancel_Gradual_Increase_Blower(uint32_t Initial_mV) */ +////////////////////////////////////////////////////////////////////////////////////////// + +#include "drivers/FPGA/FPGA.h"; + +extern SCREW_ENC Screw_RotEnc; + +extern uint32_t Read_Screw_Encoder(); + +void Screw_ENC_Velocity_to_DAC()//every 1mSec +{ + static uint32_t Last_position = 0; + uint32_t Current_Position = 0; + uint32_t Screw_Velocity = 0; + uint32_t Value_to_ADC = 0; + static bool first_time = true; + + int8_t Sign = 1; + + if(first_time) + { + Reset_Screw_Encoder(); + first_time = false; + + } + else + { + Read_Screw_Encoder(); + Current_Position = (uint32_t)Screw_RotEnc.Position; + + if(Current_Position > Last_position ) + { + Screw_Velocity = Current_Position - Last_position; + Sign = 1; + } + else + { + Screw_Velocity = Last_position - Current_Position; + Sign = -1; + } + + + uint32_t temp = (Screw_Velocity << 2 ); + + if(temp > 2047) + temp = 2047; + /*else + if(temp < -2047) + temp = -2047;*/ + + Value_to_ADC = 2048 + (Sign * temp); + + //Send to ADC; + //Write_DAC_and_Input_Register(Value_to_ADC<<4); + Write_DAC_and_Input_Register_temp(Value_to_ADC); + + Last_position = Current_Position; + } +} + + diff --git a/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.c b/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.c index 106e60316..4488cfd4f 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.c +++ b/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.c @@ -27,6 +27,7 @@ #include "drivers/FPGA/FPGA_Comm.h" #include "drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h" #include "driverlib/ssi.h" +#include "StateMachines/Printing/PrintingSTM.h" extern unsigned long Run_Value ; extern unsigned long Pos_Value ; @@ -475,3 +476,23 @@ void loop_Run_Read_Speed()//every miliSec } */ + + +void Combined_Motor_Driver_Mode(TimerMotors_t _motorId, MOTDRIVER_MODE New_Mode)// New_mode: Current or Voltage +{ + if(MotorDriverResponse[_motorId].DriverType == CombinrdMotDriver) + { + MotorDriverResponse[_motorId].DriverMode = New_Mode; + //need to do all the configuration acording to the new mode + //The STEP_MODE register includes the CM_VM bit (sets the method between voltage and current mode) + FPGA_SetMotMicroStep(_motorId); + } +} +void Combined_dispenser_Driver_Mode(uint8_t Dispenser_ID, MOTDRIVER_MODE New_Mode)// New_mode: Current or Voltage +{ + assert(Dispenser_ID < MAX_DISPENSER_NUM); + + Combined_Motor_Driver_Mode(Dispenser_ID + 5, New_Mode);//dispenser ID -> motor id +} + + diff --git a/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.h b/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.h index 894f60c09..c2c124da5 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.h +++ b/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.h @@ -101,7 +101,8 @@ typedef struct uint32_t Status; uint8_t MicroSteps; uint32_t ADC; //read the Adc in order to know the motor driver type L6470/ L6472 / powerSTEP01 - uint32_t DriverType; //current or voltage mode + MOTDRIVER_TYPE DriverType; //current or voltage mode + MOTDRIVER_MODE DriverMode; //current or voltage mode in powerSTEP01 bool Busy; }MotorDriverResponseStruct; @@ -214,4 +215,7 @@ uint32_t MotorMoveToStopper (TimerMotors_t _motorId,bool direction, uint32_t Spe uint32_t MotorMovetoEncoderPosition (TimerMotors_t MotorId, callback_fptr callback,uint32_t timeout); uint32_t MotorGoTo(TimerMotors_t _motorIdn, uint32_t Steps); + +void Combined_Motor_Driver_Mode(TimerMotors_t _motorId, MOTDRIVER_MODE New_Mode);// New_mode: Current or Voltage +void Combined_dispenser_Driver_Mode(uint8_t Dispenser_ID, MOTDRIVER_MODE New_Mode);// New_mode: Current or Voltage #endif /* DRIVERS_MOTOR_H_ */ diff --git a/Software/Embedded_SW/Embedded/Drivers/SPI/SPI_Comm.c b/Software/Embedded_SW/Embedded/Drivers/SPI/SPI_Comm.c index 4cfb0704b..2fd26552b 100644 --- a/Software/Embedded_SW/Embedded/Drivers/SPI/SPI_Comm.c +++ b/Software/Embedded_SW/Embedded/Drivers/SPI/SPI_Comm.c @@ -1251,7 +1251,14 @@ uint32_t Get_Param(byte param)//OK //while(SSIBusy(SSI2_BASE)){}; // while(Check_SPI_Busy() == BUSY){}; /* Send GetParam operation code to dSPIN */ + + /*if((param == x_CONFIG) && (MotorDriverResponse[_motorId].DriverType == CombinrdMotDriver)) + { + temp = Write_Byte((uint8_t)x_POWERSTEP01_CONFIG | (uint8_t)param); + } + else*/ temp = Write_Byte((uint8_t)x_GET_PARAM | (uint8_t)param); + /* MSB which should be 0 */ rx |= (temp & 0xFF) << 24; switch (param) diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c index cb1be7fa5..eefac2854 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c @@ -349,6 +349,9 @@ uint32_t MillisecLoop(uint32_t tick) //gather Motor data from FPGA //ROM_IntMasterDisable(); */ + + + #ifndef EVALUATION_BOARD FPGA_GetBusy(); //load the busy motor information to all motors FPGA_Read_LS_Safty_Ind_Reg(); @@ -501,6 +504,8 @@ uint32_t MillisecLowLoop(uint32_t tick) //gather Motor data from FPGA //ROM_IntMasterDisable(); + //Screw_ENC_Velocity_to_DAC(); - for testing the screw enc + if (Ten_msTick) { //Speed_Data = Calculate_Speed_Sensor_Velocity(); diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c index 265c751c6..3fb6f3af2 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c @@ -56,7 +56,7 @@ uint32_t MotorsConfigMessage(HardwareMotor * request) MotorsCfg[Motor_i].pulseperround = request->pulseperround; MotorsCfg[Motor_i].pulleyradius = request->pulleyradius; MotorsCfg[Motor_i].configword = request->configword; - if(MotorDriverResponse[Motor_i].DriverType == VoltageCombinedMotDriver) + if(MotorDriverResponse[Motor_i].DriverType == CombinrdMotDriver) { MotorsCfg[Motor_i].directionthreadwize = !(request->directionthreadwize);//PowerSTEP01 } -- cgit v1.3.1 From b525fbcad1ac8c7126caa82ec8458ffbb6284384 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Thu, 30 May 2019 17:33:20 +0300 Subject: Version 1.4.0.4: Improved memory handling, handles SW crash after a job failure --- .../Embedded/Common/SWUpdate/FileSystem.c | 14 +++--- .../Embedded/Common/SWUpdate/FirmwareUpgrade.c | 3 +- .../Embedded_SW/Embedded/Common/SW_Info/SW_Info.c | 2 +- .../Embedded_SW/Embedded/Common/Utilities/Utils.c | 14 +++--- .../Embedded/Common/report/distributor.c | 3 +- .../Embedded/Common/report/reportInit.c | 6 +-- .../Embedded/Communication/CommunicationTask.c | 11 +++++ .../Embedded_SW/Embedded/Communication/Container.c | 42 ++++++++++------- Software/Embedded_SW/Embedded/Embedded.cfg | 52 +++++----------------- Software/Embedded_SW/Embedded/Main.c | 4 +- .../Embedded/Modules/AlarmHandling/AlarmHandling.c | 12 ++++- .../Embedded/Modules/Diagnostics/Diagnostics.c | 2 +- .../Embedded_SW/Embedded/Modules/General/process.c | 50 ++++++++++++--------- .../Embedded_SW/Embedded/Modules/IDS/IDS_maint.c | 2 +- .../Embedded_SW/Embedded/Modules/IDS/IDS_print.c | 4 ++ .../Embedded/Modules/Thread/Thread_print.c | 5 ++- .../Embedded/StateMachines/Printing/JobSTM.c | 3 +- .../Embedded/StateMachines/Printing/PrintingSTM.c | 18 +++++++- 18 files changed, 140 insertions(+), 107 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules/Thread') diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c index 6c0262f66..c424320ff 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c @@ -109,7 +109,7 @@ uint32_t FileUploadRequestFunc(MessageContainer* requestContainer) } else { - free (UploadFileHandle); + my_free (UploadFileHandle); UploadFileHandle = 0; } @@ -172,7 +172,8 @@ uint32_t FileChunkUploadRequestFunc(MessageContainer* requestContainer) { REPORT_MSG (FileReceivedLength,"file upload ended successfully"); f_close(ReceivedFileHandle); - free (UploadFileHandle); + my_free (UploadFileHandle); + UploadFileHandle = 0; FileReceivedLength = 0; FileDone = true; } @@ -182,7 +183,8 @@ uint32_t FileChunkUploadRequestFunc(MessageContainer* requestContainer) { REPORT_MSG (FileReceivedLength,"file upload too much data!"); f_close(ReceivedFileHandle); - free (UploadFileHandle); + my_free (UploadFileHandle); + UploadFileHandle = 0; FileReceivedLength = 0; FileDone = true; } @@ -206,7 +208,7 @@ uint32_t FileChunkUploadRequestFunc(MessageContainer* requestContainer) responseContainer.continuous = false; uint8_t* container_buffer = my_malloc(message_container__get_packed_size(&responseContainer)); size_t container_size = message_container__pack(&responseContainer, container_buffer); - my_free(request->buffer.data); + //my_free(request->buffer.data); file_chunk_upload_request__free_unpacked(request,NULL); my_free(responseContainer.data.data); SendCharsWithType(container_buffer, container_size,MESSAGE_TYPE__FileChunkUploadResponse); @@ -301,7 +303,7 @@ uint32_t FileChunkDownloadRequestFunc(MessageContainer* requestContainer) { REPORT_MSG (FileSentLength,"file download ended successfully"); f_close(SentFileHandle); - free (DownloadFileHandle); + my_free (DownloadFileHandle); FileSentLength = 0; } else @@ -310,7 +312,7 @@ uint32_t FileChunkDownloadRequestFunc(MessageContainer* requestContainer) { REPORT_MSG (FileSentLength,"file download too much data!"); f_close(SentFileHandle); - free (DownloadFileHandle); + my_free (DownloadFileHandle); FileSentLength = 0; } } diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c index 01a30c21a..3bae023db 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c @@ -102,7 +102,8 @@ uint32_t ActivateVersionRequestFunc(MessageContainer* requestContainer) ustrncpy (ActivateToken, requestContainer->token,36); - strcpy (SWUpgradePath,request->path); + strncpy (SWUpgradePath,request->path,99); + SWUpgradePath[99] = NULL; strcat(SWUpgradePath,"/package.cfg"); Fresult = FileRead(SWUpgradePath, &Bytes, &buffer); diff --git a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c index bee894585..05864303f 100644 --- a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c +++ b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c @@ -20,7 +20,7 @@ typedef struct } TangoVersion_t; -TangoVersion_t _gTangoVersion = {1,4,0,3}; +TangoVersion_t _gTangoVersion = {1,4,0,4}; #define BUILD_DATE __DATE__ char Dat[50] = BUILD_DATE; char _gTangoName [MAX_STRING_LEN] = "Tango01 ";//d diff --git a/Software/Embedded_SW/Embedded/Common/Utilities/Utils.c b/Software/Embedded_SW/Embedded/Common/Utilities/Utils.c index 341a43704..3871acb94 100644 --- a/Software/Embedded_SW/Embedded/Common/Utilities/Utils.c +++ b/Software/Embedded_SW/Embedded/Common/Utilities/Utils.c @@ -15,12 +15,12 @@ //***************************************************************************** -#define MAX_MEM_LOG 100 +/*#define MAX_MEM_LOG 100 int freeIndex=0,malloc_index=0; uint32_t malloc_size[MAX_MEM_LOG+1]; uint32_t malloc_time[MAX_MEM_LOG+1]; void * malloc_addr[MAX_MEM_LOG+1]; -void * free_addr[MAX_MEM_LOG+1]; +void * free_addr[MAX_MEM_LOG+1];*/ //uint32_t total_allocated = 0; void *my_malloc(size_t _size) { @@ -43,14 +43,14 @@ void *my_malloc(size_t _size) malloc_time[malloc_index] = msec_millisecondCounter; } */ - if ((addr)&&(_size>400)) + /*if ((addr)&&(_size>400)) { malloc_addr[malloc_index] = addr; malloc_size[malloc_index] = _size; malloc_time[malloc_index] = msec_millisecondCounter; if (malloc_index++>=MAX_MEM_LOG) malloc_index = 0; - } + }*/ return addr; } int allocated_size = 0; @@ -80,9 +80,9 @@ void my_free(void *_ptr) // allocated_size+=malloc_size[i]; * */ - free_addr[freeIndex] = _ptr; - if (freeIndex++>=MAX_MEM_LOG) - freeIndex = 0; +// free_addr[freeIndex] = _ptr; +// if (freeIndex++>=MAX_MEM_LOG) +// freeIndex = 0; } } diff --git a/Software/Embedded_SW/Embedded/Common/report/distributor.c b/Software/Embedded_SW/Embedded/Common/report/distributor.c index e4ab5fa36..d485abb70 100644 --- a/Software/Embedded_SW/Embedded/Common/report/distributor.c +++ b/Software/Embedded_SW/Embedded/Common/report/distributor.c @@ -728,7 +728,8 @@ static void messageDistribute(char *msg, Dist_Table[DistTableEntry].dest[index].function(msg,FileName,LineNumber,errorCode,parameter1,parameter2); } */ - strcpy (reportmsg,msg); + strncpy (reportmsg,msg,250); + reportmsg[251] = NULL; if (ReportFunc1 != NULL) ReportFunc1(reportmsg, FileName,LineNumber,errorCode,Severity, parameter); diff --git a/Software/Embedded_SW/Embedded/Common/report/reportInit.c b/Software/Embedded_SW/Embedded/Common/report/reportInit.c index 0d5836acf..8a39e8fd4 100644 --- a/Software/Embedded_SW/Embedded/Common/report/reportInit.c +++ b/Software/Embedded_SW/Embedded/Common/report/reportInit.c @@ -101,7 +101,7 @@ int ReportResponseFunc(char *message, /* The formatted message response.message = message; responseContainer = /*Report*/createContainer(MESSAGE_TYPE__StartDebugLogResponse, protobufToken, false, &response, &start_debug_log_response__pack, &start_debug_log_response__get_packed_size); responseContainer.continuous = true; - if (responseContainer.data.data) + //if (responseContainer.data.data) { uint8_t* container_buffer = my_malloc(message_container__get_packed_size(&responseContainer)); if (container_buffer) @@ -111,13 +111,13 @@ int ReportResponseFunc(char *message, /* The formatted message if (SendCharsWithType(container_buffer, container_size,MESSAGE_TYPE__StartDebugLogResponse) == false) //comm tx mailbox full { //CommunicationMailboxFlush(); - //protobufToken[0] = 0; + protobufToken[0] = 0; my_free(container_buffer); } } my_free(responseContainer.data.data); } - + //Task_sleep(5); return OK; } diff --git a/Software/Embedded_SW/Embedded/Communication/CommunicationTask.c b/Software/Embedded_SW/Embedded/Communication/CommunicationTask.c index 23f193b25..27780a9e3 100644 --- a/Software/Embedded_SW/Embedded/Communication/CommunicationTask.c +++ b/Software/Embedded_SW/Embedded/Communication/CommunicationTask.c @@ -201,7 +201,12 @@ int32_t SetCommunicationPath(bool UARTorUSB) CommType = UARTorUSB; return OK; } +/*#define MAX_CONT_LOG 199 +uint16_t cSendSize[MAX_CONT_LOG+1] = {0}; +uint32_t cSendTime[MAX_CONT_LOG+1] = {0}; +uint16_t cSendindex = 0; +*/ /****************************************************************************** * ======== communicationTask ======== * Task for this function is created statically. See the project's .cfg file. @@ -230,6 +235,12 @@ void communicationTxTask(UArg arg0, UArg arg1) else if (CommType == isUART) Uart_Tx(CommTxMessage.Buff, CommTxMessage.msgSize); } +/* cSendSize[cSendindex] = CommTxMessage.msgSize; + cSendTime[cSendindex] = msec_millisecondCounter; + + if (cSendindex++>=MAX_CONT_LOG) + cSendindex = 0; +*/ if (diagnosticscontainer_buffer == CommTxMessage.Buff) diagnosticscontainer_buffer = 0; my_free(CommTxMessage.Buff); diff --git a/Software/Embedded_SW/Embedded/Communication/Container.c b/Software/Embedded_SW/Embedded/Communication/Container.c index dd89c7b15..89deb2b0b 100644 --- a/Software/Embedded_SW/Embedded/Communication/Container.c +++ b/Software/Embedded_SW/Embedded/Communication/Container.c @@ -48,16 +48,16 @@ #include "Common/report/report.h" #include "Connection.h" -#define MAX_CONT_LOG 100 +#define MAX_CONT_LOG 199 -uint16_t TxmsgId[MAX_CONT_LOG+1] = {0}; +/*uint16_t TxmsgId[MAX_CONT_LOG+1] = {0}; uint16_t TxLength[MAX_CONT_LOG+1] = {0}; uint32_t TxAddr[MAX_CONT_LOG+1] = {0}; uint16_t Txindex = 0; uint32_t msgId[MAX_CONT_LOG+1] = {0}; uint32_t Length[MAX_CONT_LOG+1] = {0}; uint32_t DataLength[MAX_CONT_LOG+1] = {0}; -byte index = 0; +byte RxIndex = 0;*/ MessageContainer createContainer(MessageType type, char* token, protobuf_c_boolean completed, void* response, size_t (*packPtr)(void*, uint8_t*), size_t (*sizePtr)(void*)) @@ -79,7 +79,7 @@ MessageContainer createContainer(MessageType type, char* token, protobuf_c_boole container.data.data = response_buffer; container.data.len = response_size; - if (SuspendLargeMessages == true) + /*if (SuspendLargeMessages == true) { // Report("EndJobMessage",__FILE__,__LINE__,(int)type,RpWarning,(int)response_size,0); TxmsgId[Txindex] = type; @@ -87,7 +87,7 @@ MessageContainer createContainer(MessageType type, char* token, protobuf_c_boole TxAddr[Txindex] = msec_millisecondCounter; if (Txindex++>=MAX_CONT_LOG) Txindex = 0; - } + }*/ //free(response); return container; @@ -131,18 +131,17 @@ void receive_callback(char* buffer, size_t length) MessageContainer* requestContainer = message_container__unpack(NULL, length, (uint8_t*)buffer); if (requestContainer == NULL) return; - // HeatingTestSendResonse(0, false,true,true, /*OriginalMotorSpd_2PPS[index]*/length,requestContainer->type,0,0, "Container"); if (requestContainer->type != MESSAGE_TYPE__KeepAliveRequest) //user action resets the idle counter { resetIdleCounter(); REPORT_MSG(requestContainer->type,"Message received"); } KeepAliveOneSecondCounter = 0; - msgId[index] = requestContainer->type; - Length[index] = length; - DataLength[index] = msec_millisecondCounter; - if (index++>=MAX_CONT_LOG) - index = 0; + /*msgId[RxIndex] = requestContainer->type; + Length[RxIndex] = length; + DataLength[RxIndex] = msec_millisecondCounter; + if (RxIndex++>=MAX_CONT_LOG) + RxIndex = 0;*/ switch(requestContainer->type) { case MESSAGE_TYPE__CalculateRequest: @@ -433,13 +432,19 @@ void receive_callback(char* buffer, size_t length) message_container__free_unpacked(requestContainer, NULL); } -bool SendResult,KeepSendResult = true; +/*bool SendResult,KeepSendResult = true; uint16_t SendmsgId[MAX_CONT_LOG+1] = {0}; uint16_t SendSize[MAX_CONT_LOG+1] = {0}; uint32_t SendTime[MAX_CONT_LOG+1] = {0}; -uint16_t Sendindex = 0; +bool Sendresult[MAX_CONT_LOG+1] = {0}; +uint16_t Sendindex = 0;*/ bool SendChars(char* buffer,size_t length) { +/* SendmsgId[Sendindex] = 0xFFFF; + SendSize[Sendindex] = length; + SendTime[Sendindex] = msec_millisecondCounter; + if (Sendindex++>=MAX_CONT_LOG) + Sendindex = 0;*/ SendResult = CommunicationTaskSendMessage(buffer, length); if (SendResult == false) KeepSendResult = false; @@ -447,12 +452,15 @@ bool SendChars(char* buffer,size_t length) } bool SendCharsWithType(char* buffer,size_t length,MessageType type) { - SendmsgId[Sendindex] = type; - SendSize[Sendindex] = length; - SendTime[Sendindex] = msec_millisecondCounter; +// SendmsgId[Sendindex] = type; +// SendSize[Sendindex] = length; +// SendTime[Sendindex] = msec_millisecondCounter; + + SendResult = CommunicationTaskSendMessage(buffer, length); + +// Sendresult[Sendindex] = SendResult; if (Sendindex++>=MAX_CONT_LOG) Sendindex = 0; - SendResult = CommunicationTaskSendMessage(buffer, length); if (SendResult == false) KeepSendResult = false; return SendResult; diff --git a/Software/Embedded_SW/Embedded/Embedded.cfg b/Software/Embedded_SW/Embedded/Embedded.cfg index 5dd991512..c50a0057a 100644 --- a/Software/Embedded_SW/Embedded/Embedded.cfg +++ b/Software/Embedded_SW/Embedded/Embedded.cfg @@ -5,19 +5,22 @@ var SysMin = xdc.useModule('xdc.runtime.SysMin'); var System = xdc.useModule('xdc.runtime.System'); var Error = xdc.useModule('xdc.runtime.Error'); var ti_sysbios_hal_Hwi = xdc.useModule('ti.sysbios.hal.Hwi'); -var Memory = xdc.useModule('xdc.runtime.Memory'); var Timestamp = xdc.useModule('xdc.runtime.Timestamp'); var TimestampProvider = xdc.useModule('ti.sysbios.family.arm.lm4.TimestampProvider'); var SyncGeneric = xdc.useModule('xdc.runtime.knl.SyncGeneric'); var Mailbox = xdc.useModule('ti.sysbios.knl.Mailbox'); -var HeapStd = xdc.useModule('xdc.runtime.HeapStd'); +//var HeapStd = xdc.useModule('xdc.runtime.HeapStd'); var GIO = xdc.useModule('ti.sysbios.io.GIO'); var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore'); var Task = xdc.useModule('ti.sysbios.knl.Task'); +//var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem'); +var HeapTrack = xdc.useModule('ti.sysbios.heaps.HeapTrack'); +//var Memory = xdc.useModule('xdc.runtime.Memory'); -BIOS.heapSize = 30767; // bios heapmem -//Memory.defaultHeapSize = 48767; -Program.heap = 50000; //sysmem +BIOS.heapSize = 50000; // bios heapmem +//Memory.defaultHeapSize = 20000; +//Program.heap = 40000; +//Program.stack = 4096; Clock.timerId = 7; @@ -27,15 +30,7 @@ Program.global.adcHwi = Hwi.create(30, "&ADC0SS0Handler", hwi0Params); var hwi1Params = new Hwi.Params(); hwi1Params.instance.name = "sysTick"; Program.global.sysTick = Hwi.create(15, "&SysTickHandler", hwi1Params); -/*var hwi2Params = new Hwi.Params(); -hwi2Params.instance.name = "UART0"; -Program.global.uart0 = Hwi.create(21, "&USB0Handler", hwi2Params); -*/ -/* -var hwi21Params = new Hwi.Params(); -hwi21Params.instance.name = "portpint"; -Program.global.portpint = Hwi.create(92, "&PortPIntHandler", hwi21Params); -*/ + var hwi13Params = new Hwi.Params(); hwi13Params.instance.name = "timer0"; hwi13Params.priority = 128; @@ -51,10 +46,6 @@ hwi15Params.arg = 2; hwi15Params.priority = 160; Program.global.timer2 = Hwi.create(39, "&EightMilliSecondHeatersInterrupt", hwi15Params); -/*var hwi5Params = new Hwi.Params(); -hwi5Params.instance.name = "usb0"; -Program.global.usb0 = Hwi.create(58, "&USBCDCD_hwiHandler", hwi5Params);*/ - var hwi6Params = new Hwi.Params(); hwi6Params.instance.name = "timer1"; hwi6Params.priority = 128; @@ -66,33 +57,11 @@ hwi17Params.arg = 3; hwi17Params.priority = 96; Program.global.timer3 = Hwi.create(51, "&ScrewTimerInterrupt", hwi17Params); -/* -var semaphore1Params = new Semaphore.Params(); -semaphore1Params.instance.name = "messageSem"; -semaphore1Params.mode = Semaphore.Mode_BINARY; -Program.global.messageSem = Semaphore.create(null, semaphore1Params); - -var semaphore2Params = new Semaphore.Params(); -semaphore2Params.instance.name = "selfCheckSem"; -semaphore2Params.mode = Semaphore.Mode_BINARY; -Program.global.selfCheckSem = Semaphore.create(null, semaphore2Params); - -*/ var semaphore4Params = new Semaphore.Params(); semaphore4Params.instance.name = "initConnectionSem"; semaphore4Params.mode = Semaphore.Mode_BINARY; Program.global.initConnectionSem = Semaphore.create(null, semaphore4Params); -/* -var semaphore5Params = new Semaphore.Params(); -semaphore5Params.instance.name = "uart7Sem"; -semaphore5Params.mode = Semaphore.Mode_BINARY; -Program.global.uart7Sem = Semaphore.create(null, semaphore5Params); - -var semaphore6Params = new Semaphore.Params(); -semaphore6Params.instance.name = "ethernetSem"; -semaphore6Params.mode = Semaphore.Mode_BINARY; -Program.global.ethernetSem = Semaphore.create(null, semaphore6Params); -*/ + var semaphore0Params = new Semaphore.Params(); semaphore0Params.instance.name = "adcResultSem"; semaphore0Params.mode = Semaphore.Mode_BINARY; @@ -267,4 +236,3 @@ Program.gen.debuggerFiles = false; Task.defaultStackSize = 1024; Task.idleTaskVitalTaskFlag = false; Task.enableIdleTask = false; -Program.stack = 4096; diff --git a/Software/Embedded_SW/Embedded/Main.c b/Software/Embedded_SW/Embedded/Main.c index 5b6066a5f..36825d232 100644 --- a/Software/Embedded_SW/Embedded/Main.c +++ b/Software/Embedded_SW/Embedded/Main.c @@ -139,7 +139,7 @@ Void errHook(Error_Block *eb) if (Fresult == FR_OK) { f_lseek(FileHandle, FileHandle->fsize); - strcpy(File,site->file); + strncpy(File,site->file,49); len = usnprintf(message, 80, "\r\n%s %s",__DATE__, __TIME__); Fresult = f_write(FileHandle,message,len,&Bytes ); /* print user supplied error code */ @@ -169,8 +169,10 @@ Void errHook(Error_Block *eb) Task_sleep (200); my_free(FileHandle); } +#ifdef WATCHDOG //Power_Reset(); SysCtlReset(); +#endif } //***************************************************************************** diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c index 73532a7d2..a4e1379c5 100644 --- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c +++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c @@ -1051,6 +1051,12 @@ void SendEventNotifications(void) if (AlarmState[i].Status == true) { EventsResponse.n_events++; + if ((AlarmState[i].EventPtr == NULL) ||(AlarmState[i].EventPtr->base.descriptor->sizeof_message != 24)) + { + LOG_ERROR(i,"bad pointer for event"); + EventsResponse.n_events--; + AlarmState[i].Status = false; + } } } @@ -1098,10 +1104,12 @@ void SendEventNotifications(void) my_free(container_buffer); } } + else + AlarmHandlingStop(); if (EventsResponse.events) my_free(EventsResponse.events); - if (responseContainer.data.data) - my_free(responseContainer.data.data); + //if (responseContainer.data.data) + // my_free(responseContainer.data.data); } uint32_t ResolveEventRequestFunc(MessageContainer* requestContainer) { diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c index b89fa43ed..a3b2022e9 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c @@ -423,7 +423,7 @@ int j=0; MessageContainer diagnosticsresponseContainer; uint8_t diagnostics_response_buffer[3500]; uint8_t *diagnostics_response_ptr = diagnostics_response_buffer; -uint8_t* diagnosticscontainer_buffer=0; +char * diagnosticscontainer_buffer=0; int LargeMessagesD = 0; void SendDiagnostics(void) diff --git a/Software/Embedded_SW/Embedded/Modules/General/process.c b/Software/Embedded_SW/Embedded/Modules/General/process.c index 277891861..b0351b4ff 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/process.c +++ b/Software/Embedded_SW/Embedded/Modules/General/process.c @@ -235,33 +235,41 @@ uint32_t ProcessParamsInit(void) UploadProcessParametersRequest* request; FileHandle = my_malloc(sizeof(FIL)); - Fresult = FileOpen(ProcessParamsConfigPath, &Bytes, FileHandle); - if (Fresult == FR_OK) + if (FileHandle) { - buffer = my_malloc (Bytes); - if (buffer) + Fresult = FileOpen(ProcessParamsConfigPath, &Bytes, FileHandle); + if (Fresult == FR_OK) { - for (i=0;i<=(Bytes/100);i++) + buffer = my_malloc (Bytes); + if (buffer) { - Fresult = f_read(FileHandle,&buffer[i*100],100,&j ); - k+=j; - } - if (k!=Bytes) - LOG_ERROR(k,"File read error"); + for (i=0;i<=(Bytes/100);i++) + { + Fresult = f_read(FileHandle,&buffer[i*100],100,&j ); + k+=j; + } + if (k!=Bytes) + LOG_ERROR(k,"File read error"); - request = upload_process_parameters_request__unpack(NULL, Bytes, buffer); - // ProcessParameters* ProcessParams = process_parameters__unpack(NULL, Bytes, buffer); - if (request) - { - ProcessParameters* ProcessParams = request->processparameters; - Fresult = HandleProcessParameters(ProcessParams); - //memcpy (&ProcessParametersKeep,ProcessParams,sizeof(ProcessParameters)); - upload_process_parameters_request__free_unpacked(request,NULL); - } - free (buffer); + request = upload_process_parameters_request__unpack(NULL, Bytes, buffer); + // ProcessParameters* ProcessParams = process_parameters__unpack(NULL, Bytes, buffer); + if (request) + { + ProcessParameters* ProcessParams = request->processparameters; + Fresult = HandleProcessParameters(ProcessParams); + //memcpy (&ProcessParametersKeep,ProcessParams,sizeof(ProcessParameters)); + upload_process_parameters_request__free_unpacked(request,NULL); + } + my_free (buffer); + } + f_close(FileHandle); + } + else + { + LOG_ERROR(Fresult,"File open error"); } + my_free (FileHandle); } - f_close(FileHandle); return Fresult; } diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c index 0907c4a67..e9efd97df 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c @@ -207,7 +207,7 @@ uint32_t IDS_StopHomeDispenser (uint32_t DispenserId) Control3WayValvesWithCallback ((Valves_t)DispenserId, MidTank_Dispenser, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer if (DispenserId == LUBRICANT_DISPENSER) { - Lubricant_2Way_Valve (START); + Lubricant_2Way_Valve (STOP); } MotorSetMicroStep(MotorId, MotorsCfg[MotorId].microstep); diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c index aea16bb60..f7cf38ba8 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c @@ -475,12 +475,16 @@ c. Go to step 2.a x Segment.BrushStopsCount. if (SegmentPtr) my_free(SegmentPtr); + SegmentPtr = NULL; if (BrushStopPtr) my_free(BrushStopPtr); + BrushStopPtr = NULL; if (Segment != NULL) job_description_file_segment__free_unpacked(Segment,NULL); + Segment = NULL; if (BrushStop != NULL) job_description_file_brush_stop__free_unpacked (BrushStop,NULL); + BrushStop = NULL; Fresult = f_close(FileHandle); GeneralHwReady = true; REPORT_MSG (n_segments, "Finished checking the file"); diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c index a285d4194..4743008e5 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c @@ -114,7 +114,10 @@ uint32_t Control_Delta_Position_Pass(uint32_t Current_Read,uint32_t Previous_Rea if (Current_Read < Previous_Read) + { Time_Pass = (MAX_COUNTER - Previous_Read) + Current_Read + 1; + Report("Length rollover",__FILE__,__LINE__,(int)Current_Read,RpWarning,(int)Previous_Read,0); + } else Time_Pass = Current_Read - Previous_Read; @@ -771,7 +774,7 @@ void SetOriginMotorSpeed(float process_speed) //MotorControlConfig[Motor_i].m_SetParam = motor_speed; OriginalMotorSpd_2PPS[Motor_i] = (int) motor_speed; CurrentControlledSpeed[Motor_i] = (int) motor_speed; - Report("Original Speed",__FILE__,Motor_i,motor_speed,RpWarning,process_speed,0); + //Report("Original Speed",__FILE__,Motor_i,motor_speed,RpWarning,process_speed,0); for (i = 0; i <= MAX_CONTROL_SAMPLES; i++) MotorSpeedSamples[Motor_i][i] = motor_speed; diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c index f5ae89368..44dd09030 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c @@ -860,7 +860,8 @@ void AbortJob(char *Msg) Message.messageId = Abort; PrtMessage->messageId = PrintSystemFailure; - strcpy(PrtMessage->messageData,Msg); + strncpy(PrtMessage->messageData,Msg,99); + //PrtMessage->messageData[99] = NULL; Message.msglen = 10; if (JobmsgQ != NULL) Mailbox_post(JobmsgQ , &Message, BIOS_NO_WAIT); diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c index 2aa260e9f..484dc9e7e 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c @@ -122,9 +122,15 @@ FRESULT CloseJobFile() my_free (JobRequestFileHandle); JobRequestFileHandle = NULL; if (BrushStopPtr) + { my_free(BrushStopPtr); + BrushStopPtr = NULL; + } if (SegmentPtr) + { my_free(SegmentPtr); + SegmentPtr = NULL; + } REPORT_MSG(Fresult,"CloseJobFile"); return Fresult; @@ -145,7 +151,10 @@ JobDescriptionFileSegment *GetNextSegmentFromJobFile() { readbBytes += ImmediateRead; if (SegmentPtr) + { my_free(SegmentPtr); + SegmentPtr = NULL; + } SegmentPtr = my_malloc (SegmentSize); if (SegmentPtr) { @@ -158,6 +167,7 @@ JobDescriptionFileSegment *GetNextSegmentFromJobFile() } }// read segment data my_free(SegmentPtr); + SegmentPtr = NULL; }//segment malloc else { @@ -181,6 +191,7 @@ void FreeSegmentFileData(JobDescriptionFileSegment *Segment) Segment = NULL; if (SegmentPtr) my_free(SegmentPtr); + SegmentPtr = NULL; } JobDescriptionFileBrushStop *GetNextBrushStopFromJobFile() { @@ -196,7 +207,10 @@ JobDescriptionFileBrushStop *GetNextBrushStopFromJobFile() { readbBytes += ImmediateRead; if (BrushStopPtr) + { my_free(BrushStopPtr); + BrushStopPtr = NULL; + } BrushStopPtr = my_malloc (BrushStopSize); if (BrushStopPtr) @@ -213,6 +227,7 @@ JobDescriptionFileBrushStop *GetNextBrushStopFromJobFile() //status = ERROR; } my_free(BrushStopPtr); + BrushStopPtr = NULL; }//brushstop size read ok else { @@ -237,6 +252,7 @@ void FreeBrushStopFileData(JobDescriptionFileBrushStop *BrushStop) BrushStop = NULL; if (BrushStopPtr) my_free(BrushStopPtr); + BrushStopPtr = NULL; } /************************************************************************************************************************************/ /* this function is for development initial stages. it analyses the hardware configuration to determine which modules are operational @@ -546,7 +562,7 @@ uint32_t EndState(void *JobDetails, char *Message) { //ROM_IntMasterDisable(); //SuspendLargeMessages = true; - LOG_ERROR(2,"SuspendLargeMessages EndState"); + //LOG_ERROR(2,"SuspendLargeMessages EndState"); //DiagnosticsStop(); if (Configured[Module_Winder]) { -- cgit v1.3.1 From 002f8f76ede07a2b7b444a8e03f9f172b2fb952e Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Sun, 2 Jun 2019 16:46:26 +0300 Subject: Screw is homing at the end of the job. IDS - handle small speed --- .../Embedded_SW/Embedded/Drivers/Motors/Motor.h | 2 +- .../Embedded_SW/Embedded/Modules/IDS/IDS_print.c | 4 +- .../Embedded/Modules/Thread/Thread_Winder.c | 60 ++++++++++++++++++++-- 3 files changed, 58 insertions(+), 8 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules/Thread') diff --git a/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.h b/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.h index a11835205..d4454136b 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.h +++ b/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.h @@ -22,7 +22,7 @@ #define NUM_OF_MOTORS (HARDWARE_MOTOR_TYPE__MOTO_RLOADING + 1) // TODO After the integration with mulbery change to: //#define NUM_OF_MOTORS HARDWARE_MOTOR_TYPE__MOTO_SPARE1_1 - +#define MINIMAL_MOTOR_SPEED 0.2 //typedef enum //{ diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c index f7cf38ba8..0b54658ad 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c @@ -829,7 +829,7 @@ uint32_t IDS_Cleaning_Stop_Cleaning_Solution (callback_fptr callback); DispenserId, Dispensers[Dispenser_i]->nanoliterperpulse, MotorsCfg[HW_Motor_Id].microstep); } - if ((int) segmentfirst_speed > 0) + if (segmentfirst_speed > MINIMAL_MOTOR_SPEED) { segmentfirst_speed *= (100+WFCF); segmentfirst_speed /= 100; @@ -1057,7 +1057,7 @@ void IDS_StartBrushStop(int n_dispensers, JobDispenser** Dispensers) DispenserId, Dispensers[Dispenser_i]->nanoliterperpulse, MotorsCfg[HW_Motor_Id].microstep); } - if ((int) segmentfirst_speed > 0) + if (segmentfirst_speed > MINIMAL_MOTOR_SPEED) { DispenserSegmentReady[DispenserId] = false; //Control3WayValvesWithCallback (DispenserId, Dispenser_Mixer, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index a68995168..82f96c497 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -46,7 +46,7 @@ uint32_t CalculationDirectionChangeCounter = 1; //holds the current number of ru double WinderMotorSpeed[MAX_WINDER_SPEED_CALCULATION]; uint16_t WinderMotorSpeedCounter = 0; bool WinderMotorSpeedRollOver = false; -#define DEFAULT_SCREW_SPEED 1400 +#define DEFAULT_SCREW_SPEED 1200 double ScrewSpeed = DEFAULT_SCREW_SPEED; double ScrewRunningTime = 0; uint32_t ScrewNumberOfSteps = 0; //holds the current number of steps for the next screw run - will be used to build the cone @@ -315,7 +315,7 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) RotationsPerSecond = WinderReferenceSpeed / (double)MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_WINDER].pulseperround; tempScrewSpeed = screw_horizontal_speed*RotationsPerSecond; //ROM_IntMasterDisable(); - tempScrewSpeed = DEFAULT_SCREW_SPEED; + tempScrewSpeed = ScrewSpeed; CurrentControlledSpeed[SCREW_MOTOR] = ScrewSpeed; @@ -325,7 +325,7 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) if ((ScrewRunningTime != temp)||(ScrewSpeed != tempScrewSpeed)) { ScrewSpeed = tempScrewSpeed; - ScrewSpeed = DEFAULT_SCREW_SPEED; + //ScrewSpeed = DEFAULT_SCREW_SPEED; ScrewRunningTime = temp;//(SYS_CLK_FREQ*Steps)/ScrewSpeed; //ROM_IntMasterEnable(); //usnprintf(TempScrewStr, 100, "Winder: Horizon,Rotation, PPR, RPP{ %d, %d ,%d, %d} ",(int)screw_horizontal_speed,(int)RotationsPerSecond,(int)InternalWinderCfg.NumberOfRotationPerPassage,(int)MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_WINDER].pulseperround); @@ -364,12 +364,12 @@ uint32_t Winder_Presegment(void *SegmentDetails, uint32_t SegmentId) if (SegmentId == 0) // do all this only in the beginning of the job. do not touch after that (assuming spool does not change mid job) { ScrewCurrentDirection = (1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize); - +/* // * speed is set by the winding parameters and by winder rotational speed (read POSITION every 10msec) // * calculate // * 1. calculate speed according to JobTicket->processparameters->dyeingspeed // * calculation input: traverse length in milimeters/pulses, number of rotations per traverse ==> length of traverse per rotation. - ScrewNumberOfSteps = InternalWinderCfg.segmentoffsetpulses;//*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].microstep; + ScrewNumberOfSteps = InternalWinderCfg.segmentoffsetpulses;//MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].microstep; ScrewNumberOfSteps -= 100; screw_horizontal_speed = ScrewNumberOfSteps / InternalWinderCfg.NumberOfRotationPerPassage; // calculation input#2: number of rotations per second - (basically: speed/winder perimeter. later - according to winder actual speed - calculate according to winder position accumulation in the last second. @@ -384,7 +384,25 @@ uint32_t Winder_Presegment(void *SegmentDetails, uint32_t SegmentId) //REPORT_MSG(segmentfirst_speed,ScrewStr); Report(ScrewStr,__FILE__,__LINE__,RotationsPerSecond,RpWarning,ScrewSpeed,0); SendJobProgress(0.0,0,false, ScrewStr); +*/ + // * speed is set by the winding parameters and by winder rotational speed (read POSITION every 10msec) + // * calculate + // * 1. calculate speed according to JobTicket->processparameters->dyeingspeed + // * calculation input: traverse length in pulses, number of rotations per traverse ==> length of traverse per rotation. + ScrewNumberOfSteps = InternalWinderCfg.segmentoffsetpulses;//*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].microstep; + screw_horizontal_speed = InternalWinderCfg.segmentoffsetpulses / InternalWinderCfg.NumberOfRotationPerPassage; //steps per winder cycle + // calculation input#2: number of rotations per second - speed/winder diameter. WE USE HERE 39 MM AS ATHE WINDER DIAMETER - SOME AVERAGE BETWEEN EMPTY AND FULL + RotationsPerSecond = (dyeingspeed*10.0)/(19.50*PI); + // calculation input#3: speed = rotation per second * traverse per rotation = traverse per second. speed set: traverse per second (mm) * pulses per mm. + ScrewSpeed = screw_horizontal_speed*RotationsPerSecond; + usnprintf(ScrewStr, 100, "SCREW speed Rot/sec %d horizon %d pulses %d",(int)RotationsPerSecond*100,(int)screw_horizontal_speed*100,(int)ScrewSpeed); + //REPORT_MSG(segmentfirst_speed,ScrewStr); + Report(ScrewStr,__FILE__,__LINE__,RotationsPerSecond,RpWarning,ScrewSpeed,0); + SendJobProgress(0.0,0,false, ScrewStr); + ScrewNumberOfSteps -= 100; + + /////////////////////// CurrentControlledSpeed[SCREW_MOTOR] = ScrewSpeed; OriginalMotorSpd_2PPS[SCREW_MOTOR] = ScrewSpeed; WinderReferenceSpeed = OriginalMotorSpd_2PPS[WINDER_MOTOR]; @@ -419,6 +437,38 @@ uint32_t Winder_Presegment(void *SegmentDetails, uint32_t SegmentId) return OK; } +uint32_t ScrewDTSControlId = 0xFF; +uint32_t ScrewDTSCallback(uint32_t deviceID, uint32_t BusyFlag) +{ + REPORT_MSG ((int)msec_millisecondCounter,"ScrewDTSCallback called"); + SafeRemoveControlCallback(ScrewDTSControlId, ScrewDTSCallback); + + if (ScrewControlId != 0xFF) + { + RemoveControlCallback(ScrewControlId,Screw100msecDirectionChange); + ScrewControlId = 0xFF; + } + CurrentControlledSpeed[SCREW_MOTOR] = 0; + ScrewsStopControlTimer(); + //move the cart to the edge so the spool can be easily replaced + //MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_SCREW,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize, 1000, GPI_LS_SCREW_RIGHT, NULL,0); + MotorStop(HARDWARE_MOTOR_TYPE__MOTO_SCREW,Hard_Hiz); + MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_SCREW,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize, ScrewSpeed, GPI_LS_SCREW_RIGHT, Winder_PrepareStage2,2000); + + + return OK; +} +uint32_t WinderDistanceToSpoolState(void ) +{ + double DTS_Time = ((dryerbufferlength*100)/dyeingspeed)*1000;//distance to spool time in milliseconds + REPORT_MSG ((int)DTS_Time,"WinderDistanceToSpoolState"); + + ScrewDTSControlId = AddControlCallback(ScrewDTSCallback, DTS_Time-500,TemplateDataReadCBFunction,0,0,0); + REPORT_MSG ((int)msec_millisecondCounter,"ScrewDTSCallback start"); + + return OK; +} + uint32_t Winder_End(void) { //stop screw -- cgit v1.3.1 From 2a0e5736df4a6514baeea815152528632c285478 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Tue, 4 Jun 2019 09:05:30 +0300 Subject: Version 1.4.0.7 Heaters PID on band, does not check motor status --- .../Embedded_SW/Embedded/Modules/Control/MillisecTask.c | 7 ++----- .../Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c | 16 ++++++++-------- .../Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c | 14 +++++++++----- .../Scripts/Assemblies/Dryer/GPO_BLOWER_PWM_Precent_.cs | 2 +- 4 files changed, 20 insertions(+), 19 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules/Thread') diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c index eefac2854..b5797e749 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c @@ -349,9 +349,6 @@ uint32_t MillisecLoop(uint32_t tick) //gather Motor data from FPGA //ROM_IntMasterDisable(); */ - - - #ifndef EVALUATION_BOARD FPGA_GetBusy(); //load the busy motor information to all motors FPGA_Read_LS_Safty_Ind_Reg(); @@ -568,13 +565,13 @@ uint32_t MillisecLowLoop(uint32_t tick) DrawerFansStatus = temp & 0x1F; SystemFansStatus = temp & 0xE0; //KeepAliveOneSecondCall(); - for (Motor_i = 0;Motor_i < NUM_OF_MOTORS;Motor_i++) + /*for (Motor_i = 0;Motor_i < NUM_OF_MOTORS;Motor_i++) { if (Motor_i == HARDWARE_MOTOR_TYPE__MOTO_SCREW) continue; // if (isMotorConfigured(Motor_i)) MotorGetStatusFromFPGA(Motor_i); - } + }*/ if (!(OneMinute_Tick)) { for (Heater_i = 0;Heater_i < NUM_OF_CURRENT_HEATERS;Heater_i++) diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c index c9b704aa3..88f61637c 100644 --- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c @@ -889,12 +889,11 @@ uint32_t HeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) } */ // if ((readValue > (HeaterCmd[index].targettemperatue * AcHeatersLoweroperationLimit/1000))&&(readValue < (HeaterCmd[index].targettemperatue * AcHeatersUpperoperationLimit/1000)))//read value within 0.5 percent from target - if ((readValue > (HeaterCmd[index].targettemperatue * (100-HeaterControl[index].outputproportionalband))/100)&&(readValue < (HeaterCmd[index].targettemperatue * (100+HeaterControl[index].outputproportionalband))/100))//read value within 0.5 percent from target + if ( (readValue > (HeaterCmd[index].targettemperatue * ((100-HeaterControl[index].outputproportionalband)/100))) + && (readValue < (HeaterCmd[index].targettemperatue * ((100+HeaterControl[index].outputproportionalband)/100)))) { -////////////////// //InitialHeating = false; Report("AC PID Activating",__FILE__,__LINE__,readValue,RpWarning,(HeaterCmd[index].targettemperatue), 0); -//////////////////////// DeActivateHeater(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary); HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary, 0); HeatersControlStart(); @@ -931,8 +930,8 @@ uint32_t HeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) //REPORT_MSG (readValue,"AC HEATER Under temperature"); } } - else //PID active*/ - { + else //PID active + {*/ if ((readValue > ((HeaterCmd[index].targettemperatue * (100+HeaterControl[index].outputproportionalband))/100))) { //disable PID outside band @@ -1051,7 +1050,8 @@ uint32_t DCHeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) } //if ((readValue > (HeaterCmd[index].targettemperatue * DcHeatersLoweroperationLimit/1000))&&(readValue < (HeaterCmd[index].targettemperatue * DcHeatersUpperoperationLimit/1000)))//read value within 0.5 percent from target - if ((readValue > (HeaterCmd[index].targettemperatue * (100-HeaterControl[index].outputproportionalband))/100)&&(readValue < (HeaterCmd[index].targettemperatue * (100+HeaterControl[index].outputproportionalband))/100))//read value within 0.5 percent from target + if ( (readValue > (HeaterCmd[index].targettemperatue * ((100-HeaterControl[index].outputproportionalband)/100))) + && (readValue < (HeaterCmd[index].targettemperatue * ((100+HeaterControl[index].outputproportionalband)/100)))) { Report("DC PID Activating",__FILE__,index,readValue,RpWarning,(HeaterCmd[index].targettemperatue), 0); //DCInitialHeating[index] = false; @@ -1078,8 +1078,8 @@ uint32_t DCHeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) } } - else ///pid active*/ - { + else ///pid active + {*/ //check only for the proportional band limits HeaterPIDConfig[index].m_mesuredParam = readValue; if ((readValue > ((HeaterCmd[index].targettemperatue * (100+HeaterControl[index].outputproportionalband))/100))) diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index 82f96c497..2bbc93523 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -270,10 +270,10 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) //double calcsteps = (ScrewRunningTime/SYS_CLK_FREQ)*ScrewSpeed; //REPORT_MSG((abs(ScrewLocationRun[1] - ScrewLocationRun[0]), "Screw Run NumberOfSteps"); // usnprintf(ScrewStr, 100, "Winder Encoder: 0 0x%x 1 0x%x diff %d intent %d rot %d",ScrewLocationRun[0],ScrewLocationRun[1],abs(ScrewLocationRun[1] - ScrewLocationRun[0]),ScrewNumberOfSteps,Rotations*10); - usnprintf(ScrewStr, 150, "Winder Encoder:id, diff, intended, winderspeed, rotation, speed, time, mot speed {, %d, %d, %d, %d, %d, %d, %d, %d, }",CalculationDirectionChangeCounter, - abs(ScrewLocationRun[1] - ScrewLocationRun[0]),ScrewNumberOfSteps,(int)(WinderReferenceSpeed),(int)(Rotations*10),(int)ScrewSpeed,(int)ScrewRunningTime,(int)speedf); + //usnprintf(ScrewStr, 150, "Winder Encoder:id, diff, intended, winderspeed, rotation, speed, time, mot speed {, %d, %d, %d, %d, %d, %d, %d, %d, }",CalculationDirectionChangeCounter, + // abs(ScrewLocationRun[1] - ScrewLocationRun[0]),ScrewNumberOfSteps,(int)(WinderReferenceSpeed),(int)(Rotations*10),(int)ScrewSpeed,(int)ScrewRunningTime,(int)speedf); //usnprintf(ScrewStr, 100, "Winder Encoder: 0 %d 1 %d diff %d ",ScrewLocationRun[0],ScrewLocationRun[1],ScrewLocationRun[1] - ScrewLocationRun[0]); - Report(ScrewStr,__FILE__,__LINE__,CalculationDirectionChangeCounter,RpWarning,ScrewLocationStart, 0); + //Report(ScrewStr,__FILE__,__LINE__,CalculationDirectionChangeCounter,RpWarning,ScrewLocationStart, 0); if (ScrewCurrentDirection == 1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize) //next time going out { @@ -438,6 +438,10 @@ uint32_t Winder_Presegment(void *SegmentDetails, uint32_t SegmentId) return OK; } uint32_t ScrewDTSControlId = 0xFF; +uint32_t WinderDistanceToSpoolEnded(uint32_t deviceID, uint32_t ReadValue) +{ + REPORT_MSG ((int)msec_millisecondCounter,"WinderDistanceToSpoolEnded called"); +} uint32_t ScrewDTSCallback(uint32_t deviceID, uint32_t BusyFlag) { REPORT_MSG ((int)msec_millisecondCounter,"ScrewDTSCallback called"); @@ -453,7 +457,7 @@ uint32_t ScrewDTSCallback(uint32_t deviceID, uint32_t BusyFlag) //move the cart to the edge so the spool can be easily replaced //MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_SCREW,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize, 1000, GPI_LS_SCREW_RIGHT, NULL,0); MotorStop(HARDWARE_MOTOR_TYPE__MOTO_SCREW,Hard_Hiz); - MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_SCREW,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize, ScrewSpeed, GPI_LS_SCREW_RIGHT, Winder_PrepareStage2,2000); + MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_SCREW,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize, ScrewSpeed, GPI_LS_SCREW_RIGHT, WinderDistanceToSpoolEnded,2000); return OK; @@ -463,7 +467,7 @@ uint32_t WinderDistanceToSpoolState(void ) double DTS_Time = ((dryerbufferlength*100)/dyeingspeed)*1000;//distance to spool time in milliseconds REPORT_MSG ((int)DTS_Time,"WinderDistanceToSpoolState"); - ScrewDTSControlId = AddControlCallback(ScrewDTSCallback, DTS_Time-500,TemplateDataReadCBFunction,0,0,0); + ScrewDTSControlId = AddControlCallback(ScrewDTSCallback, DTS_Time-800,TemplateDataReadCBFunction,0,0,0); REPORT_MSG ((int)msec_millisecondCounter,"ScrewDTSCallback start"); return OK; diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/GPO_BLOWER_PWM_Precent_.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/GPO_BLOWER_PWM_Precent_.cs index f17802815..0465d0852 100644 --- a/Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/GPO_BLOWER_PWM_Precent_.cs +++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/GPO_BLOWER_PWM_Precent_.cs @@ -12,7 +12,7 @@ using Tango.Stubs; public void OnExecute(StubManager stubManager) { - const int LOW = 0;//0 - 100% + const int LOW = 75;//0 - 100% var response = stubManager.Run("StubFpgaWriteRegRequest" ,0x60000400 | 0x112, 0xFF);//Freq 8 bit var response1 = stubManager.Run("StubFpgaWriteRegRequest" ,0x60000400 | 0x3EC, LOW+1);//Low 8 bit var response2 = stubManager.Run("StubFpgaWriteRegRequest" ,0x60000400 | 0x3EE, 101 - LOW);//High 8 bit -- cgit v1.3.1