public static void TestMykonosSerializerPrbs() { AdiCommandServerClient Link = AdiCommandServerClient.Instance; Link.hw.Connect(TestSetupConfig.ipAddr, TestSetupConfig.port); Link.spiWrite(0xDC0, 0x3); //hold obsRx framer in reset Link.spiWrite(0xDC7, 0x00); //Disable lane FIFOs in ObsRx framer Link.spiWrite(0xDC1, 0x00); //disable ObsRx framer clocks Link.fpgaWrite(0x400, 0x400); //Enable all Rx and Tx lanes in FPGA Link.fpgaWrite(0x40C, 0xE4E4E4); Link.spiWrite(0x78, 0x00); //Lane polarity Link.spiWrite(0x72, 1); //enable prbs 20 Link.spiWrite(0xB1, 0x90); //enable all serializer lanes //Link.spiWrite(0xB3, 0x20); //slow down lane rate by /2 //Link.spiWrite(0x11A, 0x00); //divide serializer some Link.fpgaWrite(0x404, 0x08); //Clear Error counters Link.fpgaWrite(0x404, 0x01); //enable PRBS7 checker Link.fpgaWrite(0x404, 0x11); //Enable PRBS7 error counters UInt32 fpgaReg = 0; byte spiReg = 0; spiReg = Link.spiRead(0x059); Console.WriteLine("SPI Reg x059 = " + spiReg.ToString("X")); spiReg = Link.spiRead(0x05A); Console.WriteLine("SPI Reg x05A = " + spiReg.ToString("X")); spiReg = Link.spiRead(0x060); Console.WriteLine("SPI Reg x060 = " + spiReg.ToString("X")); spiReg = Link.spiRead(0x061); Console.WriteLine("SPI Reg x061 = " + spiReg.ToString("X")); spiReg = Link.spiRead(0x062); Console.WriteLine("SPI Reg x062 = " + spiReg.ToString("X")); spiReg = Link.spiRead(0x059); Console.WriteLine("SPI Reg x059 = " + spiReg.ToString("X")); spiReg = Link.spiRead(0x110); Console.WriteLine("SPI Reg x110 = " + spiReg.ToString("X")); spiReg = Link.spiRead(0x0B3); Console.WriteLine("SPI Reg x0B3 = " + spiReg.ToString("X")); spiReg = Link.spiRead(0x11A); Console.WriteLine("SPI Reg x11A = " + spiReg.ToString("X")); spiReg = Link.spiRead(0x0B0); Console.WriteLine("SPI Reg x0B0 = " + spiReg.ToString("X")); spiReg = Link.spiRead(0x0B1); Console.WriteLine("SPI Reg x0B1 = " + spiReg.ToString("X")); spiReg = Link.spiRead(0x0B2); Console.WriteLine("SPI Reg x0B2 = " + spiReg.ToString("X")); spiReg = Link.spiRead(0x0B3); Console.WriteLine("SPI Reg x0B3 = " + spiReg.ToString("X")); spiReg = Link.spiRead(0x0B4); Console.WriteLine("SPI Reg x0B4 = " + spiReg.ToString("X")); spiReg = Link.spiRead(0x0B5); Console.WriteLine("SPI Reg x0B5 = " + spiReg.ToString("X")); spiReg = Link.spiRead(0x224); Console.WriteLine("RCAL result = " + spiReg.ToString("X")); fpgaReg = Link.fpgaRead(0x404); Console.WriteLine("FPGA Reg x404 = " + fpgaReg.ToString("X")); fpgaReg = Link.fpgaRead(0x41C); Console.WriteLine("FPGA Reg x41C = " + fpgaReg.ToString("X")); fpgaReg = Link.fpgaRead(0x420); Console.WriteLine("FPGA Reg x420 = " + fpgaReg.ToString("X")); fpgaReg = Link.fpgaRead(0x14); Console.WriteLine("FPGA Reg x14 = " + fpgaReg.ToString("X")); Link.Disconnect(); }
public static void SetArmDebugMode() { AdiCommandServerClient Link = AdiCommandServerClient.Instance; Link.hw.Connect(TestSetupConfig.ipAddr, TestSetupConfig.port); Console.Write(Link.identify()); Console.Write(Link.version()); Link.fpgaWrite(0x100, 1); //enable Test mode 0xA for ARM Debug byte fpgaReadData = Link.spiRead(0xD00); Console.WriteLine("xD00 = " + fpgaReadData.ToString("X")); fpgaReadData = Link.spiRead(0xD08); Console.WriteLine("xD08 = " + fpgaReadData.ToString("X")); fpgaReadData = Link.spiRead(0xD09); Console.WriteLine("xD09 = " + fpgaReadData.ToString("X")); fpgaReadData = Link.spiRead(0xD14); Console.WriteLine("xD14 = " + fpgaReadData.ToString("X")); Link.Disconnect(); }
public static void TxDeFramerRunPrbsErrorCheck([Values(Mykonos.MYK_PRBS_ORDER.PRBS7, Mykonos.MYK_PRBS_ORDER.PRBS15, Mykonos.MYK_PRBS_ORDER.PRBS31)] Mykonos.MYK_PRBS_ORDER PrbsOrder) { AdiCommandServerClient Link = AdiCommandServerClient.Instance; Link.hw.Connect(TestSetupConfig.ipAddr, TestSetupConfig.port); UInt32 fpgaData = 0; byte mykData = 0; mykData = Link.spiRead(0x78); Console.WriteLine("SPI Reg x78 = " + mykData.ToString("X")); //Initialise System and JESD Links TestSetup.PrbsRxTestSetupInit(settings); Link.hw.Connect(TestSetupConfig.ipAddr, TestSetupConfig.port); fpgaData = Link.fpgaRead(0x410); Console.WriteLine("FPGA Reg x410: REFCLK Frequency Detect = 0x" + fpgaData.ToString("X") + " = " + fpgaData.ToString()); fpgaData = Link.fpgaRead(0x10); Console.WriteLine("FPGA Version x10:" + fpgaData.ToString("X")); //Enable PRBS Generator on FPGA //GTX PRBS Config FPGA 0x404[10:8] //Then Enable PRBS Error Checker on Tx Deframer fpgaData = Link.fpgaRead(0x404); switch (PrbsOrder) { case Mykonos.MYK_PRBS_ORDER.PRBS7: fpgaData |= 0x100; break; case Mykonos.MYK_PRBS_ORDER.PRBS15: fpgaData |= 0x200; break; case Mykonos.MYK_PRBS_ORDER.PRBS31: fpgaData |= 0x400; break; default: Assert.Fail("Invalid PRBS Order"); break; } Link.fpgaWrite(0x404, fpgaData); Link.Mykonos.enableDeframerPrbsChecker(0xF, PrbsOrder, 1); Link.Mykonos.clearDeframerPrbsCounters(); //Let PRBS Run uint [] LaneError = { 0xFF, 0xFF, 0xFF, 0xFF }; System.Threading.Thread.Sleep(5000); for (byte i = 0; i < 4; i++) { Link.Mykonos.ReadDeframerPrbsCounters(i, ref LaneError[i]); Assert.AreEqual(0x0, LaneError[i]); LaneError[i] = 0x0; } //Enable Error Injection of FPGA PRBS Generator fpgaData = Link.fpgaRead(0x404); Link.fpgaWrite(0x404, (fpgaData | 0x800)); //Let PRBS Run System.Threading.Thread.Sleep(5000); for (byte i = 0; i < 4; i++) { Link.Mykonos.ReadDeframerPrbsCounters(i, ref LaneError[i]); Assert.GreaterOrEqual(LaneError[i], 0x1); } //Check ClearDeframerPrbsCounters Clears Injected Errors Link.Mykonos.clearDeframerPrbsCounters(); for (byte i = 0; i < 4; i++) { Link.Mykonos.ReadDeframerPrbsCounters(i, ref LaneError[i]); Assert.AreEqual(0x0, LaneError[i]); LaneError[i] = 0x0; } Link.Mykonos.enableDeframerPrbsChecker(0xF, PrbsOrder, 0); Link.Disconnect(); }
public static void ObsFramerInjectPrbsErrorCheck([Values(Mykonos.MYK_PRBS_ORDER.PRBS7, Mykonos.MYK_PRBS_ORDER.PRBS15, Mykonos.MYK_PRBS_ORDER.PRBS31)] Mykonos.MYK_PRBS_ORDER PrbsOrder) { AdiCommandServerClient Link = AdiCommandServerClient.Instance; Link.hw.Connect(TestSetupConfig.ipAddr, TestSetupConfig.port); UInt32 fpgaData = 0; byte mykData = 0; UInt32 FpgaLane2ErrCnt = 0; UInt32 FpgaLane3ErrCnt = 0; mykData = Link.spiRead(0x78); Console.WriteLine("SPI Reg x78 = " + mykData.ToString("X")); //Initialise System and JESD Links TestSetup.PrbsORxTestSetupInit(settings); Link.hw.Connect(TestSetupConfig.ipAddr, TestSetupConfig.port); fpgaData = Link.fpgaRead(0x410); Console.WriteLine("FPGA Reg x410: REFCLK Frequency Detect = 0x" + fpgaData.ToString("X") + " = " + fpgaData.ToString()); fpgaData = Link.fpgaRead(0x10); Console.WriteLine("FPGA Version x10:" + fpgaData.ToString("X")); //Enable PRBS Test Mode ON Mykonos and FPGA //Clear counters //Then Check error count is 0 following some delay Link.Mykonos.enableRxFramerPrbs(PrbsOrder, 1); fpgaData = Link.fpgaRead(0x404); switch (PrbsOrder) { case Mykonos.MYK_PRBS_ORDER.PRBS7: fpgaData |= 0x1; break; case Mykonos.MYK_PRBS_ORDER.PRBS15: fpgaData |= 0x2; break; case Mykonos.MYK_PRBS_ORDER.PRBS31: fpgaData |= 0x4; break; default: Assert.Fail("Invalid PRBS Order"); break; } //GTX PRBS Check Counter + GTX PRBS Config Link.fpgaWrite(0x404, fpgaData | 0x18); //Disable PRBS Error Counter Reset fpgaData = Link.fpgaRead(0x404); Link.fpgaWrite(0x404, (fpgaData & 0xFFFFFFF7)); fpgaData = Link.fpgaRead(0x404); Console.WriteLine("FPGA Reg 0x404 = " + fpgaData.ToString("X")); //Read Counters for Lane 0 & 1 fpgaData = Link.fpgaRead(0x420); Console.WriteLine("FPGA Reg 0x420 = " + fpgaData.ToString("X")); //Check Reset Was Successful Assert.AreEqual(fpgaData, 0x0); //Let PRBS Checker Run System.Threading.Thread.Sleep(5000); fpgaData = Link.fpgaRead(0x420); FpgaLane2ErrCnt = fpgaData & 0xFFFF; FpgaLane3ErrCnt = fpgaData >> 16; Console.WriteLine("FPGA Lane 2 Error = " + FpgaLane2ErrCnt.ToString("X")); Console.WriteLine("FPGA Lane 3 Error = " + FpgaLane3ErrCnt.ToString("X")); Assert.Less(FpgaLane2ErrCnt, 0x1); Assert.Less(FpgaLane3ErrCnt, 0x1); //Start Injecting Prbs Errors //Then Check FPGA error count Link.Mykonos.rxInjectPrbsError(); System.Threading.Thread.Sleep(1000); fpgaData = Link.fpgaRead(0x420); FpgaLane2ErrCnt = fpgaData & 0xFFFF; FpgaLane3ErrCnt = fpgaData >> 16; Console.WriteLine("FPGA Lane 2 Error = " + FpgaLane2ErrCnt.ToString("X")); Console.WriteLine("FPGA Lane 3 Error = " + FpgaLane3ErrCnt.ToString("X")); Assert.LessOrEqual(FpgaLane2ErrCnt + FpgaLane3ErrCnt, 0xA); Assert.GreaterOrEqual(FpgaLane2ErrCnt + FpgaLane3ErrCnt, 0x1); Link.Disconnect(); }