/// <summary> /// Reads the id string of the connected Top Programmer. /// </summary> /// <param name="shouter">The shouter instance.</param> /// <param name="bulkDevice">The bulk device instance.</param> /// <returns>The read id string.</returns> public static string ReadTopDeviceIdString(IShouter shouter, IUsbBulkDevice bulkDevice) { bulkDevice.SendPackage(4, new byte[] { 0x0E, 0x11, 0x00, 0x00 }, "Write version string to buffer"); bulkDevice.SendPackage(4, new byte[] { 0x07 }, "07 command"); var readBuffer = bulkDevice.RecievePackage(4, "Reading buffer"); return(readBuffer.Take(16).Aggregate("", (current, t) => current + (char)t).TrimEnd()); }
/// <summary> /// Creates a new instance of the Top Device connected to the Top Programmer. /// <remarks>Atm. only works for model Top2005+.</remarks> /// </summary> /// <param name="shouter">The shouter instance.</param> /// <param name="bulkDevice">The bulk device to use.</param> /// <returns>The created instance of the Top Device.</returns> public static TopDevice Create(IShouter shouter, IUsbBulkDevice bulkDevice) { var idString = ReadTopDeviceIdString(shouter, bulkDevice); shouter.ShoutLine(2, "Connected Top device is: {0}.", idString); if (idString.StartsWith("top2005+")) { return(new Top2005Plus(shouter, bulkDevice)); } throw new U2PaException("Not supported Top Programmer {0}", idString); }
/// <summary> /// ctor. /// </summary> /// <param name="shouter">The shouter instance.</param> /// <param name="bulkDevice">The bulk device.</param> internal Top2005Plus(IShouter shouter, IUsbBulkDevice bulkDevice) : base(shouter, bulkDevice) { Func <double, byte, Tuple <double, byte> > t = Tuple.Create <double, byte>; VppLevels = new List <Tuple <double, byte> > { t(4.8, 0x00), t(6.9, 0x41), t(7.3, 0x46), t(7.5, 0x4B), t(8.8, 0x50), t(9.0, 0x5A), t(9.5, 0x5F), t(9.9, 0x64), t(10.4, 0x69), //t(4.8, 0x6E), t(12.0, 0x78), t(12.4, 0x7D), t(12.9, 0x82), t(13.4, 0x87), t(14.0, 0x8C), t(14.5, 0x91), t(15.0, 0x96), t(15.5, 0x9B), t(16.2, 0xA0), //t(4.8, 0xAA), t(20.9, 0xD2), //t(4.8, 0xD3), t(20.9, 0xFA), t(4.8, 0xFB) }; VccLevels = new List <Tuple <double, byte> > { //t(3.1, 0x00), t(4.9, 0x01), t(3.1, 0x19), t(3.6, 0x1F), t(4.3, 0x28), t(4.9, 0x2D) }; UpLoadFPGAProgramTopWin6Style(Config.ICTestBinPath); }
/// <summary> /// ctor. /// </summary> /// <param name="shouter">The shouter instance.</param> /// <param name="bulkDevice">The bulk device instance.</param> protected TopDevice(IShouter shouter, IUsbBulkDevice bulkDevice) { BulkDevice = bulkDevice; Shouter = shouter; }