diff options
| author | Avi Levkovich <avi@twine-s.com> | 2019-10-30 17:55:04 +0200 |
|---|---|---|
| committer | Avi Levkovich <avi@twine-s.com> | 2019-10-30 17:55:04 +0200 |
| commit | cc657620eac3b626cf0790802c2a5ae3196c396b (patch) | |
| tree | e68d3edc86aced2e96afa173341b854506c8e443 /Software/Embedded_SW/Embedded | |
| parent | abc09fbcd0a9c0883b957378d71679be776b6f56 (diff) | |
| download | Tango-cc657620eac3b626cf0790802c2a5ae3196c396b.tar.gz Tango-cc657620eac3b626cf0790802c2a5ae3196c396b.zip | |
driver for head card fans
Diffstat (limited to 'Software/Embedded_SW/Embedded')
| -rw-r--r-- | Software/Embedded_SW/Embedded/.cproject | 6 | ||||
| -rw-r--r-- | Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c | 4 | ||||
| -rw-r--r-- | Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/Fan/Head_Fan.c | 2 | ||||
| -rw-r--r-- | Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/Fan/Head_Fan.h | 59 | ||||
| -rw-r--r-- | Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/Fan/fan_click.c | 290 | ||||
| -rw-r--r-- | Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/Fan/fan_click.h | 811 | ||||
| -rw-r--r-- | Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/I2C_Head_Mux.h | 2 | ||||
| -rw-r--r-- | Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c | 16 | ||||
| -rw-r--r-- | Software/Embedded_SW/Embedded/src/makefile.libs | 6 | ||||
| -rw-r--r-- | Software/Embedded_SW/Embedded/src/sysbios/makefile | 24 | ||||
| -rw-r--r-- | Software/Embedded_SW/Embedded/src/sysbios/sysbios.aem4f | bin | 1817078 -> 1817446 bytes | |||
| -rw-r--r-- | Software/Embedded_SW/Embedded/temp/EmbParam.cfg | bin | 252 -> 0 bytes |
12 files changed, 1199 insertions, 21 deletions
diff --git a/Software/Embedded_SW/Embedded/.cproject b/Software/Embedded_SW/Embedded/.cproject index bbec72ab4..1998a5e88 100644 --- a/Software/Embedded_SW/Embedded/.cproject +++ b/Software/Embedded_SW/Embedded/.cproject @@ -170,7 +170,7 @@ </toolChain> </folderInfo> <sourceEntries> - <entry excluding="EmbParam.cfg|src" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> + <entry excluding="EmbParam.cfg" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> </sourceEntries> </configuration> </storageModule> @@ -269,7 +269,7 @@ </toolChain> </folderInfo> <sourceEntries> - <entry excluding="EmbParam.cfg|src" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> + <entry excluding="Embedded.cfg|EmbParam.cfg|src" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> </sourceEntries> </configuration> </storageModule> @@ -441,7 +441,7 @@ </toolChain> </folderInfo> <sourceEntries> - <entry excluding="EmbParam.cfg|Drivers/Uart_Comm/Uart.c|JigCommands.c|PWM.c|USBCDCD.c|Message.c|Pin_config.c|src|Configuration.c|SlowMotors.c|Timer.c|Communication.c|FastMotors.c|ADCUtils.c|Drivers/L6470|Pin.c|ADCLogger.c|Flashstore.c|Profile.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> + <entry excluding="Embedded.cfg|EmbParam.cfg|Drivers/Uart_Comm/Uart.c|JigCommands.c|PWM.c|USBCDCD.c|Message.c|Pin_config.c|src|Configuration.c|SlowMotors.c|Timer.c|Communication.c|FastMotors.c|ADCUtils.c|Drivers/L6470|Pin.c|ADCLogger.c|Flashstore.c|Profile.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> </sourceEntries> </configuration> </storageModule> 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 9fb1291be..3f86024ba 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c @@ -428,11 +428,13 @@ void FPGA_SetMotorsInit() for(i=0;i<NUM_OF_MOTORS;i++) { + //----------------------------------------------------------------------------- + #warning doesn't work with powerstep01 need to change !!! if(MotorDriverResponse[i].DriverType == UnKnownMotDriver) { Read_Motors_Driver_Type(i);//to choose the correct SPI direction before sending HIZ } - + //------------------------------------------------------------------------- MotorDriverRequest[i].Stop = Hard_Hiz; FPGA_SetMotStop((HardwareMotorType)i); } diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/Fan/Head_Fan.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/Fan/Head_Fan.c index f626adc47..c18dc3be3 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/Fan/Head_Fan.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/Fan/Head_Fan.c @@ -18,6 +18,6 @@ https://github.com/TekkaTim/esp32_learning/blob/master/lib/EMC2302.py */ //FAN EMC2302-1-AIZL -uint32_t I2C_HEAD_FAN_SLAVE_ADD = 0x5C; + diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/Fan/Head_Fan.h b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/Fan/Head_Fan.h index dcb62f7e7..93c795fdf 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/Fan/Head_Fan.h +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/Fan/Head_Fan.h @@ -8,8 +8,67 @@ #ifndef DRIVERS_I2C_COMMUNICATION_HEAD_CARD_FAN_HEAD_FAN_H_ #define DRIVERS_I2C_COMMUNICATION_HEAD_CARD_FAN_HEAD_FAN_H_ +typedef struct +{ + //Configuration and control + uint8_t Configuration ; + uint8_t Fan_Status ; + uint8_t Fan_Stall_Status ; + uint8_t Fan_Spin_Status ; + uint8_t Drive_Fail_Status ; + uint8_t Fan_Interrupt_Enable ; + uint8_t PWM_Polarity_Config ; + uint8_t PWM_Output_Config ; + uint8_t PWM_Base_Freq ; + //Fan 1 & 2 Control Registers + uint8_t Fan_Setting[2] ; + uint8_t PWM_Divide[2] ; + uint8_t FanConfig_1[2] ; + uint8_t FanConfig_2[2] ; + uint8_t Gain[2] ; + uint8_t FanSpin_Up_Config[2] ; + uint8_t FanMax_Step[2] ; + uint8_t FanMinimum_Drive[2] ; + uint8_t FanValid_TACH_Count[2] ; + uint8_t FanDrive_Fail_Low[2] ; + uint8_t FanDrive_Fail_High[2] ; + uint8_t TACHTarget_Low[2] ; + uint8_t TACHTarget_High[2] ; + uint16_t TACHReading_High[2] ; + uint8_t TACHReading_Low[2] ; + //Lock Register + uint8_t Software_Lock ; + //Revision Registers + uint8_t Product_ID ; + uint8_t Manufacturer_ID ; + uint8_t Revision ; +}EMC2302_Register; +#define EMC2302_Size sizeof(EMC2302_Register)//43 +typedef struct +{ + uint8_t Product_ID; + uint8_t Manufactuere_ID; + uint8_t Revision; +}FAN_CLICK_INFO; + +typedef union +{ + EMC2302_Register Reg; + uint8_t Buf[EMC2302_Size]; +}EMC2302_READ; + +typedef union +{ + EMC2302_Register Reg; + uint8_t Buf[EMC2302_Size]; +}EMC2302_WRITE; + +void Test_fan_Click(); + +extern FAN_CLICK_INFO Fan_Click_Info; +extern EMC2302_READ EMC2302_Read; #endif /* DRIVERS_I2C_COMMUNICATION_HEAD_CARD_FAN_HEAD_FAN_H_ */ diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/Fan/fan_click.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/Fan/fan_click.c new file mode 100644 index 000000000..edf4fdc93 --- /dev/null +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/Fan/fan_click.c @@ -0,0 +1,290 @@ +/* + * fan_click.c + * + * Created on: Oct 27, 2019 + * Author: avi + * + * STUB: haed_card_fan_test + * var response = stubManager.Run<ProgressResponse>("ProgressRequest" ,0xfac, 0x00);//Fan Click Head Card , Fan 1 Setting - 0xFF Full PWM 0x80 = 50% FF = 100% 0 - STOP + * stubManager.WriteLineHex(response.Progress,2);//100% = 0xDC0, 50% = 0x1790, 0% = 0xFFF0 + */ + +/****************************************************************************** +* Includes +*******************************************************************************/ +#include "include.h" +#include "fan_click.h" +#include "Head_Fan.h" +#include "../I2C_Head_Mux.h" +#include <Drivers/I2C_Communication/I2C.h> + + +/****************************************************************************** +* Module Variable Definitions +*******************************************************************************/ +uint8_t readbuffer[2]; +uint8_t writebuffer[2]; + + +uint32_t I2C_HEAD_FAN_SLAVE_ADD = 0x5E;// << 1; + + +FAN_CLICK_INFO Fan_Click_Info; + +uint16_t Head_Fan_Tach[2] = {0,0}; + + +uint8_t Head_Fan_PWM_1_Command = 0; + + + +EMC2302_READ EMC2302_Read; + + + +EMC2302_WRITE EMC2302_Write; + +uint8_t EMC2302_Reg_Add[EMC2302_Size] = { +0x20,0x24,0x25,0x26,0x27,0x29,0x2A,0x2B,0x2D, +0x30,0x40,0x31,0x41,0x32,0x42,0x33,0x43,0x35,0x45,0x36,0x46,0x37,0x47,0x38,0x48,0x39,0x49,0x3A,0x4A,0x3B,0x4B,0x3C,0x4C,0x3D,0x4D,0x3E,0x4E,0x3F,0x4F, +0xEF,0xFD,0xFE,0xFF}; + +/****************************************************************************** +* Function Definitions +*******************************************************************************/ + + + + +uint8_t Fan_PWM_Polarity_Config() +{ + uint8_t status = ERROR; + + if(EMC2302_Write.Reg.PWM_Polarity_Config <=0x03)//Bit0 invert PWM1, Bit2 invert PWM2 + { + writebuffer[0] = EMC2301_PWM_POLARITY; + writebuffer[1] = EMC2302_Write.Reg.PWM_Polarity_Config;; + status = I2C_Write(I2C_ID_HEAD_CARD, I2C_HEAD_FAN_SLAVE_ADD, writebuffer, 2); + } + return status; +} + +uint8_t Fan_PWM_Output_Config() +{ + uint8_t status = ERROR; + + if(EMC2302_Write.Reg.PWM_Output_Config <=0x03)//Bit0 Output PWM1, Bit2 Output PWM2, 0 open drain, 1 push-pull + { + writebuffer[0] = EMC2301_PWM_OUTPUT_CONFIG; + writebuffer[1] = EMC2302_Write.Reg.PWM_Output_Config;; + status = I2C_Write(I2C_ID_HEAD_CARD, I2C_HEAD_FAN_SLAVE_ADD, writebuffer, 2); + } + return status; +} + +uint8_t Fan_PWM_Base_Frequency() +{ + uint8_t status = ERROR; + + if( EMC2302_Write.Reg.PWM_Base_Freq <= ((FAN_FREQ_2_441HZ << 2) | FAN_FREQ_2_441HZ)) + { + writebuffer[0] = EMC2301_PWM_BASE_FREQ; + writebuffer[1] = EMC2302_Write.Reg.PWM_Base_Freq; + status = I2C_Write(I2C_ID_HEAD_CARD, I2C_HEAD_FAN_SLAVE_ADD, writebuffer, 2); + } + return status; +} + +uint8_t Fan_Setting(bool Fan) +{ + uint8_t status = ERROR; + + if(Fan == 0) + { + writebuffer[0] = EMC2301_FAN_1_SETTING; + writebuffer[1] = EMC2302_Write.Reg.Fan_Setting[0]; + } + else + { + writebuffer[0] = EMC2301_FAN_2_SETTING; + writebuffer[1] = EMC2302_Write.Reg.Fan_Setting[1]; + } + + status = I2C_Write(I2C_ID_HEAD_CARD, I2C_HEAD_FAN_SLAVE_ADD, writebuffer, 2); + + return status; +} + +uint8_t Fan_Read_Tacho(bool Fan) +{ + uint8_t status = ERROR; + + if(Fan == 0) + { + writebuffer[0] = EMC2301_TACH_1_READING_HIGH; + status = I2C_Write(I2C_ID_HEAD_CARD, I2C_HEAD_FAN_SLAVE_ADD, writebuffer, 1); + delayUs(10);//TODO - check the delay + status |= I2C_Read(I2C_ID_HEAD_CARD, I2C_HEAD_FAN_SLAVE_ADD + 1, readbuffer, 1); + EMC2302_Read.Reg.TACHReading_High[0] = readbuffer[0]; + + writebuffer[0] = EMC2301_TACH_1_READING_LOW; + status = I2C_Write(I2C_ID_HEAD_CARD, I2C_HEAD_FAN_SLAVE_ADD, writebuffer, 1); + delayUs(10);//TODO - check the delay + status |= I2C_Read(I2C_ID_HEAD_CARD, I2C_HEAD_FAN_SLAVE_ADD + 1, readbuffer, 1); + EMC2302_Read.Reg.TACHReading_Low[0] = readbuffer[0]; + + Head_Fan_Tach[0] = (EMC2302_Read.Reg.TACHReading_High[0] << 8) | EMC2302_Read.Reg.TACHReading_Low[0]; + } + else + { + writebuffer[0] = EMC2301_TACH_2_READING_HIGH; + status = I2C_Write(I2C_ID_HEAD_CARD, I2C_HEAD_FAN_SLAVE_ADD, writebuffer, 1); + delayUs(10);//TODO - check the delay + status |= I2C_Read(I2C_ID_HEAD_CARD, I2C_HEAD_FAN_SLAVE_ADD + 1, readbuffer, 1); + EMC2302_Read.Reg.TACHReading_High[1] = readbuffer[0]; + + writebuffer[0] = EMC2301_TACH_2_READING_LOW; + status = I2C_Write(I2C_ID_HEAD_CARD, I2C_HEAD_FAN_SLAVE_ADD, writebuffer, 1); + delayUs(10);//TODO - check the delay + status |= I2C_Read(I2C_ID_HEAD_CARD, I2C_HEAD_FAN_SLAVE_ADD + 1, readbuffer, 1); + EMC2302_Read.Reg.TACHReading_Low[1] = readbuffer[0]; + + Head_Fan_Tach[1] = (EMC2302_Read.Reg.TACHReading_High[1] << 8) | EMC2302_Read.Reg.TACHReading_Low[1]; + } + + return status; +} + +/******************************************* + ******** Informational Functions ********** + ******************************************/ + + +uint8_t fan_click_productID() +{ + uint8_t status = OK; + writebuffer[0] = EMC2301_PRODUCT_ID; + readbuffer[0] = 0; + status |= I2C_Write(I2C_ID_HEAD_CARD, I2C_HEAD_FAN_SLAVE_ADD, writebuffer, 1); + delayUs(10);//TODO - check the delay + status |= I2C_Read(I2C_ID_HEAD_CARD, I2C_HEAD_FAN_SLAVE_ADD + 1, readbuffer, 1); + Fan_Click_Info.Product_ID = readbuffer[0]; + return status; +} + +uint8_t fan_click_manufactuerID() +{ + uint8_t status = OK; + writebuffer[0] = EMC2301_MANUFACTUERE_ID; + status |= I2C_Write(I2C_ID_HEAD_CARD, I2C_HEAD_FAN_SLAVE_ADD, writebuffer, 1); + delayUs(10);//TODO - check the delay + status |= I2C_Read(I2C_ID_HEAD_CARD, I2C_HEAD_FAN_SLAVE_ADD + 1, readbuffer, 1); + Fan_Click_Info.Product_ID = readbuffer[0]; + return status; +} + +uint8_t fan_click_revision() +{ + uint8_t status = OK; + writebuffer[0] = EMC2301_REVISION; + status |= I2C_Write(I2C_ID_HEAD_CARD, I2C_HEAD_FAN_SLAVE_ADD, writebuffer, 1); + delayUs(10);//TODO - check the delay + status |= I2C_Read(I2C_ID_HEAD_CARD, I2C_HEAD_FAN_SLAVE_ADD + 1, readbuffer, 1); + Fan_Click_Info.Product_ID = readbuffer[0]; + return status; +} + +uint8_t Read_Config_Reg() +{ + uint8_t status = OK; + writebuffer[0] = EMC2301_CONFIGURATION; + status |= I2C_Write(I2C_ID_HEAD_CARD, I2C_HEAD_FAN_SLAVE_ADD, writebuffer, 1); + delayUs(10);//TODO - check the delay + status |= I2C_Read(I2C_ID_HEAD_CARD, I2C_HEAD_FAN_SLAVE_ADD + 1, readbuffer, 1); + + EMC2302_Read.Reg.Configuration = readbuffer[0]; + + return status; +} + +uint8_t Head_Fan_Read_Register(uint8_t Reg) +{ + uint8_t status = OK; + writebuffer[0] = Reg; + status |= I2C_Write(I2C_ID_HEAD_CARD, I2C_HEAD_FAN_SLAVE_ADD, writebuffer, 1); + delayUs(10);//TODO - check the delay + status |= I2C_Read(I2C_ID_HEAD_CARD, I2C_HEAD_FAN_SLAVE_ADD + 1, readbuffer, 1); + return readbuffer[0]; + //return status; +} + + + +uint8_t Head_Fan_Read_Registers() +{ + uint8_t status = OK, i = 0; + + + for(i=40;i<EMC2302_Size;i++) + { + writebuffer[0] = EMC2302_Reg_Add[i]; + status |= I2C_Write(I2C_ID_HEAD_CARD, I2C_HEAD_FAN_SLAVE_ADD, writebuffer, 1); + delayUs(10);//TODO - check the delay + status |= I2C_Read(I2C_ID_HEAD_CARD, I2C_HEAD_FAN_SLAVE_ADD + 1, readbuffer, 1); + EMC2302_Read.Buf[i] = readbuffer[0]; + delayms(5);//TODO - check the delay + } + return status; +} + + +uint8_t Fan_config() + +{ + uint8_t status = OK; + + EMC2302_Write.Reg.PWM_Polarity_Config = 0x0;//Bit0 invert PWM1, Bit2 invert PWM2 + Fan_PWM_Polarity_Config(); + + //Output is configured as a push-pull output + EMC2302_Write.Reg.PWM_Output_Config = 0x3;//Bit0 Output PWM1, Bit2 Output PWM2, 0 open drain, 1 push-pull + Fan_PWM_Output_Config(); + +// //Max Freq. +// EMC2302_Write.Reg.PWM_Base_Freq = (FAN_FREQ_26KHZ << 2) | FAN_FREQ_26KHZ; +// Fan_PWM_Base_Frequency(); +// +// +// Read_Config_Reg(); +// if (EMC2302_Read.Reg.PWM_Output_Config != EMC2302_Write.Reg.PWM_Output_Config) +// status |= ERROR ; + + EMC2302_Write.Reg.Fan_Setting[0] = Head_Fan_PWM_1_Command; //Fan 1 Setting - 0xFF Full PWM 0x80 = 50% FF = 100% 0 - STOP + Fan_Setting(0); + delayms(5);//TODO - check the delay + Fan_Read_Tacho(0); + return status; +} + + +void Test_fan_Click() +{ + static uint8_t once = 1; + if (once) + { + #ifdef Test_headCard_With_DispCard_I2C4_Add0xE2_DispID_0 + Select_Main_Head_Mux_Channel_test(); + #else + Select_Main_Head_Mux_Channel(); + #endif + + //once = 0; + } + fan_click_productID(); + fan_click_manufactuerID(); + fan_click_revision(); + Read_Config_Reg(); + //Head_Fan_Read_Registers(); + Fan_config(); + +} diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/Fan/fan_click.h b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/Fan/fan_click.h new file mode 100644 index 000000000..f5f030e57 --- /dev/null +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/Fan/fan_click.h @@ -0,0 +1,811 @@ +/* + * Fan_Click.h + * + * Created on: Oct 27, 2019 + * Author: avi + */ + +#ifndef DRIVERS_I2C_COMMUNICATION_HEAD_CARD_FAN_FAN_CLICK_H_ +#define DRIVERS_I2C_COMMUNICATION_HEAD_CARD_FAN_FAN_CLICK_H_ + +#ifndef FAN_CLICK_H_ +#define FAN_CLICK_H_ + +/****************************************************************************** +* Includes +*******************************************************************************/ +#include <stdint.h> +#include <stdbool.h> + +/****************************************************************************** +* Preprocessor Constants +*******************************************************************************/ +#define EMC2301_I2C_ADDR 0x2F + +/** + * EMC2301 Registers + */ +#define EMC2301_CONFIGURATION 0x20 /**< Configures the clocking and watchdog functions. default 0x40 R/W */ +#define EMC2301_FAN_STATUS 0x24 /**< Stores the status bits for the RPM-based Fan Speed Control Algorithm. default 00 R-C */ +#define EMC2301_FAN_STALL_STATUS 0x25 /**< Stores status bits associated with a stalled fan. default 0x00 R-C */ +#define EMC2301_FAN_SPIN_STATUS 0x26 /**< Stores status bits associated with a spin-up failure. default 0x00 R-C */ +#define EMC2301_DRIVE_FAIL_STATUS 0x27 /**< Stores status bits associated with drive failure. default 0x00 R-C */ +#define EMC2301_FAN_INTERRUPT_ENABLE 0x29 /**< Controls the masking of interrupts on all channels. default 0x00 R/W */ +#define EMC2301_PWM_POLARITY 0x2A /**< Configures polarity of the PWM driver. default 0x00 R/W */ +#define EMC2301_PWM_OUTPUT_CONFIG 0x2B /**< Configures output type of the PWM driver. default 0x00 R/W */ +#define EMC2301_PWM_BASE_FREQ 0x2D /**< Selects the base frequency for the PWM output. default 0x00 R/W */ + +#define EMC2301_FAN_1_SETTING 0x30 /**< Always displays the most recent FAN_1 input setting for the FAN_1. If the RPM based FAN_1 speed + control algorithm is disabled, allows direct user control of the FAN_1 driver. default 0x00 R/W */ +#define EMC2301_PWM_1_DIVIDE 0x31 /**< Sores the divide ratio to set the freq of the FAN_1 driver. default 0x01 R/W */ +#define EMC2301_FAN_1_CONFIG1 0x32 /**< Sets configuration values for the RPM base FAN_1 speed control. default 0x2B R/W */ +#define EMC2301_FAN_1_CONFIG2 0x33 /**< Sets additional configuration values for the FAN_1 driver. default 0x28 R/W */ +#define EMC2301_GAIN_1 0x35 /**< Holds the gain terms used by the RPM based FAN_1 Speed Control Algorithm for the FAN_1 driver. 0x2A R/W */ +#define EMC2301_FAN_1_SPINUP 0x36 /**< Sets the configuration values for Spin Up Routine of the FAN_1 driver. default 0x19 R/W */ +#define EMC2301_FAN_1_MAX_STEP 0x37 /**< Sets the maximum change per update for the FAN_1 drive. default 0x10 R/W */ +#define EMC2301_FAN_1_MIN_DRIVE 0x38 /**< Sets the min drive value of the FAN_1 driver. default 0x66 40% R/W */ +#define EMC2301_FAN_1_VALID_TACH 0x39 /**< Holds the tachometer reading that indicates FAN_1 is spinning properly. default 0xF5 R/W */ +#define EMC2301_FAN_1_FAIL_LOW 0x3A /**< Stores the number of tach counts used to determine how the actual FAN_1 speed must match the target FAN_1 speed at full scale. */ +#define EMC2301_FAN_1_FAIL_HIGH 0x3B +#define EMC2301_TACH_1_TARGET_LOW 0x3C /**< Holds the target tachometer reading low byte for the FAN_1. default 0xF8 R/W */ +#define EMC2301_TACH_1_TARGET_HIGH 0x3D /**< Holds the target tachometer reading high byte for the FAN_1. default 0xFF R/W */ +#define EMC2301_TACH_1_READING_HIGH 0x3E /**< Holds the tachometer reading high byte for the FAN_1. default 0xFF R/W */ +#define EMC2301_TACH_1_READING_LOW 0x3F /**< Holds the tachometer reading low byte for the FAN_1. default 0xF8 R/W */ + +#define EMC2301_FAN_2_SETTING 0x40 /**< Always displays the most recent FAN_1 input setting for the FAN_1. If the RPM based FAN_1 speed + control algorithm is disabled, allows direct user control of the FAN_1 driver. default 0x00 R/W */ +#define EMC2301_PWM_2_DIVIDE 0x41 /**< Sores the divide ratio to set the freq of the FAN_1 driver. default 0x01 R/W */ +#define EMC2301_FAN_2_CONFIG1 0x42 /**< Sets configuration values for the RPM base FAN_1 speed control. default 0x2B R/W */ +#define EMC2301_FAN_2_CONFIG2 0x43 /**< Sets additional configuration values for the FAN_1 driver. default 0x28 R/W */ +#define EMC2301_GAIN_2 0x45 /**< Holds the gain terms used by the RPM based FAN_1 Speed Control Algorithm for the FAN_1 driver. 0x2A R/W */ +#define EMC2301_FAN_2_SPINUP 0x46 /**< Sets the configuration values for Spin Up Routine of the FAN_1 driver. default 0x19 R/W */ +#define EMC2301_FAN_2_MAX_STEP 0x47 /**< Sets the maximum change per update for the FAN_1 drive. default 0x10 R/W */ +#define EMC2301_FAN_2_MIN_DRIVE 0x48 /**< Sets the min drive value of the FAN_1 driver. default 0x66 40% R/W */ +#define EMC2301_FAN_2_VALID_TACH 0x49 /**< Holds the tachometer reading that indicates FAN_1 is spinning properly. default 0xF5 R/W */ +#define EMC2301_FAN_2_FAIL_LOW 0x4A /**< Stores the number of tach counts used to determine how the actual FAN_1 speed must match the target FAN_1 speed at full scale. */ +#define EMC2301_FAN_2_FAIL_HIGH 0x4B +#define EMC2301_TACH_2_TARGET_LOW 0x4C /**< Holds the target tachometer reading low byte for the FAN_1. default 0xF8 R/W */ +#define EMC2301_TACH_2_TARGET_HIGH 0x4D /**< Holds the target tachometer reading high byte for the FAN_1. default 0xFF R/W */ +#define EMC2301_TACH_2_READING_HIGH 0x4E /**< Holds the tachometer reading high byte for the FAN_1. default 0xFF R/W */ +#define EMC2301_TACH_2_READING_LOW 0x4F /**< Holds the tachometer reading low byte for the FAN_1. default 0xF8 R/W */ + +#define EMC2301_SOFTWARE_LOCK 0xEF /**< Locks all SWL registers. default 0x00 R/W */ +#define EMC2301_PRODUCT_ID 0xFD /**< Stores the unique product ID. default 0x37 R */ +#define EMC2301_MANUFACTUERE_ID 0xFE /**< Stores the manufacturer ID. default 0x5D R */ +#define EMC2301_REVISION 0xFF /**< Revision. default 0x80 R */ + +/****************************************************************************** +* Configuration Constants +*******************************************************************************/ + +/****************************************************************************** +* Macros +*******************************************************************************/ + +/****************************************************************************** +* Typedefs +*******************************************************************************/ +/** + * @enum Configuration Bits + */ +enum +{ + USE_EXT_CLK = 0, /**< Enables the EMC2301 to use a clock present on the CLK */ + DR_EXT_CLK = 2, /**< Enables the internal tach clock */ + WD_EN = 32, /**< Enables the watchdog timer. default 0 */ + DIS_TO = 64, /**< Disables the SMBus timeout function, 1 default */ + MASK = 128 /**< Blocks the ALERT pin from being asserted, 0 default */ +}; + +/** + * @enum Status register results + */ +typedef enum +{ + FAN_STALL = 1, /**< Indicates that the fan driver has stalled */ + FAN_SPIN = 2, /**< Indicates that the fan driver cannot spin up */ + FAN_DRIVE_FAIL = 4, /**< Indicates that the driver cannot meet the programmed fan speed */ + FAN_WATCH = 128 /**< Indicates that the watchdog timer has expired */ +} fan_status_t; + +/** + * @enum FAN PWM Base frequencies + */ +typedef enum +{ + FAN_FREQ_26KHZ = 0, /**< Base of 26kHz */ + FAN_FREQ_19_531KHZ, /**< Base of 19.5431kHz */ + FAN_FREQ_4_882HZ, /**< Base of 4.882Hz */ + FAN_FREQ_2_441HZ /**< Base of 2.441Hz */ +} fan_base_freq_t; + + +/** + * @enum Range of tach readings + * + * Adjusts the range of reported and programmed tachometer reading values. + * The RANGE bits determine the weighting of all TACH values + */ +typedef enum +{ + RPM_MIN_500, + RPM_MIN_1000, + RPM_MIN_2000, + RPM_MIN_4000 +} fan_range_t; + +/** + * @enum Number of Fan Edges + * + * Determines the minimum number of edges that must be detected on the + * TACHx signal to determine a single rotation. A typical fan measured 5 edges + * ( for a 2-pole fan ). For more accurate tachometer measurement, the minimum + * number of edges measured may be increased. + */ +typedef enum +{ + EDGE_1_POLE, + EDGE_2_POLE, + EDGE_3_POLE, + EDGE_4_POLE +} fan_edges_t; + +/** + * @enum Update Time Configuration + */ +typedef enum +{ + UPDATE_100MS, + UPDATE_200MS, + UPDATE_300MS, + UPDATE_400MS, + UPDATE_500MS, + UPDATE_800MS, + UPDATE_1200MS, + UPDATE_1600MS +} fan_update_t; + +/** + * @enum Derivative options + * + * Control some of the advanced options that affect the derivative portion of + * the RPM-based Fan Speed Control Algorithm + */ +typedef enum +{ + DERIVATIVE_NONE, + DERIVATIVE_BASIC, + DERIVATIVE_STEP, + DERIVATIVE_BOTH +} fan_derivative_t; + + +/** + * @enum Error range options + * + * Control some of the advanced options that affect the error window. When the + * measured fan speed is within the programmed error window around the target + * speed, then the fan drive setting is not updated. The algorithm will + * continue to monitor the fan speed and calculate necessary drive setting + * changes based on the error. + */ +typedef enum +{ + RPM_0, + RPM_50, + RPM_100, + RPM_200 +} fan_error_t; + + +/** + * @enum Gain for PID settings + * + */ +typedef enum +{ + FAN_GAIN1X, + FAN_GAIN2X, + FAN_GAIN4X, + FAN_GAIN8X +} fan_gain_t; + + +/** + * @enum How mnay update cycles are used for detection of error + * + * Determines how many update cycles are used for the Drive Fail detection + * function +*/ +typedef enum +{ + DRIVE_CNT_DISABLED, + DRIVE_CNT_16, + DRIVE_CNT_32, + DRIVE_CNT_64, +} fan_drive_fail_count_t; + + +/** + * @enum Spin up percent + * + * Determines the final drive level that is used by the Spin Up Routine + */ +typedef enum +{ + SPINUP_30PERCENT, /**< 30% of duty */ + SPINUP_35PERCENT, /**< 35% of duty */ + SPINUP_40PERCENT, /**< 40% of duty */ + SPINUP_45PERCENT, /**< 45% of duty */ + SPINUP_50PERCENT, /**< 50% of duty */ + SPINUP_55PERCENT, /**< 55% of duty */ + SPINUP_60PERCENT, /**< 60% of duty */ + SPINUP_65PERCENT /**< 65% of duty */ +} fan_spinup_t; + + +/** + * @enum Spin time options + * + */ +typedef enum +{ + SPINUP_250MS, /**< 250ms delay */ + SPINUP_500, /**< 500ms delay */ + SPINUP_1S, /**< 1s delay */ + SPINUP_2S /**< 2s delay */ +} fan_spintime_t; + +/****************************************************************************** +* Variables +*******************************************************************************/ + + +/****************************************************************************** +* Function Prototypes +*******************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Initializes the emc2301 + * + * @param address - slave address of the controller + * @return int - 0 success / -1 error + * + * @code + * if( !fan_click_init( EMC2301_I2C_ADDRESS ) ) + * return ERROR_INIT; + * @endcode + */ +int fan_click_init( uint8_t address ); + +/** + * @brief Specifies external clock speed if different from standard + * + * @note Only used if external clock differs from standard(rare). Changes tach + * calculations - use caution. + * + * @param freq - frequency of clock + */ +void fan_click_ext_clock( double freq ); + +/** + * @brief Fan configuration + * + * The Configuration Register controls the basic functionality of the EMC2301. + * + * @param config + * + * @code + * fan_click_config( USE_EXT_CLK | MASK ); + * @endcode + */ +void fan_click_config( uint8_t config ); + +/** + * @brief Fan status + * + * The Fan Status register indicates that the fan driver has stalled or failed + * or that the Watchdog Timer has expired. + * + * @return + * @retval FAN_STALL = 1 + * @retval FAN_SPIN = 2 + * @retval FAN_DRIVE_FAIL = 4 + * @retval FAN_WATCH = 128 + */ +fan_status_t fan_click_get_status( void ); + +/** + * @brief Fan stall status + * + * The Fan Stall Status register indicates that the fan driver has detected a + * stalled condition + * + * @return + * @retval FAN_STALL = 1 + */ +fan_status_t fan_click_get_stall_status( void ); + +/** + * @brief Fan spin status + * + * The Fan Spin Status register indicates that the fan driver has failed to + * spin-up. + * + * @return + * @retval 1 FAN_SPIN has failed + * @retval 0 FAN OK + */ +uint8_t fan_click_get_spin_status( void ); + +/** + * @brief Fan click drive fail status + * + * The Fan Drive Fail Status register indicates that the fan driver cannot + * drive to the programmed speed even at 100% duty cycle. + * + * @return + * @retval 1 DRIVE_FAIL + * @retval 0 DRIVE OK + */ +uint8_t fan_click_get_drive_fail( void ); + +/** + * @brief Enable or disable external interrupts + * + * The Fan Interrupt Enable controls the masking for the Fan channel. When a + * channel is enabled, it will cause the ALERT# pin to be asserted when an + * error condition is detected. + * + */ +void fan_click_interrupts( bool enable ); + +/** + * @brief Reverse polarity of fan. + * + * Determines the polarity of the PWM. + * + * @param inverted - false default, true inverted + */ +void fan_click_polarity( bool inverted ); + +/** + * @brief Configure PWM type + * + * Determines the output type of the PWM driver. + * + * @param push_pull - false open drain / true push-pull + * @note + * Default mode is open drain + */ +void fan_click_pwm_config( bool push_pull ); + +/** + * @brief Base frequency + * + * The PWM Base Frequency register determines the base frequency that is used + * with the PWM Divide register to determine the final PWM frequency. + * + * @param freq + */ +//void fan_click_pwm_base( fan_base_freq_t freq ); + +/** + * @brief Fan setting + * + * The Fan Setting register always displays the current setting of the fan + * driver. Reading from the register will report the current fan speed setting + * of the fan driver regardless of the operating mode. Therefore it is + * possible that reading from this register will not report data that was + * previously written into this register. + * + * @param percentage - percentage of duty + * + * @note While the RPM-based Fan Speed Control Algorithm is active, the + * register is read only. Writing to the register will have no effect and the + * data will not be stored. + * + */ +void fan_click_settings( double percentage ); + +/** + * @brief Read basic setting + * + * The Fan Setting register always displays the current setting of the fan + * driver. Reading from the register will report the current fan speed setting + * of the fan driver regardless of the operating mode. Therefore it is + * possible that reading from this register will not report data that was + * previously written into this register. + * + * @param settings + * + * @return double - percentage of current drive settings. + * + * @note While the RPM-based Fan Speed Control Algorithm is active, the + * register is read only. Writing to the register will have no effect and the + * data will not be stored. + */ +double fan_click_get_settings( void ); + +/** + * @brief Divide PWM signal + * + * The PWM Divide registers determine the final frequency of the PWM Fan + * Driver. The driver base frequency is divided by the value of the PWM Divide + * Register to determine the final frequency. The duty cycle settings are not + * affected by these settings, only the final frequency of the PWM driver. A + * value of 00h will be decoded as 01h. + * + * @param divide + */ +void fan_click_set_PWM_divide( uint8_t divide ); + +/** + * @brief Enable Fan Control Algorithm + * + * Changes the mode from manual to automatic fan speed control. + * + * false - (default) the control circuitry is disabled and the fan driver + * output is determined by the Fan Driver Setting Register. + * true - the control circuitry is enabled and the Fan Driver output will be + * automatically updated to maintain the programmed fan speed as indicated by + * the TACH Target Register. + * + * @param fsc - true enables fan control, false manual mode + */ +void fan_click_config_enableFSC( bool fsc ); + +/** + * @brief Number of edges that needs to be detected + * + * Adjusts the range of reported and programmed tachometer reading values. + * The RANGE bits determine the weighting of all TACH values + * + * @param range + */ +void fan_click_config_range( fan_range_t range ); + +/** + * @brief Number of edges on fan + * + * Determines the minimum number of edges that must be detected on the TACHx + * signal to determine a single rotation. A typical fan measured 5 edges + * (for a 2-pole fan). For more accurate tachometer measurement, the minimum + * number of edges measured may be increased. + * + * @param edges + */ +void fan_click_config_edges( fan_edges_t edges ); + +/** + * @brief Update time + * + * determines the base time between fan driver updates. The Update Time, along + * with the Fan Step Register, is used to control the ramp rate of the drive + * response to provide a cleaner transition of the actual fan operation as + * the desired fan speed changes. + * + * @param update + */ +void fan_click_config_update( fan_update_t update ); + +/** + * @brief Ramp up mode + * + * Enables ramp rate control when the fan driver is operated in the Direct + * Setting Mode + * + * false (default) - Ramp rate control is disabled. When the fan driver is + * operating in Direct Setting mode, the fan setting will instantly transition + * to the next programmed setting. + * + * true - Ramp rate control is enabled. When the fan driver is operating in + * Direct Setting mode, the fan drive setting will follow the ramp rate + * controls as determined by the Fan Step and Update Time settings. The + * maximum fan drive setting step is capped at the Fan Step setting and is + * updated based on the Update Time. + * + * @param rampControl + */ +void fan_click_config_enableRamp( bool rampControl ); + +/** + * @brief Glitch enable + * + * Disables the low pass glitch filter that removes high frequency noise + * injected on the TACHx pin. + * + * @param glitch + */ +void fan_click_config_enableGlitch( bool glitch ); + +/** + * @brief Derivative + * + * Control some of the advanced options that affect the derivative portion of + * the RPM-based Fan Speed Control Algorithm + * + * @param derivative - Basic derivative / Step Derivative / Both + * + * @note BASIC is default + */ +void fan_click_config_derivative( fan_derivative_t derivative ); + +/** + * @brief Error Range + * + * Control some of the advanced options that affect the error window. When the + * measured fan speed is within the programmed error window around the target + * speed, then the fan drive setting is not updated. + * + * @param error + */ +void fan_click_config_errorRange( fan_error_t error ); + +/** + * @brief Gain D + * + * Control some of the advanced options that affect the derivative portion of + * the RPM-based Fan Speed Control Algorithm. The Gain register stores the + * gain terms used by the proportional and integral portions of the RPM-based + * Fan Speed Control Algorithm. These gain terms are used as the KD, KI, and + * KP gain terms in a classic PID control solution. + * + * @param gain + */ +void fan_click_config_gaind( fan_gain_t gain ); + +/** + * @brief Gain I + * + * Control some of the advanced options that affect the derivative portion of + * the RPM-based Fan Speed Control Algorithm. The Gain register stores the + * gain terms used by the proportional and integral portions of the RPM-based + * Fan Speed Control Algorithm. These gain terms are used as the KD, KI, and + * KP gain terms in a classic PID control solution. + * + * @param gain + */ +void fan_click_config_gaini( fan_gain_t gain ); + +/** + * @brief Gain P + * + * Control some of the advanced options that affect the derivative portion of + * the RPM-based Fan Speed Control Algorithm. The Gain register stores the + * gain terms used by the proportional and integral portions of the RPM-based + * Fan Speed Control Algorithm. These gain terms are used as the KD, KI, and + * KP gain terms in a classic PID control solution. + * + * @param gain + */ +void fan_click_config_gainp( fan_gain_t gain ); + +/** + * @brief Drive Fail Count + * + * Determines how many update cycles are used for the Drive Fail + * detection function. + * + * @param count - Disabled / 16 / 32 / 64 + */ +void fan_click_config_drivefail( fan_drive_fail_count_t count ); + +/** + * @brief fan_click_config_enableNoKick + * + * Determines if the Spin Up Routine will drive the fan to 100% duty cycle for + * 1/4 of the programmed spin up time before driving it at the programmed + * level. + * + * @param noKick + * false = The spin up routine will drive the fan to 100% for + * 1/4 of the programmed spin up time before reverting to the programmed spin + * level. + * true = The spin up routine will not drive the fan driver to 100%. It will + * set the drive at the programmed spin level for the entire duration of the + * programmed spin up time. + */ +void fan_click_config_enableNoKick( bool noKick ); + +/** + * @brief fan_click_config_spinLevel + * + * Determines if the Spin Up Routine will drive the fan to 100% duty cycle for + * 1/4 of the programmed spin up time before driving it at the programmed + * level. + * + * @param spin + * + * @code + * fan_click_config_spinLevel( SPINUP_60PERCENT ); + */ +void fan_click_config_spinLevel( fan_spinup_t spin ); + +/** + * @brief fan_click_config_spinTime + * + * The Fan Spin Up Configuration register controls the settings of Spin Up + * Routine. + * + * @param time + * + * @note The Fan Spin Up Configuration register is software locked. + */ +void fan_click_config_spinTime( fan_spintime_t time ); + +/** + * @brief fan_click_set_max_step + * + * The Fan Max Step register, along with the Update Time, controls the ramp + * rate of the fan driver response calculated by the RPM-based Fan Speed + * Control Algorithm. The value of the register represents the maximum step + * size the fan driver will take between update times + * + * @param step + * + * @note When the FSC algorithm is enabled, Ramp Rate control is automatically + * used. + */ +void fan_click_set_max_step( uint8_t step ); + +/** + * @brief fan_click_set_min_drive + * + * The Fan Minimum Drive register stores the minimum drive setting for the + * RPM-based Fan Speed Control Algorithm. The RPM-based Fan Speed Control + * Algorithm will not drive the fan at a level lower than the minimum drive + * unless the target Fan Speed is set at FFh + * + * @param drive + */ +void fan_click_set_min_drive( double min_drive ); + + +/*************************************** + ********** Tach Functions ************* + **************************************/ +/** + * @brief fan_click_set_valid_tach + * + * The Valid TACH Count register stores the maximum TACH Reading Register + * value to indicate that the fan is spinning properly. The value is + * referenced at the end of the Spin Up Routine to determine if the fan has + * started operating and decide if the device needs to retry. + * + * @param tach + * + * @note The Valid TACH Count register is software locked. + */ +void fan_click_set_valid_tach( uint16_t tach ); + +/** + * @brief fan_click_set_valid_tach + * + * The Valid TACH Count register stores the maximum TACH Reading Register + * value to indicate that the fan is spinning properly. The value is + * referenced at the end of the Spin Up Routine to determine if the fan has + * started operating and decide if the device needs to retry. + * + * @return uint16_t + * + * @note The Valid TACH Count register is software locked. + */ +uint16_t fan_click_get_valid_tach( void ); + +/** + * @brief fan_click_get_driveband_fail + * + * The Fan Drive Fail Band Registers store the number of tach counts used by + * the Fan Drive Fail detection circuitry. This circuitry is activated when + * the fan drive setting high byte is at FFh. When it is enabled, the actual + * measured fan speed is compared against the target fan speed. These + * registers are only used when the FSC is active. + * + * @return + */ +uint16_t fan_click_get_driveband_fail( void ); + +/** + * @brief fan_click_set_target_tach + * + * The TACH Target Registers hold the target tachometer value that is + * maintained by the RPM-based Fan Speed Control Algorithm. + * + * The value in the TACH Target Registers will always reflect the current + * TACH Target value. + * + * If the algorithm is enabled, setting the TACH Target + * Register to FFh will disable the fan driver (set the fan drive setting to + * 0%). Setting the TACH Target to any other value (from a setting of FFh) + * will cause the algorithm to invoke the Spin Up Routine after which it will + * function normally. + * + * The Tach Target is not applied until the high byte is written. Once the + * high byte is written, the current value of both high and low bytes will be + * used as the next Tach target. + * + * + * @param tach - RPM 12000 + */ +void fan_click_set_target_tach( uint16_t tach ); + + +/** + * @brief fan_click_get_tach + * + * The Valid TACH Count register stores the maximum TACH Reading Register + * value to indicate that the fan is spinning properly. The value is + * referenced at the end of the Spin Up Routine to determine if the fan has + * started operating and decide if the device needs to retry. + * + * @note The Valid TACH Count register is software locked. If the TACH Reading + * Register value exceeds the Valid TACH Count Register (indicating that the + * Fan RPM is below the threshold set by this count), then a stalled fan is + * detected. In this condition, the algorithm will automatically begin its + * Spin Up Routine. + * + * @return uint16_t + * + */ +uint16_t fan_click_get_tach( void ); + + +/**************************************** + ******* Informational Functions ******** + ***************************************/ +/** + * @brief fan_click_lock_registers + * + * The Lock Column describes the locking mechanism, if any, used for + * individual registers. All SWL registers are Software Locked and therefore + * made read-only when the LOCK bit is set. + * + */ +void fan_click_lock_registers( bool lock ); + +/** + * @brief fan_click_productID + * + * The Product ID Register contains a unique 8-bit word that identifies the + * product. + * + * @return Product ID + */ +uint8_t fan_click_productID( void ); + +/** + * @brief fan_click_manufactuerID + * + * The Manufacturer ID Register contains an 8-bit word that identifies SMSC. + * + * @return Manufacturer ID + */ +uint8_t fan_click_manufactuerID( void ); + + +/** + * @brief fan_click_revision + * + * The Revision Register contains an 8-bit word that identifies the die + * revision. + * + * @return Revision number + */ +uint8_t fan_click_revision( void ); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif /*FILE_CLICK_H_*/ + + +/*** End of File **************************************************************/ + + + +#endif /* DRIVERS_I2C_COMMUNICATION_HEAD_CARD_FAN_FAN_CLICK_H_ */ diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/I2C_Head_Mux.h b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/I2C_Head_Mux.h index 8ba59465c..12eacfedb 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/I2C_Head_Mux.h +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/I2C_Head_Mux.h @@ -19,7 +19,7 @@ The I2C addresses on the board: //I2C MAIM OUTPUT 12v: #ifdef Test_headCard_With_DispCard_I2C4_Add0xE2_DispID_0 - #define I2C_ID_HEAD_CARD 0x04 // 4 foer test via dispenser card 0x03 + #define I2C_ID_HEAD_CARD 0x04 // 4 for testing via dispenser card 0x03 #else #define I2C_ID_HEAD_CARD 0x03 // #endif diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c index 79e4b202a..8f9628f20 100644 --- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c +++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c @@ -16,6 +16,8 @@ #include "drivers/ADC_Sampling/adc.h" #include "Drivers/I2C_Communication/Head_Card/PT100/PT100_ADC.h" +#include "Drivers/I2C_Communication/Head_Card/Fan/fan_click.h" +#include "Drivers/I2C_Communication/Head_Card/Fan/Head_Fan.h" #include "drivers/Motors/Motor.h" #include "drivers/FPGA/FPGA_SPI_Comm.h" #include "Modules/IFS/ifs.h" @@ -23,6 +25,10 @@ //#include "graphics_adapter.h" extern uint8_t Input_Voltage; extern uint8_t Test_Read_Buf[4]; + +extern uint8_t Head_Fan_PWM_1_Command; +extern uint16_t Head_Fan_Tach[2]; + void Stub_ProgressRequest(MessageContainer* requestContainer) { MessageContainer responseContainer; @@ -73,6 +79,16 @@ void Stub_ProgressRequest(MessageContainer* requestContainer) } else + if((request->amount == 0xFAC) /*&& (request->delay == 0xFAC)*/) //measured sensor voltage without flow (orifice flow meter) + { + Head_Fan_PWM_1_Command = (request->delay & 0xFF) ; + Test_fan_Click(); + //response.progress = Fan_Click_Info.Product_ID; + response.progress = Head_Fan_Tach[0]; + response.has_progress = true; + + } + else if((request->amount == 0x0A) && ((request->delay >= 0) && (request->delay < 8))) //read the midtank calibration { response.progress = Initial_Offset_A[request->delay]; diff --git a/Software/Embedded_SW/Embedded/src/makefile.libs b/Software/Embedded_SW/Embedded/src/makefile.libs index b0c158fb9..f262762ef 100644 --- a/Software/Embedded_SW/Embedded/src/makefile.libs +++ b/Software/Embedded_SW/Embedded/src/makefile.libs @@ -1,6 +1,6 @@ # # This file was generated based on the configuration script: -# C:\TFS\Software\Embedded_SW\Embedded\Embedded.cfg +# C:\Tango\Software\Embedded_SW\Embedded\Embedded.cfg # # This makefile may be included in other makefiles that need to build # the libraries containing the compiled source files generated as @@ -14,9 +14,9 @@ # # The absolute path to the generated source directory (at the time the # sources were generated) is: -# C:\TFS\Software\Embedded_SW\Embedded\src +# C:\Tango\Software\Embedded_SW\Embedded\src # -GEN_SRC_DIR ?= ../../../../TFS/Software/Embedded_SW/Embedded/src +GEN_SRC_DIR ?= ../src ifeq (,$(wildcard $(GEN_SRC_DIR))) $(error "ERROR: GEN_SRC_DIR must be set to the directory containing the generated sources") diff --git a/Software/Embedded_SW/Embedded/src/sysbios/makefile b/Software/Embedded_SW/Embedded/src/sysbios/makefile index 527c48702..1dec70826 100644 --- a/Software/Embedded_SW/Embedded/src/sysbios/makefile +++ b/Software/Embedded_SW/Embedded/src/sysbios/makefile @@ -1,29 +1,29 @@ -XOPTS = -I"C:/ti/xdctools_3_32_00_06_core/packages/" -Dxdc_target_types__=C:/ti/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/ti/targets/arm/elf/std.h -Dxdc_target_name__=M4F +XOPTS = -I"C:/TI/xdctools_3_32_00_06_core/packages/" -Dxdc_target_types__=C:/TI/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/ti/targets/arm/elf/std.h -Dxdc_target_name__=M4F -vpath % C:/ti/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/ti/sysbios/ -vpath %.c C:/ti/xdctools_3_32_00_06_core/packages/ +vpath % C:/TI/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/ti/sysbios/ +vpath %.c C:/TI/xdctools_3_32_00_06_core/packages/ CCOPTS = --endian=little -mv7M4 --abi=eabi --float_support=fpv4spd16 -q -ms --opt_for_speed=2 --program_level_compile -o3 -g --optimize_with_debug -Dxdc_FILE=__FILE__ -Dti_sysbios_knl_Task_minimizeLatency__D=FALSE -Dti_sysbios_knl_Clock_stopCheckNext__D=FALSE -Dti_sysbios_family_arm_m3_Hwi_enableException__D=TRUE -Dti_sysbios_family_arm_m3_Hwi_disablePriority__D=32U -Dti_sysbios_family_arm_m3_Hwi_numSparseInterrupts__D=0U -XDC_ROOT = C:/ti/xdctools_3_32_00_06_core/packages/ +XDC_ROOT = C:/TI/xdctools_3_32_00_06_core/packages/ -BIOS_ROOT = C:/ti/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/ti/sysbios/ +BIOS_ROOT = C:/TI/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/ti/sysbios/ BIOS_DEFS = -Dti_sysbios_BIOS_swiEnabled__D=TRUE -Dti_sysbios_BIOS_taskEnabled__D=TRUE -Dti_sysbios_BIOS_clockEnabled__D=TRUE -Dti_sysbios_BIOS_runtimeCreatesEnabled__D=TRUE -Dti_sysbios_hal_Hwi_DISABLE_ALL_HOOKS -Dti_sysbios_knl_Swi_DISABLE_ALL_HOOKS -Dti_sysbios_BIOS_smpEnabled__D=FALSE -Dti_sysbios_Build_useHwiMacros -Dti_sysbios_knl_Swi_numPriorities__D=16 -Dti_sysbios_knl_Task_deleteTerminatedTasks__D=FALSE -Dti_sysbios_knl_Task_numPriorities__D=16 -Dti_sysbios_knl_Task_checkStackFlag__D=TRUE -Dti_sysbios_knl_Task_initStackFlag__D=TRUE -Dti_sysbios_knl_Task_DISABLE_ALL_HOOKS -Dti_sysbios_knl_Clock_TICK_SOURCE=ti_sysbios_knl_Clock_TickSource_TIMER -Dti_sysbios_knl_Clock_TICK_MODE=ti_sysbios_knl_Clock_TickMode_PERIODIC -Dti_sysbios_hal_Core_delegate_getId=ti_sysbios_hal_CoreNull_getId__E -Dti_sysbios_hal_Core_delegate_interruptCore=ti_sysbios_hal_CoreNull_interruptCore__E -Dti_sysbios_hal_Core_delegate_lock=ti_sysbios_hal_CoreNull_lock__E -Dti_sysbios_hal_Core_delegate_unlock=ti_sysbios_hal_CoreNull_unlock__E -Dti_sysbios_hal_Core_numCores__D=1 -Dti_sysbios_hal_CoreNull_numCores__D=1 -Dti_sysbios_utils_Load_taskEnabled__D=TRUE -Dti_sysbios_utils_Load_swiEnabled__D=FALSE -Dti_sysbios_utils_Load_hwiEnabled__D=FALSE -Dti_sysbios_family_arm_m3_Hwi_dispatcherSwiSupport__D=TRUE -Dti_sysbios_family_arm_m3_Hwi_dispatcherTaskSupport__D=TRUE -Dti_sysbios_family_arm_m3_Hwi_dispatcherAutoNestingSupport__D=TRUE -Dti_sysbios_family_arm_m3_Hwi_dispatcherIrpTrackingSupport__D=TRUE -Dti_sysbios_knl_Semaphore_supportsEvents__D=FALSE -Dti_sysbios_knl_Semaphore_supportsPriority__D=TRUE -BIOS_INC = -I"C:/ti/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/" +BIOS_INC = -I"C:/TI/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/" -TARGET_INC = -I"C:/ti/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/" +TARGET_INC = -I"C:/TI/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/" INCS = $(BIOS_INC) $(TARGET_INC) -CC = C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.6.LTS/bin/armcl -c $(CCOPTS) -I C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.6.LTS/include -ASM = C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.6.LTS/bin/armcl -c $(CCOPTS) -I C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.6.LTS/include -AR = C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.6.LTS/bin/armar rq +CC = C:/TI/ccsv7/tools/compiler/ti-cgt-arm_16.9.4.LTS/bin/armcl -c $(CCOPTS) -I C:/TI/ccsv7/tools/compiler/ti-cgt-arm_16.9.4.LTS/include +ASM = C:/TI/ccsv7/tools/compiler/ti-cgt-arm_16.9.4.LTS/bin/armcl -c $(CCOPTS) -I C:/TI/ccsv7/tools/compiler/ti-cgt-arm_16.9.4.LTS/include +AR = C:/TI/ccsv7/tools/compiler/ti-cgt-arm_16.9.4.LTS/bin/armar rq -DEL = C:/ti/xdctools_3_32_00_06_core/packages/../bin/rm -f -CP = C:/ti/xdctools_3_32_00_06_core/packages/../bin/cp -f +DEL = C:/TI/xdctools_3_32_00_06_core/packages/../bin/rm -f +CP = C:/TI/xdctools_3_32_00_06_core/packages/../bin/cp -f define RM $(if $(wildcard $1),$(DEL) $1,:) diff --git a/Software/Embedded_SW/Embedded/src/sysbios/sysbios.aem4f b/Software/Embedded_SW/Embedded/src/sysbios/sysbios.aem4f Binary files differindex 09c12e2ed..a4c42e82f 100644 --- a/Software/Embedded_SW/Embedded/src/sysbios/sysbios.aem4f +++ b/Software/Embedded_SW/Embedded/src/sysbios/sysbios.aem4f diff --git a/Software/Embedded_SW/Embedded/temp/EmbParam.cfg b/Software/Embedded_SW/Embedded/temp/EmbParam.cfg Binary files differdeleted file mode 100644 index 339804423..000000000 --- a/Software/Embedded_SW/Embedded/temp/EmbParam.cfg +++ /dev/null |
