//end Properties //======================================= //Public Methods /// <summary> /// Read FTDI EEPROM /// </summary> /// <param name="dev"></param> /// <returns></returns> public FTDI.FT_STATUS readFtdiEEProm(FTDI dev) { FTDI.FT_STATUS ftStatus = FTDI.FT_STATUS.FT_OK; ftEeprom = new FTDI.FT232R_EEPROM_STRUCTURE(); try { ftStatus = dev.ReadFT232REEPROM(ftEeprom); } catch (FTDI.FT_EXCEPTION ex) { throw ex; } return ftStatus; }
public bool resetLineIsEnabled_pluschecks() { FTDI.FT232R_EEPROM_STRUCTURE eep = new FTDI.FT232R_EEPROM_STRUCTURE(); ftdi.ReadFT232REEPROM(eep); if (parameters.testing) //loading-only checks: same MAC as tested, and was there a testing error { if (eep.Description.Contains("Tested")) { mf_parent.UpdateOutputText("WARNING: This USB has already been tested. Test will continue in 4 seconds."); mf_parent.UpdateColorDisplay("orange"); System.Threading.Thread.Sleep(4000); mf_parent.UpdateColorDisplay("white"); } } if(parameters.loading && !parameters.testing) //loading-only checks: same MAC as tested, and was there a testing error { if (eep.Description.Contains("Err")) { mf_parent.UpdateOutputText("WARNING: The most recent test of this USB ended with an error. Test will continue in 4 seconds."); mf_parent.UpdateColorDisplay("orange"); System.Threading.Thread.Sleep(4000); mf_parent.UpdateColorDisplay("white"); } else if (eep.Description.Contains("Tested") && !eep.Description.Contains(parameters.MAC)) { mf_parent.UpdateOutputText("WARNING: This USB was assigned a different MAC address during testing. Test will continue in 3 seconds."); mf_parent.UpdateColorDisplay("orange"); System.Threading.Thread.Sleep(3000); mf_parent.UpdateColorDisplay("white"); } //else if (!eep.Description.Contains("Tested")) //{ // mf_parent.UpdateOutputText("WARNING: This USB does not appear to have been tested. Test will continue in 2 seconds."); // mf_parent.UpdateColorDisplay("orange"); // System.Threading.Thread.Sleep(2000); // mf_parent.UpdateColorDisplay("white"); //} } parameters.FTDISerialNum = eep.SerialNumber; if (eep.Cbus3 == FTDI.FT_CBUS_OPTIONS.FT_CBUS_IOMODE) return true; else return false; }
//leave cbus3 in bitbang, leave serial number alone, leave PID alone, and program "Tested [MAC]" as description public void SetEEPROMaftertestonly() { //build an EEPROM structure and fill it with our settings FTDI.FT232R_EEPROM_STRUCTURE data = new FTDI.FT232R_EEPROM_STRUCTURE(); ftdi.ReadFT232REEPROM(data); data.Cbus3 = FTDI.FT_CBUS_OPTIONS.FT_CBUS_IOMODE; data.Manufacturer = "ThinkEco, Inc."; //data.Description = "Tested " + parameters.SN + parameters.MAC; data.Description = "Tested " + parameters.MAC; //data.Description = "Tested " + parameters.MAC; data.MaxPower = 80; //80 mAmps //read serial number from board so when we re-write it it doesn't change //string SerialNumber = string.Empty; //ftdi.GetSerialNumber(out SerialNumber); //data.SerialNumber = SerialNumber; //write the EEPROM structure if (ftdi.WriteFT232REEPROM(data) != FTDI.FT_STATUS.FT_OK) throw new Exception_Yellow("Error writing final EEPROM -- Dongle fails. Insert a new dongle and press \"Run Test\" or Enter."); }
public void enableResetLine() { //build an EEPROM structure with the CBUS3 line (which we've hard-wired to the Freescale chip's Reset line) set to bitbang mode (so we can toggle on command using ResetChip function) FTDI.FT232R_EEPROM_STRUCTURE data = new FTDI.FT232R_EEPROM_STRUCTURE(); ftdi.ReadFT232REEPROM(data); data.Cbus3 = FTDI.FT_CBUS_OPTIONS.FT_CBUS_IOMODE; //read serial number from board so when we re-write it it doesn't change //string SerialNumber = string.Empty; //ftdi.GetSerialNumber(out SerialNumber); //data.SerialNumber = SerialNumber; //parameters.FTDISerialNum = SerialNumber; //write the EEPROM structure if (ftdi.WriteFT232REEPROM(data) != FTDI.FT_STATUS.FT_OK) throw new Exception_Red("Error enabling reset line -- Dongle fails. Insert a new dongle and press \"Run Test\" or Enter."); }