diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2020-05-27 15:12:34 +0300 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2020-05-27 15:12:34 +0300 |
| commit | 52956d3598177de58c0d742e374888cfb44276da (patch) | |
| tree | 5a169d452bf75efd9a8b5a211fda95f1bd782916 /Software/Embedded_SW/Embedded | |
| parent | 87e6aa14ac8c5be4cac5b080c0f542d2ac3dd296 (diff) | |
| parent | 985df74483b6813af53f799c5063d0865f6caabb (diff) | |
| download | Tango-52956d3598177de58c0d742e374888cfb44276da.tar.gz Tango-52956d3598177de58c0d742e374888cfb44276da.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Embedded_SW/Embedded')
7 files changed, 166 insertions, 44 deletions
diff --git a/Software/Embedded_SW/Embedded/DataDef.h b/Software/Embedded_SW/Embedded/DataDef.h index 3ca1c54cc..ecd04b742 100644 --- a/Software/Embedded_SW/Embedded/DataDef.h +++ b/Software/Embedded_SW/Embedded/DataDef.h @@ -11,6 +11,7 @@ //#define USE_USB #define Stub_Mode 1 #define USE_HIGH_SPEED_GPIO // to use AHB GPIO (A..J) ports A-J APB or AHB, ports K-Q on AHB only +//#define test_RTFU_dancer 1 //#define WithTempSensorFiltrer (to use the function Filter_Temparature_Measurement) //#define DEBUG_TEST_FUNCTIONS #define HIZ_TIMEOUT 1000 diff --git a/Software/Embedded_SW/Embedded/Drivers/Heater/TemperatureSensor.c b/Software/Embedded_SW/Embedded/Drivers/Heater/TemperatureSensor.c index 306e6e6f8..ca2b24eae 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Heater/TemperatureSensor.c +++ b/Software/Embedded_SW/Embedded/Drivers/Heater/TemperatureSensor.c @@ -456,7 +456,17 @@ uint32_t CalculateTemperatures(TEMPERATURE_SENSOR_ID_ENUM SensorId, uint32_t Dat uint32_t NoOfAvrSamples = 5;//TODO - how many Samples Status = Filter_Temparature_Measurement(SensorId, Current_Measurement_C, NoOfAvrSamples); #else - TempSensorResponse[SensorId].Temperature_C_mult_by_100 = Current_Measurement_C; + if((Head_Type == HEAD_TYPE_STAPLE_SPUN) && (( SensorId == HEAD_PT100_ZONE_6_0X84_1) || ( SensorId == HEAD_PT100_ZONE_8_0X86_1)))//pressure sensors + //if((Head_Type == HEAD_TYPE_STAPLE_SPUN) && (( SensorId == HEAD_PT100_ZONE_5_0X84_0) || ( SensorId == HEAD_PT100_ZONE_7_0X86_0)))//pressure sensors + { + //Head Staple spun pressure sensors + TempSensorResponse[SensorId].Temperature_C_mult_by_100 = TempSensorResponse[SensorId].PT100_ADC_Reading_Bits; + Current_Measurement_C = TempSensorResponse[SensorId].PT100_ADC_Reading_Bits; + } + else + { + TempSensorResponse[SensorId].Temperature_C_mult_by_100 = Current_Measurement_C; + } #endif return Current_Measurement_C; diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/PT100/Head_PT100_ADC.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/PT100/Head_PT100_ADC.c index ec798b472..a6db745cd 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/PT100/Head_PT100_ADC.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/PT100/Head_PT100_ADC.c @@ -252,43 +252,72 @@ uint8_t HeadADCPT100_InitConfigReg() { for(i=HEAD_PT100_ZONE_1_0X80_0;i < MAX_HEAD_CARD_TEMP_SENS_ID;i++) // for now we are using the same configuration to all of them { - // - - - - - - - - - - Reg0 - - - - - - - - - - - HeadTempSensConfig[i].Reg0.bits.PGA_BYPASS = ADS122X_USE_PGA ;//Bit 0 - HeadTempSensConfig[i].Reg0.bits.GAIN = ADS122X_GAIN_8 ;//Bits 1-3 - //HeadTempSensConfig[i].Reg0.bits.MUX = HEAD_CONFIG_ODD_PT100_MUX ;//Bits 4-7 + if((Head_Type == HEAD_TYPE_STAPLE_SPUN) && (( i == HEAD_PT100_ZONE_6_0X84_1) || ( i == HEAD_PT100_ZONE_8_0X86_1)))//pressure sensors + //if((Head_Type == HEAD_TYPE_STAPLE_SPUN) && (( i == HEAD_PT100_ZONE_5_0X84_0) || ( i == HEAD_PT100_ZONE_7_0X86_0)))//pressure sensors + { + // - - - - - - - - - - Reg0 - - - - - - - - - - + HeadTempSensConfig[i].Reg0.bits.PGA_BYPASS = ADS122X_PGA_BYPASS ;//Bit 0 + HeadTempSensConfig[i].Reg0.bits.GAIN = ADS122X_GAIN_1 ;//Bits 1-3 + //HeadTempSensConfig[i].Reg0.bits.MUX = HEAD_CONFIG_ODD_PT100_MUX ;//Bits 4-7 - // - - - - - - - - - - Reg1 - - - - - - - - - - + // - - - - - - - - - - Reg1 - - - - - - - - - - + HeadTempSensConfig[i].Reg1.bits.TS = ADS122X_TEMP_SENSOR_OFF ;//Bit 0 + HeadTempSensConfig[i].Reg1.bits.VREF = ADS122X_VREF_AVDD ;//Bits 1-2 + HeadTempSensConfig[i].Reg1.bits.CM = ADS122X_CONVERSION_CONTINUOUS ;//Bit 3 + HeadTempSensConfig[i].Reg1.bits.MODE = ADS122X_OP_MODE_NORMAL ;//Bit 4 + HeadTempSensConfig[i].Reg1.bits.DR = ADS122X_DATA_RATE_20SPS ;//Bits 5-7 - HeadTempSensConfig[i].Reg1.bits.TS = ADS122X_TEMP_SENSOR_OFF ;//Bit 0 - HeadTempSensConfig[i].Reg1.bits.VREF = ADS122X_VREF_EXT_REF0_PINS ;//Bits 1-2 - HeadTempSensConfig[i].Reg1.bits.CM = ADS122X_CONVERSION_CONTINUOUS ;//Bit 3 - HeadTempSensConfig[i].Reg1.bits.MODE = ADS122X_OP_MODE_NORMAL ;//Bit 4 - HeadTempSensConfig[i].Reg1.bits.DR = ADS122X_DATA_RATE_20SPS ;//Bits 5-7 + // - - - - - - - - - - Reg2 - - - - - - - - - - + HeadTempSensConfig[i].Reg2.bits.IDAC = ADS122X_IDAC_CURRENT_OFF ;//Bits 0-2 + HeadTempSensConfig[i].Reg2.bits.BCS = ADS122X_BCS_CURRENT_SOURCES_OFF ;//Bit 3 + HeadTempSensConfig[i].Reg2.bits.CRC = ADS122X_CRC_DISABLED ;//BitS 4-5 + HeadTempSensConfig[i].Reg2.bits.DCNT = ADS122X_DCNT_CONVERSION_COUNTER_DISABLED ;//Bit 6 + HeadTempSensConfig[i].Reg2.bits.DRDY = ADS122X_DRDY_NO_NEW_CONVERSION ;//Bit 7 - // - - - - - - - - - - Reg2 - - - - - - - - - - + // - - - - - - - - - - Reg3 - - - - - - - - - - + HeadTempSensConfig[i].Reg3.bits.Always_write_0 = ADS122X_RESERVED_WRITE_0 ;//BitS 0-1 Always write 0 + HeadTempSensConfig[i].Reg3.bits.I2MUX = ADS122X_IDAC2_DISABLED ;//Bits 2-4 + HeadTempSensConfig[i].Reg3.bits.I1MUX = ADS122X_IDAC1_DISABLED ;//Bits 5-7 + } + else + { + // - - - - - - - - - - Reg0 - - - - - - - - - - + HeadTempSensConfig[i].Reg0.bits.PGA_BYPASS = ADS122X_USE_PGA ;//Bit 0 + HeadTempSensConfig[i].Reg0.bits.GAIN = ADS122X_GAIN_8 ;//Bits 1-3 + //HeadTempSensConfig[i].Reg0.bits.MUX = HEAD_CONFIG_ODD_PT100_MUX ;//Bits 4-7 - HeadTempSensConfig[i].Reg2.bits.IDAC = ADS122X_IDAC_CURRENT_1000_UA ;//Bits 0-2 - HeadTempSensConfig[i].Reg2.bits.BCS = ADS122X_BCS_CURRENT_SOURCES_OFF ;//Bit 3 - HeadTempSensConfig[i].Reg2.bits.CRC = ADS122X_CRC_DISABLED ;//BitS 4-5 - HeadTempSensConfig[i].Reg2.bits.DCNT = ADS122X_DCNT_CONVERSION_COUNTER_DISABLED ;//Bit 6 - HeadTempSensConfig[i].Reg2.bits.DRDY = ADS122X_DRDY_NO_NEW_CONVERSION ;//Bit 7 + // - - - - - - - - - - Reg1 - - - - - - - - - - + HeadTempSensConfig[i].Reg1.bits.TS = ADS122X_TEMP_SENSOR_OFF ;//Bit 0 + HeadTempSensConfig[i].Reg1.bits.VREF = ADS122X_VREF_EXT_REF0_PINS ;//Bits 1-2 + HeadTempSensConfig[i].Reg1.bits.CM = ADS122X_CONVERSION_CONTINUOUS ;//Bit 3 + HeadTempSensConfig[i].Reg1.bits.MODE = ADS122X_OP_MODE_NORMAL ;//Bit 4 + HeadTempSensConfig[i].Reg1.bits.DR = ADS122X_DATA_RATE_20SPS ;//Bits 5-7 + + // - - - - - - - - - - Reg2 - - - - - - - - - - + HeadTempSensConfig[i].Reg2.bits.IDAC = ADS122X_IDAC_CURRENT_1000_UA ;//Bits 0-2 + HeadTempSensConfig[i].Reg2.bits.BCS = ADS122X_BCS_CURRENT_SOURCES_OFF ;//Bit 3 + HeadTempSensConfig[i].Reg2.bits.CRC = ADS122X_CRC_DISABLED ;//BitS 4-5 + HeadTempSensConfig[i].Reg2.bits.DCNT = ADS122X_DCNT_CONVERSION_COUNTER_DISABLED ;//Bit 6 + HeadTempSensConfig[i].Reg2.bits.DRDY = ADS122X_DRDY_NO_NEW_CONVERSION ;//Bit 7 + + // - - - - - - - - - - Reg3 - - - - - - - - - - + HeadTempSensConfig[i].Reg3.bits.Always_write_0 = ADS122X_RESERVED_WRITE_0 ;//BitS 0-1 Always write 0 + HeadTempSensConfig[i].Reg3.bits.I2MUX = ADS122X_IDAC2_AIN3 ;//Bits 2-4 + HeadTempSensConfig[i].Reg3.bits.I1MUX = ADS122X_IDAC1_AIN0 ;//Bits 5-7 + } - // - - - - - - - - - - Reg3 - - - - - - - - - - - HeadTempSensConfig[i].Reg3.bits.Always_write_0 = ADS122X_RESERVED_WRITE_0 ;//BitS 0-1 Always write 0 - HeadTempSensConfig[i].Reg3.bits.I2MUX = ADS122X_IDAC2_AIN3 ;//Bits 2-4 - HeadTempSensConfig[i].Reg3.bits.I1MUX = ADS122X_IDAC1_AIN0 ;//Bits 5-7 } for(i=HEAD_PT100_ZONE_1_0X80_0;i < HEAD_PT100_ZONE_2_0X80_1;i++) { - HeadTempSensConfig[i].Reg0.bits.MUX = HEAD_CONFIG_ODD_PT100_MUX ;//Bits 4-7 + HeadTempSensConfig[i].Reg0.bits.MUX = HEAD_CONFIG_ODD_PT100_MUX ;//Bits 4-7 HeadTempSensConfig[i].SEL = HEAD_CONFIG_ODD_PT100_PT_SEL; } for(i=HEAD_PT100_ZONE_2_0X80_1;i < HEAD_PT100_RESERVE_0X8E_1;i++) { - HeadTempSensConfig[i].Reg0.bits.MUX = HEAD_CONFIG_EVEN_PT100_MUX ;//Bits 4-7 + HeadTempSensConfig[i].Reg0.bits.MUX = HEAD_CONFIG_EVEN_PT100_MUX ;//Bits 4-7 HeadTempSensConfig[i].SEL = HEAD_CONFIG_EVEN_PT100_PT_SEL; } @@ -303,30 +332,30 @@ uint8_t HeadADCPT100_InitConfigReg() for(i=HEAD_PT100_ZONE_1_0X80_0;i<MAX_HEAD_CARD_TEMP_SENS_ID; i++) { // - - - - - - - - - - Reg0 - - - - - - - - - - - HeadTempSensConfig[i].Reg0.bits.PGA_BYPASS = ADS122X_USE_PGA ;//Bit 0 - HeadTempSensConfig[i].Reg0.bits.GAIN = ADS122X_GAIN_8 ;//Bits 1-3 - HeadTempSensConfig[i].Reg0.bits.MUX = ADS122X_MUX_AIN1_AIN0 ;//Bits 4-7 + HeadTempSensConfig[i].Reg0.bits.PGA_BYPASS = ADS122X_USE_PGA ;//Bit 0 + HeadTempSensConfig[i].Reg0.bits.GAIN = ADS122X_GAIN_8 ;//Bits 1-3 + HeadTempSensConfig[i].Reg0.bits.MUX = ADS122X_MUX_AIN1_AIN0 ;//Bits 4-7 // - - - - - - - - - - Reg1 - - - - - - - - - - - HeadTempSensConfig[i].Reg1.bits.TS = ADS122X_TEMP_SENSOR_OFF ;//Bit 0 - HeadTempSensConfig[i].Reg1.bits.VREF = ADS122X_VREF_INTERNAL ;//Bits 1-2 - HeadTempSensConfig[i].Reg1.bits.CM = ADS122X_CONVERSION_CONTINUOUS ;//Bit 3 - HeadTempSensConfig[i].Reg1.bits.MODE = ADS122X_OP_MODE_NORMAL ;//Bit 4 - HeadTempSensConfig[i].Reg1.bits.DR = ADS122X_DATA_RATE_20SPS ;//Bits 5-7 + HeadTempSensConfig[i].Reg1.bits.TS = ADS122X_TEMP_SENSOR_OFF ;//Bit 0 + HeadTempSensConfig[i].Reg1.bits.VREF = ADS122X_VREF_INTERNAL ;//Bits 1-2 + HeadTempSensConfig[i].Reg1.bits.CM = ADS122X_CONVERSION_CONTINUOUS ;//Bit 3 + HeadTempSensConfig[i].Reg1.bits.MODE = ADS122X_OP_MODE_NORMAL ;//Bit 4 + HeadTempSensConfig[i].Reg1.bits.DR = ADS122X_DATA_RATE_20SPS ;//Bits 5-7 // - - - - - - - - - - Reg2 - - - - - - - - - - - HeadTempSensConfig[i].Reg2.bits.IDAC = ADS122X_IDAC_CURRENT_500_UA ;//Bits 0-2 - HeadTempSensConfig[i].Reg2.bits.BCS = ADS122X_BCS_CURRENT_SOURCES_OFF ;//Bit 3 - HeadTempSensConfig[i].Reg2.bits.CRC = ADS122X_CRC_DISABLED ;//BitS 4-5 - HeadTempSensConfig[i].Reg2.bits.DCNT = ADS122X_DCNT_CONVERSION_COUNTER_DISABLED ;//Bit 6 - HeadTempSensConfig[i].Reg2.bits.DRDY = ADS122X_DRDY_NO_NEW_CONVERSION ;//Bit 7 + HeadTempSensConfig[i].Reg2.bits.IDAC = ADS122X_IDAC_CURRENT_500_UA ;//Bits 0-2 + HeadTempSensConfig[i].Reg2.bits.BCS = ADS122X_BCS_CURRENT_SOURCES_OFF ;//Bit 3 + HeadTempSensConfig[i].Reg2.bits.CRC = ADS122X_CRC_DISABLED ;//BitS 4-5 + HeadTempSensConfig[i].Reg2.bits.DCNT = ADS122X_DCNT_CONVERSION_COUNTER_DISABLED ;//Bit 6 + HeadTempSensConfig[i].Reg2.bits.DRDY = ADS122X_DRDY_NO_NEW_CONVERSION ;//Bit 7 // - - - - - - - - - - Reg3 - - - - - - - - - - - HeadTempSensConfig[i].Reg3.bits.Always_write_0 = ADS122X_RESERVED_WRITE_0 ;//BitS 0-1 Always write 0 - HeadTempSensConfig[i].Reg3.bits.I2MUX = ADS122X_IDAC2_DISABLED ;//Bits 2-4 - HeadTempSensConfig[i].Reg3.bits.I1MUX = ADS122X_IDAC1_AIN3 ;//Bits 5-7 + HeadTempSensConfig[i].Reg3.bits.Always_write_0 = ADS122X_RESERVED_WRITE_0 ;//BitS 0-1 Always write 0 + HeadTempSensConfig[i].Reg3.bits.I2MUX = ADS122X_IDAC2_DISABLED ;//Bits 2-4 + HeadTempSensConfig[i].Reg3.bits.I1MUX = ADS122X_IDAC1_AIN3 ;//Bits 5-7 } } diff --git a/Software/Embedded_SW/Embedded/Drivers/SSI_Comm/Dancer/Dancer.c b/Software/Embedded_SW/Embedded/Drivers/SSI_Comm/Dancer/Dancer.c index 749fad6b0..ae814a8cb 100644 --- a/Software/Embedded_SW/Embedded/Drivers/SSI_Comm/Dancer/Dancer.c +++ b/Software/Embedded_SW/Embedded/Drivers/SSI_Comm/Dancer/Dancer.c @@ -5,7 +5,7 @@ * Author: avi */ - +#include "include.h" #include <stdbool.h> #include <stdlib.h> #include <stdio.h> @@ -27,7 +27,8 @@ #include "drivers/FPGA/FPGA_SSI_Comm.h" #include "PMR/Hardware/HardwareDancerType.pb-c.h" - +#include <driverlib/timer.h> +#include "Modules/Control/MillisecTask.h" extern SSI_DANCER_ENC DANCER_ENC[NUM_OF_ROTENC]; @@ -105,5 +106,58 @@ void Loop_SSI() } +//----------------------------------------------------------------- + +#include "drivers/FPGA/FPGA_SPI_Comm.h" +bool test_dancer_direction = false, test_dancer_flag = false; + +void test_dancer_responce_RTFU() +{ + static uint32_t i = 0, FT = 0; + + static uint32_t save_milisec = 0; + + static uint16_t Save_start_ENC = 0; + + + if(test_dancer_flag == true) + { + i=1; + test_dancer_flag = false; + MotorDriverRequest[21].Direction = test_dancer_direction; + //MotorDriverRequest[21].Speed = 60; + //FPGA_SetMotSpeedDirect(21);//RDancer + MotorSetSpeed(21, 60); + save_milisec = msec_millisecondCounter; + } + + if((i>0)&&(i<5000)) + { + FPGA_SSI_Transmit(2);//RDancer + delayUs(100); + FPGA_SSI_Receive(2);//RDancer + + if(i == 1) + { + Save_start_ENC = DANCER_ENC[2].Position; + } + if((((DANCER_ENC[2].Position - Save_start_ENC) >= 2 ) || ((Save_start_ENC - DANCER_ENC[2].Position) >= 2 )) && (FT == 0)) + { + FT = 1; + Report("*-*-*-*-* time till movement mSec *-*-*-*-*", __FILE__, __LINE__, 0, RpMessage, (int)(/*abs*/(msec_millisecondCounter-save_milisec)), 0); + + } + + Report("*-*-*-*-* test_dancer_responce_RTFU *-*-*-*-*", __FILE__, __LINE__, 0, RpMessage, (int)(DANCER_ENC[2].Position), 0); + i=i+1; + } + else + { + i=0; + FT = 0; + //MotorDriverRequest[21].Stop = Hard_Stop; + //FPGA_SetMotStop(21); + } +} diff --git a/Software/Embedded_SW/Embedded/Drivers/SSI_Comm/Dancer/Dancer.h b/Software/Embedded_SW/Embedded/Drivers/SSI_Comm/Dancer/Dancer.h index 8c9d8cfd7..6598b88c2 100644 --- a/Software/Embedded_SW/Embedded/Drivers/SSI_Comm/Dancer/Dancer.h +++ b/Software/Embedded_SW/Embedded/Drivers/SSI_Comm/Dancer/Dancer.h @@ -17,7 +17,10 @@ uint32_t Read_Dryer_Status(HardwareDancerType DancerId); void Loop_SSI(); +void test_dancer_responce_RTFU(bool motor_direction); +void test_dancer_responce_RTFU(); +extern bool test_dancer_direction, test_dancer_flag; #endif /* DRIVERS_SSI_COMM_DANCER_DANCER_H_ */ diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c index 67a532e78..d334c9001 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c @@ -490,9 +490,15 @@ uint32_t MillisecLoop(uint32_t tick) #ifdef HUNDRED_MICROSECONDS_DANCER_READ SaveLogData(); #else - Dancer_Data[FEEDER_DANCER] = Read_Dancer_Position(FEEDER_DANCER); - Dancer_Data[POOLER_DANCER] = Read_Dancer_Position(POOLER_DANCER); - Dancer_Data[WINDER_DANCER] = Read_Dancer_Position(WINDER_DANCER); + + #ifdef test_RTFU_dancer + test_dancer_responce_RTFU(); + #else + Dancer_Data[FEEDER_DANCER] = Read_Dancer_Position(FEEDER_DANCER); + Dancer_Data[POOLER_DANCER] = Read_Dancer_Position(POOLER_DANCER); + Dancer_Data[WINDER_DANCER] = Read_Dancer_Position(WINDER_DANCER); + #endif + #endif return OK; } diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c index fff8596f8..501899d7e 100644 --- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c +++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c @@ -86,6 +86,25 @@ void Stub_ProgressRequest(MessageContainer* requestContainer) response.has_progress = true; } else + if(request->amount == 0xdace)//test_dancer_responce_RTFU + //in order to use it unmark the define test_RTFU_dancer !!!!!!!!!!! + { + test_dancer_flag = true; + + if(request->delay == 0x01) + { + test_dancer_direction = true; + } + else + if(request->delay == 0x00) + { + test_dancer_direction = false; + } + + response.progress = 0xdace; + response.has_progress = true; + } + else if(request->amount == 0x3EC) { if(request->delay == 0x01) |
