diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-08-23 11:39:25 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-08-23 11:39:25 +0300 |
| commit | 44f71ccd29edeeb13621996659232fca4554faf1 (patch) | |
| tree | c0dfb8941563806a3b3d32bdbaadb55007a905e8 /Software | |
| parent | 9f4fa3e0a6bafe27dd1e584838e45d61864a70fd (diff) | |
| parent | b92bebe3f84a5ef683e44decf1991359fb3a4e21 (diff) | |
| download | Tango-44f71ccd29edeeb13621996659232fca4554faf1.tar.gz Tango-44f71ccd29edeeb13621996659232fca4554faf1.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software')
30 files changed, 371 insertions, 103 deletions
diff --git a/Software/Embedded_SW/.jxbrowser-data/Cache/data_0 b/Software/Embedded_SW/.jxbrowser-data/Cache/data_0 Binary files differindex fd7a261f3..4db352fb3 100644 --- a/Software/Embedded_SW/.jxbrowser-data/Cache/data_0 +++ b/Software/Embedded_SW/.jxbrowser-data/Cache/data_0 diff --git a/Software/Embedded_SW/.jxbrowser-data/Cache/data_1 b/Software/Embedded_SW/.jxbrowser-data/Cache/data_1 Binary files differindex f93dc7092..a46d23c87 100644 --- a/Software/Embedded_SW/.jxbrowser-data/Cache/data_1 +++ b/Software/Embedded_SW/.jxbrowser-data/Cache/data_1 diff --git a/Software/Embedded_SW/.jxbrowser-data/Cache/data_2 b/Software/Embedded_SW/.jxbrowser-data/Cache/data_2 Binary files differindex c9289a9fc..54bb2b79d 100644 --- a/Software/Embedded_SW/.jxbrowser-data/Cache/data_2 +++ b/Software/Embedded_SW/.jxbrowser-data/Cache/data_2 diff --git a/Software/Embedded_SW/.jxbrowser-data/Cache/data_3 b/Software/Embedded_SW/.jxbrowser-data/Cache/data_3 Binary files differindex a1a30e57f..3322af077 100644 --- a/Software/Embedded_SW/.jxbrowser-data/Cache/data_3 +++ b/Software/Embedded_SW/.jxbrowser-data/Cache/data_3 diff --git a/Software/Embedded_SW/.jxbrowser-data/GPUCache/data_1 b/Software/Embedded_SW/.jxbrowser-data/GPUCache/data_1 Binary files differindex a898e5e2b..4ffeb88cb 100644 --- a/Software/Embedded_SW/.jxbrowser-data/GPUCache/data_1 +++ b/Software/Embedded_SW/.jxbrowser-data/GPUCache/data_1 diff --git a/Software/Embedded_SW/.jxbrowser-data/History b/Software/Embedded_SW/.jxbrowser-data/History Binary files differindex b4191a552..af92dd0a9 100644 --- a/Software/Embedded_SW/.jxbrowser-data/History +++ b/Software/Embedded_SW/.jxbrowser-data/History diff --git a/Software/Embedded_SW/.jxbrowser-data/Local Storage - EXT/http_127.0.0.1.localstorage b/Software/Embedded_SW/.jxbrowser-data/Local Storage - EXT/http_127.0.0.1.localstorage index e606ba65a..32838ea86 100644 --- a/Software/Embedded_SW/.jxbrowser-data/Local Storage - EXT/http_127.0.0.1.localstorage +++ b/Software/Embedded_SW/.jxbrowser-data/Local Storage - EXT/http_127.0.0.1.localstorage @@ -1,4 +1,4 @@ -#Tue Jul 24 13:57:24 IDT 2018 +#Mon Aug 13 15:51:32 IDT 2018 viewsData-storage={"ti.sysbios.knl.Task.Basic"\:{"columnStates"\:[{"name"\:"address","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"label","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"priority","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"mode","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"fxn","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"arg0","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"arg1","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"stackSize","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"stackBase","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"curCoreId","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"affinity","checked"\:true,"hasFormat"\:false,"format"\:null}],"hasFormats"\:true},"ti.sysbios.knl.Task"\:{"defaultViewName"\:"CallStacks"},"ti.sysbios.family.arm.m3.Hwi.Basic"\:{"columnStates"\:[{"name"\:"address","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"halHwiHandle","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"label","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"type","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"intNum","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"priority","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"group","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"subPriority","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"fxn","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"arg","checked"\:true,"hasFormat"\:true,"format"\:"Hex"}],"hasFormats"\:true},"ti.sysbios.family.arm.m3.Hwi"\:{"defaultViewName"\:"Exception"},"ti.sysbios.knl.Task.Detailed"\:{"columnStates"\:[{"name"\:"address","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"label","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"priority","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"mode","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"fxn","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"arg0","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"arg1","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"stackPeak","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"stackSize","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"stackBase","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"curCoreId","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"affinity","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"blockedOn","checked"\:true,"hasFormat"\:false,"format"\:null}],"hasFormats"\:true},"ti.sysbios.family.arm.m3.Hwi.Detailed"\:{"columnStates"\:[{"name"\:"address","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"halHwiHandle","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"label","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"type","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"intNum","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"priority","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"group","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"subPriority","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"fxn","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"arg","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"irp","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"status","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"coreId","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"}],"hasFormats"\:true},"ti.sysbios.heaps.HeapMem.Basic"\:{"columnStates"\:[{"name"\:"address","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"label","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"buf","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"minBlockAlign","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"sectionName","checked"\:true,"hasFormat"\:false,"format"\:null}],"hasFormats"\:true},"ti.sysbios.knl.Event"\:{"defaultViewName"\:"Raw"},"ti.sysbios.knl.Event.Raw"\:{},"ti.catalog.arm.cortexm4.tiva.ce.Boot.Module"\:{"columnStates"\:[{"name"\:"address","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"configureClock","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"sysClockDivEnable","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"sysClockDiv","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"pwmClockDivEnable","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"pwmClockDiv","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"xtal","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"oscSrc","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"pllBypass","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"pllOutEnable","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"ioscDisable","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"moscDisable","checked"\:true,"hasFormat"\:false,"format"\:null}],"hasFormats"\:false},"ti.sysbios.knl.Swi.Basic"\:{"columnStates"\:[{"name"\:"address","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"label","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"state","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"priority","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"fxn","checked"\:true,"hasFormat"\:false,"format"\:null},{"name"\:"arg0","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"arg1","checked"\:true,"hasFormat"\:true,"format"\:"Hex"},{"name"\:"initTrigger","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"},{"name"\:"curTrigger","checked"\:true,"hasFormat"\:true,"format"\:"Decimal"}],"hasFormats"\:true},"xdc.runtime.System.XDCROOT"\:{"columnStates"\:[{"name"\:"entry","checked"\:true,"hasFormat"\:false,"format"\:null}],"hasFormats"\:false},"xdc.runtime.System"\:{"defaultViewName"\:"Raw"},"xdc.runtime.System.Raw"\:{},"ti.sysbios.family.arm.m3.Hwi.Raw"\:{}} rovSettings-storage={"exeMrus"\:["C\:/Tango/Software/Embedded_SW/Embedded/Debug/Embedded.out","C\:/Tango/Software/Embedded_SW/Embedded/debug_w_pmr/Embedded.out"]} -rovInit-storage={"progressInfo"\:{"min"\:0,"max"\:7,"step"\:1,"notifyCount"\:6,"average"\:6,"numLoads"\:18},"autoConnectChecked"\:false,"exe"\:"C\:/Tango/Software/Embedded_SW/Embedded/Debug/Embedded.out","commLink"\:"Debugger","autoConnect"\:false,"noExe"\:false,"showIntro"\:true} +rovInit-storage={"progressInfo"\:{"min"\:0,"max"\:7,"step"\:1,"notifyCount"\:0,"average"\:6,"numLoads"\:19},"autoConnectChecked"\:false,"exe"\:"C\:/Tango/Software/Embedded_SW/Embedded/Debug/Embedded.out","commLink"\:"Debugger","autoConnect"\:false,"noExe"\:false,"showIntro"\:true} diff --git a/Software/Embedded_SW/.jxbrowser-data/Login Data b/Software/Embedded_SW/.jxbrowser-data/Login Data Binary files differindex d9af96346..e844a2c9d 100644 --- a/Software/Embedded_SW/.jxbrowser-data/Login Data +++ b/Software/Embedded_SW/.jxbrowser-data/Login Data diff --git a/Software/Embedded_SW/Embedded/Communication/CommunicationTask.c b/Software/Embedded_SW/Embedded/Communication/CommunicationTask.c index 5ec028e86..91f1a78aa 100644 --- a/Software/Embedded_SW/Embedded/Communication/CommunicationTask.c +++ b/Software/Embedded_SW/Embedded/Communication/CommunicationTask.c @@ -31,12 +31,12 @@ struct serialBuffer { size_t size; } typedef SerialBuffer; -char Buffer[4000]; +char CommRxBuffer[COMM_MAX_BUFFER_SIZE]; SerialBuffer inBuffer; uint32_t initArray(size_t initialSize) { SerialBuffer *a = &inBuffer; - if (initialSize >= 4000) return 0; - a->buffer = Buffer; + if (initialSize >= COMM_MAX_BUFFER_SIZE) return 0; + a->buffer = CommRxBuffer; a->used = 0; a->size = initialSize; return initialSize; diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_Comm.h b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_Comm.h index dd817765c..1ecedf00c 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_Comm.h +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_Comm.h @@ -119,6 +119,9 @@ #define F1_DRYER_LOADARM_ROTENC_M (*((volatile short *)(FPGA1_BASE | 0x152))) //10bits Value of the Msb of the QEI register, 1bit Direction of movement, 5bits Reserved #define F1_DRYER_LOADARM_ROTENC_I (*((volatile short *)(FPGA1_BASE | 0x154))) //value of index counter +//WATCHDOG +#define F1_Watchdog_reg (*((volatile short *)(FPGA1_BASE | 0x160)))//Watchdog enable bit, watchdog value - F1_gpo_01 BIT2 DYEINGH_SSR10_CTRL HeadHeaterZ5 + //SSI #define F1_RSPARE_ROTENC_DATA_p_RX_lsb (*((volatile short *)(FPGA1_BASE | 0x180))) //The 16 Lsb bits of the shifted in data. #define F1_RSPARE_ROTENC_DATA_p_RX_msb (*((volatile short *)(FPGA1_BASE | 0x182))) //16 bit MSB if nessesary @@ -627,6 +630,9 @@ #define F3_RSPARE_ROTENC_msb (*((volatile short *)(FPGA3_BASE | 0x112))) //10bits Value of the Msb of the QEI register, 1bit Direction of movement, 5bits Reserved #define F3_RSPARE_ROTENC_index (*((volatile short *)(FPGA3_BASE | 0x114))) //value of index counter +//WATCHDOG +#define F3_Watchdog_reg (*((volatile short *)(FPGA3_BASE | 0x140)))//Watchdog enable bit, watchdog value - F3_GPO_01_bus BIT4 DYEINGH_SSR11_CTRL HeadHeaterZ6 + //SPI_MOTO_RLOADING_A1 #define F3_MOTO_SPARE1_1_A1_TX_00 (*((volatile short *)(FPGA3_BASE | 0x200))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. #define F3_MOTO_SPARE1_1_A1_TX_01 (*((volatile short *)(FPGA3_BASE | 0x202))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c index 4d10b6b7c..ef3933d30 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c @@ -309,8 +309,8 @@ bool FPGA_Read_limit_Switches(FPGA_GPI_ENUM Limit_Switch) LS_Dispenser_7_8.bits.F2_LS_DISPENSER_UP_8 = NO_LIMIT; break; default : - //error - break; + LM_Status = NO_LIMIT; + break; } return LM_Status; } @@ -376,13 +376,20 @@ uint32_t Control_WD(bool IsEnable, unsigned char SetTimer_Steps100mSec) // Contr */ { #ifndef EVALUATION_BOARD + + short WD_Enable = 0x4000 | SetTimer_Steps100mSec; + if (IsEnable == DISABLE) { + F1_Watchdog_reg = 0; F2_Watchdog_reg = 0; + F3_Watchdog_reg = 0; } else { - F2_Watchdog_reg = 0x4000 | SetTimer_Steps100mSec; // Enable the watchdog + F1_Watchdog_reg = WD_Enable; // Enable the watchdog F3_GPO_01_bus BIT4 DYEINGH_SSR11_CTRL HeadHeaterZ6 + F2_Watchdog_reg = WD_Enable; // Enable the watchdog F2_CTRL + reset dispensers motor drivers + F3_Watchdog_reg = WD_Enable; // Enable the watchdog F1_gpo_01 BIT2 DYEINGH_SSR10_CTRL HeadHeaterZ5 } #endif return OK; diff --git a/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/Flash_Memory.c b/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/Flash_Memory.c index 944abb737..702ecafcc 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/Flash_Memory.c +++ b/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/Flash_Memory.c @@ -3,6 +3,11 @@ //see also https://github.com/yuvadm/tiva-c/blob/master/boards/dk-tm4c129x/drivers/mx66l51235f.c //On board Quad SPI 512Mb Flash + +//Macronixýþ þýMX66L51235FZ2I-10Gýþ +//Sector Size 4KB + + #include <stdlib.h> #include <stdint.h> #include <stdbool.h> @@ -47,6 +52,12 @@ #define INS_PAGE_PROGRAM 0x02 #define INS_READ_DATA 0x03 +//-------------------- AVI: based on https://github.com/turingo/stm32ss/blob/master/src/stm32ss/bsp/sf.c +#define INS_BLOCK_ERASE (0xd8) +#define INS_CHIP_ERASE (0xc7) +#define INS_WRITE_DISABLE (0x04) +//------------------------- + #if defined(ewarm) #pragma data_alignment=1024 tDMAControlTable g_sDMAControlTable[6]; @@ -610,13 +621,36 @@ int Read_Ext_Flash_Device_ID() return 0; } -int Erase_Sector_before_writting_To_Ext_Flash(uint32_t ui32Address) +int Erase_Sector_before_writting_To_Ext_Flash(uint32_t ui32Address)// 4Kb every 100h is sector (0-0xFFF, 0x1000-0x1fff,..) { SSILibSendEraseCommand(SSI3_BASE,ui32Address,INS_SECTOR_ERASE_4KB); return 0; } +int Erase_Block(uint32_t ui32Address)// 32Kb or 64Kb ? +{ + //writeLine("Starting Erase Block Operations..."); + + + SSILibSendEraseCommand(SSI3_BASE,ui32Address,INS_BLOCK_ERASE ); + + //writeLine("Erase Block Completed..."); + + return 0; +} + +int Erase_Chip()// 32Kb or 64Kb ? +{ + //writeLine("Starting Erase Block Operations..."); + + SSILibSendEraseCommand(SSI3_BASE,0,INS_CHIP_ERASE ); + + //writeLine("Erase Block Completed..."); + + return 0; +} + int Write_Words_To_Ext_Flash(uint32_t ui32Address, uint32_t NumOfWords, uint32_t* TxBuf) { @@ -714,7 +748,8 @@ int Ext_Flash_Operation(uint32_t ui32Address,uint32_t Operation, uint32_t NumOf Display_RX_TX_Ext_Flash_Data(NumOfWords, pui32DataTx, NULL); // Erase the Sector before Program Operation... - Erase_Sector_before_writting_To_Ext_Flash(ui32Address); + Erase_Sector_before_writting_To_Ext_Flash(ui32Address);//Erase all the sector not only from this address + //Erase_Block(ui32Address);//Added by AVI for testing // Write NUM_SSI_DATA words to the External Flash Write_Words_To_Ext_Flash(ui32Address, NumOfWords, pui32DataTx); @@ -750,7 +785,7 @@ Flash_Union Flash_RW; uint32_t WriteBuf[MaxFlashBytes]; uint32_t ReadBuf[MaxFlashBytes]; - +/* uint32_t ExtFlashWriteBuf(uint32_t ui32Address,uint32_t NumOfWords, uint32_t* pui32DataTx) { static uint32_t AddressCounter = 0; @@ -795,9 +830,63 @@ uint32_t ExtFlashWriteBuf(uint32_t ui32Address,uint32_t NumOfWords, uint32_t* p Ext_Flash_Operation(0X00 + (0X100*AddressCounter), TX, No_Bytes , WriteBuf, NULL );////always use address 0 and handle the add by the AddressCounter } - return return_start_address; + return return_start_address;// for reading what we just wrote } +*/ + +uint32_t ExtFlashWriteBuf(/*uint32_t ui32Address,*/uint32_t NumOfWords, uint32_t* pui32DataTx)//ui32Address not in use +{ + uint32_t AddressCounter = 0; + uint32_t i; + uint32_t No_Bytes; + + static uint32_t Current_Start_address = 0x00; + uint32_t Save_Current_Start_address = 0x00; + + assert(NumOfWords <= MaxFlashWords); + + No_Bytes = NumOfWords *4; + + uint32_t Current_End_address = Current_Start_address + No_Bytes; + + memset(&Flash_RW,0,sizeof(Flash_RW)); + + for(i = 0; i < NumOfWords;i++) + { + Flash_RW.DWords[i] = pui32DataTx[i]; + } + + for(i = 0; i < No_Bytes;i++) + { + WriteBuf[i] = Flash_RW.Bytes[i]; + } + + if(No_Bytes >MaxBytesForAddress) + { + uint32_t number = No_Bytes / MaxBytesForAddress; + uint32_t Remainder = No_Bytes % MaxBytesForAddress; + + for(i=0;i<number;i++,AddressCounter++) + { + Ext_Flash_Operation(Current_Start_address + (0X100*AddressCounter) , TX, MaxBytesForAddress , WriteBuf+ (MaxBytesForAddress*i), NULL ); //always use address 0 and handle the add by the AddressCounter + } + if(Remainder) + { + Ext_Flash_Operation(Current_Start_address + (0X100*AddressCounter) , TX, Remainder , WriteBuf+ (MaxBytesForAddress*i), NULL );////always use address 0 and handle the add by the AddressCounter + } + } + else + { + Ext_Flash_Operation(Current_Start_address, TX, No_Bytes , WriteBuf, NULL );////always use address 0 and handle the add by the AddressCounter + } + + Save_Current_Start_address = Current_Start_address; + + Current_Start_address = Current_End_address;// for the next time + + return Save_Current_Start_address;// for reading the data that we just wrote +} uint32_t* ExtFlashReadBuf(uint32_t ui32Address,uint32_t NumOfWords ) @@ -805,7 +894,7 @@ uint32_t* ExtFlashReadBuf(uint32_t ui32Address,uint32_t NumOfWords ) uint32_t No_Bytes; - static uint32_t AddressCounter = 0; + uint32_t AddressCounter = 0; uint32_t i = 0; assert(NumOfWords <= MaxFlashWords); @@ -830,7 +919,7 @@ uint32_t* ExtFlashReadBuf(uint32_t ui32Address,uint32_t NumOfWords ) } else { - Ext_Flash_Operation(ui32Address + (0X100*AddressCounter), RX, No_Bytes, NULL, ReadBuf ); + Ext_Flash_Operation(ui32Address, RX, No_Bytes, NULL, ReadBuf ); } for(i = 0; i < No_Bytes;i++) diff --git a/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/Flash_Memory.h b/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/Flash_Memory.h index e0f9eb9f7..cca2cd848 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/Flash_Memory.h +++ b/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/Flash_Memory.h @@ -4,7 +4,7 @@ int Ext_Flash_Operation(); int FlashFS_Init(); -uint32_t ExtFlashWriteBuf(uint32_t ui32Address,uint32_t NumOfWords, uint32_t* pui32DataTx); +uint32_t ExtFlashWriteBuf(/*uint32_t ui32Address,*/uint32_t NumOfWords, uint32_t* pui32DataTx); uint32_t* ExtFlashReadBuf(uint32_t ui32Address,uint32_t NumOfWords ); extern Flash_Union Flash_RW; diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.h b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.h index c6b69a697..44fa4fef7 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.h +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/DAC/Blower.h @@ -8,10 +8,6 @@ #ifndef DRIVERS_I2C_COMMUNICATION_DAC_BLOWER_H_ #define DRIVERS_I2C_COMMUNICATION_DAC_BLOWER_H_ -uint32_t Turn_the_Blower_On(); -uint32_t Control_Voltage_To_Blower(uint32_t mV); -uint32_t Turn_the_Blower_Off(); - #define I2C_DAC_ADDRESS 0x98 @@ -24,7 +20,7 @@ uint32_t Turn_the_Blower_Off(); #define AD5691R_DONT_CARE_DATA_BYTE 0x00 -#define Default_Voltage 4000 //4V +#define Default_Voltage 3000 //4V #define DAC_I2C_BASE 2 @@ -51,6 +47,12 @@ typedef union #define AD5691R_Control_Reference_Disabled 0x10 #define AD5691R_Control_Gain_0V_VREF 0x00 #define AD5691R_Control_Gain_0V_2VREF 0x08 + +uint32_t Turn_the_Blower_On(); +uint32_t Control_Voltage_To_Blower(uint32_t mV); +uint32_t Turn_the_Blower_Off(); + + #endif /* DRIVERS_I2C_COMMUNICATION_DAC_BLOWER_H_ */ diff --git a/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.c b/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.c index 0557eac62..b72b40fc4 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.c +++ b/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.c @@ -45,7 +45,7 @@ SPI MotFPGA_Spi; MotorDriverResponseStruct MotorDriverResponse[NUM_OF_MOTORS]; MotorDriverRequestStruct MotorDriverRequest[NUM_OF_MOTORS]; - +bool MotorConfigState[NUM_OF_MOTORS]; //MotorDriverConfigStruc MotorsCfg[NUM_OF_MOTORS]; TimerMotors_t FastMotorToMotorId[4] = {HARDWARE_MOTOR_TYPE__MOTO_RDRIVING,HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING,HARDWARE_MOTOR_TYPE__MOTO_LDRIVING,HARDWARE_MOTOR_TYPE__MOTO_WINDER}; callback_fptr MotorMoveModuleCallback[NUM_OF_MOTORS]; @@ -79,6 +79,7 @@ uint32_t MotorsInit(void) #endif for (i=0;i<NUM_OF_MOTORS;i++) { + MotorConfigState[i] = false; MotorMoveControlId[i] = 0xFF; MotorSetSpeedControlId[i] = 0xFF; MotorMovetoLimitSwitchControlId[i] = 0xFF; @@ -97,10 +98,16 @@ uint32_t MotorConfig(TimerMotors_t _motorId, MotorDriverConfigStruc *MotorConfig setup(MotorConfig); return OK; #else + MotorConfigState[_motorId] = true; return FPGA_MotorConfig( _motorId, MotorConfig); #endif } +bool isMotorConfigured(TimerMotors_t _motorId) +{ + return MotorConfigState[_motorId]; +} + TimerMotors_t getMotorId(int FastMotorId) { diff --git a/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.h b/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.h index 5c0729f69..05c990de9 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.h +++ b/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.h @@ -18,7 +18,7 @@ #define TimerMotors_t HardwareMotorType -#define NUM_OF_MOTORS HARDWARE_MOTOR_TYPE__MOTO_SPARE2_2 + 1 // TODO After the integration with mulbery change to: +#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 @@ -108,6 +108,8 @@ uint32_t MotorsInit(void); //set the motor configuration uint32_t MotorConfig(TimerMotors_t _motorId, MotorDriverConfigStruc *MotorConfig); +bool isMotorConfigured(TimerMotors_t _motorId); + TimerMotors_t getMotorId(int FastMotorId); uint32_t MotorGetDirection(TimerMotors_t _motorId); diff --git a/Software/Embedded_SW/Embedded/Drivers/USB_Communication/USBCDCD.c b/Software/Embedded_SW/Embedded/Drivers/USB_Communication/USBCDCD.c index 1dfcfbfad..04561139e 100644 --- a/Software/Embedded_SW/Embedded/Drivers/USB_Communication/USBCDCD.c +++ b/Software/Embedded_SW/Embedded/Drivers/USB_Communication/USBCDCD.c @@ -56,7 +56,6 @@ typedef unsigned long USBCDCDEventType; #endif /* Defines */ -#define USBBUFFERSIZE 256 //**************************************************************************** // // A buffer into which the composite device can write the combined config @@ -79,8 +78,9 @@ typedef volatile enum { /* Static variables and handles */ static volatile USBCDCD_USBState state; -static unsigned char receiveBuffer[USBBUFFERSIZE]; -static unsigned char transmitBuffer[USBBUFFERSIZE]; +extern unsigned char CommRxBuffer[COMM_MAX_BUFFER_SIZE]; +//static unsigned char receiveBuffer[COMM_MAX_BUFFER_SIZE]; +static unsigned char transmitBuffer[COMM_MAX_BUFFER_SIZE]; int expected_message_size; int current_message_size; @@ -214,8 +214,8 @@ tUSBBuffer rxBuffer = USBDCDCPacketRead, /* pfnTransfer */ USBDCDCRxPacketAvailable, /* pfnAvailable */ (void *)&g_sCDCDevice, /* pvHandle */ - receiveBuffer, /* pcBuffer */ - USBBUFFERSIZE, /* ulBufferSize */ + CommRxBuffer, /* pcBuffer */ + COMM_MAX_BUFFER_SIZE, /* ulBufferSize */ {{0, 0, 0, 0}, 0, 0} /* private data workspace */ }; @@ -228,7 +228,7 @@ tUSBBuffer txBuffer = USBDCDCTxPacketAvailable, /* pfnAvailable */ (void *)&g_sCDCDevice, /* pvHandle */ transmitBuffer, /* pcBuffer */ - USBBUFFERSIZE, /* ulBufferSize */ + COMM_MAX_BUFFER_SIZE, /* ulBufferSize */ {{0, 0, 0, 0}, 0, 0} /* private data workspace */ }; diff --git a/Software/Embedded_SW/Embedded/Include.h b/Software/Embedded_SW/Embedded/Include.h index 7a9dda68b..d99971021 100644 --- a/Software/Embedded_SW/Embedded/Include.h +++ b/Software/Embedded_SW/Embedded/Include.h @@ -56,6 +56,8 @@ #define PI 3.1415926 +#define COMM_MAX_BUFFER_SIZE 4000 + typedef uint32_t (* callback_fptr)(uint32_t deviceID, uint32_t ReadValue); extern void SysTickHandler(void); diff --git a/Software/Embedded_SW/Embedded/Main.c b/Software/Embedded_SW/Embedded/Main.c index 18852e3fa..4fa7c52b3 100644 --- a/Software/Embedded_SW/Embedded/Main.c +++ b/Software/Embedded_SW/Embedded/Main.c @@ -193,6 +193,10 @@ int main(void) //Write_DAC_and_Input_Register(); +/* + Erase_Chip(); + SysCtlDelay(1000); + Erase_Block(0);*/ //----------------------------------------------------------- #ifndef EVALUATION_BOARD diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c index 8fc36b7f4..f9f075477 100644 --- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c +++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c @@ -361,6 +361,11 @@ uint32_t AlarmHandlingLoop(uint32_t tick) case CurrentAlarm: break; case MotorAlarm: + if (isMotorConfigured(AlarmItem[Alarm_i].DeviceId) == false) + { + Status = false; + break; + } value = MotorGetStatus(AlarmItem[Alarm_i].DeviceId); if (value && AlarmItem[Alarm_i].AlarmValue) // { @@ -441,7 +446,7 @@ uint32_t AlarmHandlingLoop(uint32_t tick) //machine cover open if (tick%eOneSecond == 0) -// SendEventNotifications(); + SendEventNotifications(); return OK; } /****************************************************************************** diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c new file mode 100644 index 000000000..0f36a803b --- /dev/null +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c @@ -0,0 +1,154 @@ +/* + * DiagnosticActions.c + * + * Created on: Aug 20, 2018 + * Author: shlomo + */ +#include <DataDef.h> +#include "include.h" + +#include "diagnostics.h" +#include <inc/hw_ints.h> +#include <Container.h> + +#include <PMR/Diagnostics/SetComponentValueRequest.pb-c.h> +#include <PMR/Diagnostics/SetComponentValueResponse.pb-c.h> + +#include <PMR/Diagnostics/SetDigitalOutRequest.pb-c.h> +#include <PMR/Diagnostics/SetDigitalOutResponse.pb-c.h> + +#include "drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h" +#include "Drivers/I2C_Communication/DAC/blower.h" +#include "drivers/Valves/Valve.h" + +typedef enum +{ + GPO_DILUTORPUMP_SSR10_CTRL, + GPO_WASTECH_PUMP2, + Midtank_1_Air, + Midtank_2_Air, + Midtank_3_Air, + Midtank_4_Air, + Midtank_5_Air, + Midtank_6_Air, + Midtank_7_Air, + Midtank_8_Air, + Midtank_1_Cartridge, + Midtank_2_Cartridge, + Midtank_3_Cartridge, + Midtank_4_Cartridge, + Midtank_5_Cartridge, + Midtank_6_Cartridge, + Midtank_7_Cartridge, + Midtank_8_Cartridge, + GPO_BUZZER, + GPO_LED1, + GPO_LED2, + GPO_LED3, + GPO_LED4, + GPO_TFEED_BREAK_1, + GPO_TFEED_BREAK_2, + GPO_SPARE1_1, + GPO_SPARE1_2, + GPO_SPARE2_1, + GPO_SPARE2_2, + GPO_BLOWER_PWM, + GPO_CHILLER_SSR9_CTRL, + GPO_WHS_WTANKPUMP2, + GPO_VALVE_WASTE_TANK, +}DigitalOutputEnum; +/******************************************************************************** + *Blower Diagnostic + ********************************************************************************/ +uint32_t SetComponentValueRequestRequestFunc(MessageContainer* requestContainer) +{ + MessageContainer responseContainer; + uint8_t* container_buffer; + uint32_t status = 0; + uint32_t intvoltage; + SetComponentValueRequest* request = set_component_value_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data); + + + + SetComponentValueResponse response = SET_COMPONENT_VALUE_RESPONSE__INIT; + + responseContainer = createContainer(MESSAGE_TYPE__SetComponentValueResponse, requestContainer->token, true, &response, &set_component_value_response__pack, &set_component_value_response__get_packed_size); + container_buffer = malloc(message_container__get_packed_size(&responseContainer)); + + + switch (request->component) + { + case VALUE_COMPONENT__BlowerVoltage: + blowervolatgedisplay = true; + voltage = request->value; + if (voltage == 0.0) + Turn_the_Blower_Off(); + else + { + Turn_the_Blower_On(); + intvoltage = voltage; + Control_Voltage_To_Blower(intvoltage); + } + break; + default: + break; + } + + size_t container_size = message_container__pack(&responseContainer, container_buffer); + free(responseContainer.data.data); + SendChars(container_buffer, container_size); + //free(container_buffer); + //free(requestContainer); + set_component_value_request__free_unpacked(request,NULL); + + return OK; +} + +/******************************************************************************** + *Set digital output Diagnostic + ********************************************************************************/ +uint32_t SetDigitalOutRequestRequestFunc(MessageContainer* requestContainer) +{ + MessageContainer responseContainer; + uint8_t* container_buffer; + uint32_t status = 0; + int portId; + SetDigitalOutRequest* request = set_digital_out_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data); + + + + SetDigitalOutResponse response = SET_DIGITAL_OUT_RESPONSE__INIT; + + responseContainer = createContainer(MESSAGE_TYPE__SetDigitalOutResponse, requestContainer->token, true, &response, &set_digital_out_response__pack, &set_digital_out_response__get_packed_size); + container_buffer = malloc(message_container__get_packed_size(&responseContainer)); + + + if ((request->port >= Midtank_1_Air)&&(request->port >=Midtank_8_Air)) + { + portId = (request->port - Midtank_1_Air) ; //0-7 + Valve_Set((Valves_t) (portId+VALVE_2W_MID_AIR_LF), request->value ); //Atm_MidTank_OFF/ON + } + else if ((request->port >= Midtank_1_Cartridge)&&(request->port >=Midtank_8_Cartridge)) + { + portId = (request->port - Midtank_1_Cartridge) ; //0-7 + Valve_Set((Valves_t) (portId+VALVE_2W_CART_MID_LF), request->value ); //Cartridge_MidTank_OFF/ON + } + else + { + status = ERROR; + responseContainer.has_error = true; + responseContainer.error = ERROR_CODE__INVALID_DIGITAL_PIN_NUMBER; + } + + size_t container_size = message_container__pack(&responseContainer, container_buffer); + free(responseContainer.data.data); + SendChars(container_buffer, container_size); + //free(container_buffer); + //free(requestContainer); + set_digital_out_request__free_unpacked(request,NULL); + + return OK; +} + + + diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.h b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.h index 82d267bd6..3fc0969f8 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.h +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.h @@ -34,6 +34,7 @@ uint32_t MotorAbortJoggingRequestFunc(MessageContainer* requestContainer); uint32_t DispenserAbortJoggingRequestFunc(MessageContainer* requestContainer); uint32_t SetComponentValueRequestRequestFunc(MessageContainer* requestContainer); +uint32_t SetDigitalOutRequestRequestFunc(MessageContainer* requestContainer); diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c index bb8da0b2e..af8932872 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c @@ -59,11 +59,6 @@ FPGA_GPI_ENUM Motor_Id_to_LS_Id[NUM_OF_MOTORS] = { MAX_GPI, //MOTO_RDRIVING = 22, GPI_LS_RLOADRAM_UP, //MOTO_RLOADARM = 23, GPI_LS_RLOADMOTOR_DOWN, //MOTO_RLOADING = 24, - MAX_GPI, //MOTO_SPARE1_1 = 25, - MAX_GPI, //MOTO_SPARE1_2 = 26, - MAX_GPI, //MOTO_SPARE2_1 = 27, - MAX_GPI, //MOTO_SPARE2_2 = 28 - }; typedef enum { MotorHomingDirectionUp, @@ -97,11 +92,6 @@ MotorHomingDirectionEnum Motor_Id_to_LS_Direction[NUM_OF_MOTORS] = { MotorHomingDirectionNoHoming, //MOTO_RDRIVING = 22, MotorHomingDirectionUp, //MOTO_RLOADARM = 23, MotorHomingDirectionDown, //MOTO_RLOADING = 24, - MotorHomingDirectionNoHoming, //MOTO_SPARE1_1 = 25, - MotorHomingDirectionNoHoming, //MOTO_SPARE1_2 = 26, - MotorHomingDirectionNoHoming, //MOTO_SPARE2_1 = 27, - MotorHomingDirectionNoHoming, //MOTO_SPARE2_2 = 28 - }; char HomingToken[NUM_OF_MOTORS][36+1]={0}; @@ -138,7 +128,7 @@ uint32_t MotorHomingRequestFunc(MessageContainer* requestContainer) if (speed == 0) speed = 150; if (MotorId <= NUM_OF_MOTORS) { - if (JobIsActive() == false) + if ((JobIsActive() == false)&&(isMotorConfigured(MotorId) == true)) { if ( Motor_Id_to_LS_Id[MotorId] != MAX_GPI) { @@ -230,7 +220,7 @@ uint32_t DispenserHomingRequestFunc(MessageContainer* requestContainer) //free (container_buffer); if (MotorId <= NUM_OF_MOTORS) { - if (JobIsActive() == false) + if ((JobIsActive() == false)&&(isMotorConfigured(MotorId) == true)) { if ( Motor_Id_to_LS_Id[MotorId] != MAX_GPI) { diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsJogging.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsJogging.c index cf341b9a9..32e76cbde 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsJogging.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsJogging.c @@ -32,13 +32,9 @@ #include <PMR/Diagnostics/MotorAbortJoggingRequest.pb-c.h> #include <PMR/Diagnostics/MotorAbortJoggingResponse.pb-c.h> -#include <PMR/Diagnostics/SetComponentValueRequest.pb-c.h> -#include <PMR/Diagnostics/SetComponentValueResponse.pb-c.h> - #include "drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h" #include "drivers/Motors/Motor.h" #include "drivers/Valves/Valve.h" -#include "Drivers/I2C_Communication/DAC/blower.h" #include "StateMachines/Printing/PrintingSTM.h" @@ -63,7 +59,7 @@ uint32_t MotorJoggingRequestFunc(MessageContainer* requestContainer) if (MotorId <= NUM_OF_MOTORS) { - if (JobIsActive() == false) + if ((JobIsActive() == false)&&(isMotorConfigured(MotorId) == true)) { { switch (request->direction) @@ -149,7 +145,7 @@ uint32_t DispenserJoggingRequestFunc(MessageContainer* requestContainer) if (MotorId <= NUM_OF_MOTORS) { - if (JobIsActive() == false) + if ((JobIsActive() == false)&&(isMotorConfigured(MotorId) == true)) { switch (request->direction) { @@ -212,51 +208,4 @@ uint32_t DispenserAbortJoggingRequestFunc(MessageContainer* requestContainer) return OK; } -/******************************************************************************** - *Blower Diagnostic - ********************************************************************************/ -uint32_t SetComponentValueRequestRequestFunc(MessageContainer* requestContainer) -{ - MessageContainer responseContainer; - uint8_t* container_buffer; - uint32_t status = 0; - uint32_t intvoltage; - SetComponentValueRequest* request = set_component_value_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data); - - - - SetComponentValueResponse response = SET_COMPONENT_VALUE_RESPONSE__INIT; - - responseContainer = createContainer(MESSAGE_TYPE__SetComponentValueResponse, requestContainer->token, true, &response, &set_component_value_response__pack, &set_component_value_response__get_packed_size); - container_buffer = malloc(message_container__get_packed_size(&responseContainer)); - - - switch (request->component) - { - case VALUE_COMPONENT__BlowerVoltage: - blowervolatgedisplay = true; - voltage = request->value; - if (voltage == 0.0) - Turn_the_Blower_Off(); - else - { - Turn_the_Blower_On(); - intvoltage = voltage; - Control_Voltage_To_Blower(intvoltage); - } - break; - default: - break; - } - - size_t container_size = message_container__pack(&responseContainer, container_buffer); - free(responseContainer.data.data); - SendChars(container_buffer, container_size); - //free(container_buffer); - //free(requestContainer); - set_component_value_request__free_unpacked(request,NULL); - - return OK; -} - diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_init.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_init.c index 185d4ac66..b035ff97b 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_init.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_init.c @@ -69,6 +69,8 @@ float CalculateDispenserPressure (int DispenserId) //DispenserPressure[DispenserId] *=10000000; //uBar; //DispenserPressure[DispenserId] *=145.0377; //PSI; + DispenserPressure[DispenserId] *= 10; //MPascal -> Bar + return(DispenserPressure[DispenserId]); } diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Cartridge.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Cartridge.c index 581a27f1f..68b79edeb 100644 --- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Cartridge.c +++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Cartridge.c @@ -12,7 +12,7 @@ #include "Drivers/USB_Communication/USBCDCD.h" - +//#include "drivers/twine_graphicslib/graphics_adapter.h" #include "Stub_Status.h" @@ -25,6 +25,20 @@ void Stub_CartridgeReadRequest(MessageContainer* requestContainer) //request->cartridgeid + //writeLine("cartridge Request: "); + + //writeFloat(request->cartridgeid); + + /* + int i; + for( i=0;i<8;i++) + { + Read_MidTank_Pressure_Sensor(i); + SysCtlDelay(1); + } + + */ + StubCartridgeReadResponse response = STUB_CARTRIDGE_READ_RESPONSE__INIT; response.cartridgeid = request->cartridgeid; @@ -43,8 +57,20 @@ void Stub_CartridgeReadRequest(MessageContainer* requestContainer) response.has_cartridgeused = false; status_response(status,&response.status, &response.statusword ,&response.has_statusword); +/* + writeLine("Sending Response: "); - + writeFloat(response.cartridgeid); + writeString(", "); + writeFloat(response.cartridgecolor); + writeString(", "); + writeFloat(response.cartridgeversion); + writeString(", "); + writeFloat(response.cartridgedata); + writeString(", "); + writeFloat(response.cartridgeused); + writeString(", "); +*/ Write_status_response(status); responseContainer = createContainer(MESSAGE_TYPE__StubCartridgeReadResponse, requestContainer->token, true, &response, &stub_cartridge_read_response__pack, &stub_cartridge_read_response__get_packed_size); @@ -71,8 +97,19 @@ void Stub_CartridgeWriteRequest(MessageContainer* requestContainer) //request->cartridgeversion //request->cartridgedata //request->cartridgeused +/* + writeLine("Cartridge Request: "); - + writeFloat(request->cartridgeid); + writeString(", "); + writeFloat(request->cartridgecolor); + writeString(", "); + writeFloat(request->cartridgeversion); + writeString(", "); + writeFloat(request->cartridgedata); + writeString(", "); + writeFloat(request->cartridgeused); +*/ StubCartridgeWriteResponse response = STUB_CARTRIDGE_WRITE_RESPONSE__INIT; response.cartridgeid = request->cartridgeid; @@ -83,7 +120,13 @@ void Stub_CartridgeWriteRequest(MessageContainer* requestContainer) // response.statusword = OK; // response.has_statusword = true; status_response(status,&response.status, &response.statusword ,&response.has_statusword); +/* + writeLine("Sending Response: "); + writeFloat(response.cartridgeid); + writeString(", ");*/ +// writeFloat(response.statusword); +// WRITELINESTATUS; Write_status_response(status); responseContainer = createContainer(MESSAGE_TYPE__StubCartridgeWriteResponse, requestContainer->token, true, &response, &stub_cartridge_write_response__pack, &stub_cartridge_write_response__get_packed_size); diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Dispenser.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Dispenser.c index 0bcc9f7c9..7c0a4c980 100644 --- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Dispenser.c +++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Dispenser.c @@ -9,6 +9,7 @@ #include "Drivers/USB_Communication/USBCDCD.h" #include "drivers/adc_sampling/adc.h" +#include "modules/ids/ids_ex.h" diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_ExtFlash.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_ExtFlash.c index f478e9428..51c92ed8c 100644 --- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_ExtFlash.c +++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_ExtFlash.c @@ -300,10 +300,10 @@ void Stub_ExtFlashWriteWordsRequest(MessageContainer* requestContainer) StubExtFlashWriteWordsResponse response = STUB_EXT_FLASH_WRITE_WORDS_RESPONSE__INIT; - response.address = 0;// alwayes send sddress 0 - response.has_address = true; + uint32_t Current_Start_address = ExtFlashWriteBuf(/*0,*/request->n_wordtwrite, request->wordtwrite);// alwayes send sddress 0 - uint32_t Address = ExtFlashWriteBuf(0,request->n_wordtwrite, request->wordtwrite);// alwayes send sddress 0 + response.address = Current_Start_address; + response.has_address = true; status_response(status,&response.status, &response.statusword ,&response.has_statusword); @@ -331,6 +331,9 @@ void Stub_ExtFlashReadWordsRequest(MessageContainer* requestContainer) response.readbytes = ExtFlashReadBuf(request->address,request->number_of_words); response.n_readbytes = request->number_of_words; + response.address = request->address; + response.has_address = true; + status_response(status,&response.status, &response.statusword ,&response.has_statusword); responseContainer = createContainer(MESSAGE_TYPE__StubExtFlashReadWordsResponse, requestContainer->token, true, &response, &stub_ext_flash_read_words_response__pack, &stub_ext_flash_read_words_response__get_packed_size); diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_SpeedSensor.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_SpeedSensor.c index a433be2ce..eea594817 100644 --- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_SpeedSensor.c +++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_SpeedSensor.c @@ -34,6 +34,7 @@ #include "drivers/SPI/SPI_Comm.h" #include "drivers/FPGA/FPGA_SSI_Comm.h" #include "Modules/Thread/Thread_ex.h" +#include <Drivers/SSI_Comm/Speed_Sensor/Speed_Sensor.h> #include "Modules/thread/thread.h" diff --git a/Software/Stubs Collection/stubs/Ext_Flash_RW_Buf.cs b/Software/Stubs Collection/stubs/Ext_Flash_RW_Buf.cs index e10e2e32b..dc4b1059d 100644 --- a/Software/Stubs Collection/stubs/Ext_Flash_RW_Buf.cs +++ b/Software/Stubs Collection/stubs/Ext_Flash_RW_Buf.cs @@ -10,8 +10,8 @@ using System.Collections.Generic; using Tango.PMR.Stubs; using Tango.Stubs; -const Int32 No_Words = 1024;//1024 -uint Delta = 10000; //4000000000 +const Int32 No_Words = 128;//MaxFlashWords limited in datadef to 128 //1024 +uint Delta = 0; //4000000000 public void OnExecute(StubManager stubManager) { @@ -50,7 +50,7 @@ public void OnExecute(StubManager stubManager) // --------------------- Flash Read multibyte --------------------- StubExtFlashReadWordsRequest stubExtFlashReadWordsRequest = new StubExtFlashReadWordsRequest(); - stubExtFlashReadWordsRequest.Address = 0; + stubExtFlashReadWordsRequest.Address = response.Address; stubExtFlashReadWordsRequest.NumberOfWords = No_Words; // Number of words to read var response1 = stubManager.Run<StubExtFlashReadWordsResponse>(stubExtFlashReadWordsRequest); |
