public static void CheckGetDeframerFifoInfo() { AdiCommandServerClient Link = AdiCommandServerClient.Instance; Link.hw.Connect(TestSetupConfig.ipAddr, TestSetupConfig.port); byte fifoDepth = 0x0; byte lmcCount = 0x0; byte lmcCountRb = 0xFF; byte FifoDepthRdPtr = 0xFF; byte FifoDepthWrPtr = 0xFF; TestSetup.PrbsRxTestSetupInit(settings); Link.hw.Connect(TestSetupConfig.ipAddr, TestSetupConfig.port); Link.Mykonos.getDeframerFifoDepth(ref fifoDepth, ref lmcCount); lmcCountRb = Link.spiRead(0xAC); FifoDepthRdPtr = Link.spiRead(0x8D); FifoDepthWrPtr = Link.spiRead(0x8E); Console.Write("lmcCountRb:" + lmcCountRb); Console.Write("FifoDepthRdPtr:" + FifoDepthRdPtr); Console.Write("FifoDepthWrPtr:" + FifoDepthWrPtr); Console.Write(fifoDepth); Console.Write(lmcCount); Assert.AreEqual((((FifoDepthRdPtr + 128) - (FifoDepthWrPtr))) % 128, fifoDepth, "FIFO Depth is not as expected"); Assert.AreEqual(lmcCountRb, lmcCount, "LMC Count is not as expected"); }
public static void CheckSetTx1Atten41_95() { AdiCommandServerClient Link = AdiCommandServerClient.Instance; Link.hw.Connect(TestSetupConfig.ipAddr, TestSetupConfig.port); double atten = 41.95; Link.Mykonos.setTx1Attenuation(atten); byte spiData1 = 0x0; double readback = 0; //Check Tx Attenuation Registers have been Updated Console.WriteLine("Test Setup Config Step Size:" + settings.txAttenStepSize.ToString("d")); Link.Mykonos.radioOn(); spiData1 = Link.spiRead(0x96D); Console.WriteLine("Myk: Tx 1 Atten Step Size:" + spiData1.ToString("X")); Assert.AreEqual(settings.txAttenStepSize, ((spiData1 & 0x30) >> 5), "Myk: Tx 1 Atten StepSize not as expected"); spiData1 = Link.spiRead(0x960); Console.WriteLine("Myk Addr: 0x960:" + spiData1.ToString("X")); Assert.AreEqual(0x47, spiData1 & 0xFF, "Myk: Tx 1Attenuation not as expected"); spiData1 = Link.spiRead(0x961); Console.WriteLine("Myk Addr: 0x961:" + spiData1.ToString("X")); Assert.AreEqual(0x03, spiData1 & 0x03, "Myk: Tx 1Attenuation not as expected"); Link.Mykonos.getTx1Attenuation(ref readback); Console.WriteLine("Myk: getTx1Attenuation return value:" + readback.ToString()); Assert.AreEqual(atten, readback, "Myk: Tx Attenuation readback not as expected"); Link.Disconnect(); }
public static void CheckRxOrxSyncBSelection([Values(0x0, 0x1)] byte RxSyncB, [Values(0x0, 0x1)] byte ORxSyncB) { AdiCommandServerClient Link = AdiCommandServerClient.Instance; byte bankId = 0, deviceId = 0, laneId = 0, M = 0, K = 0, scramble = 0; byte externalSysref = 0, serializerLanesEnabled = 0, serializerLaneCrossbar = 0, serializerAmplitude = 0; byte preEmphasis = 0, invertLanePolarity = 0, lmfcOffset = 0, newSysrefOnRelink = 0, enableAutoChanXbar = 0; byte obsRxSyncbSelectTEST = 0xF, overSample = 0; //Use Default JESD Settings Except for SyncB Settings settings.mykRxFrmrCfg.obsRxSyncbSelect = RxSyncB; settings.mykObsRxFrmrCfg.obsRxSyncbSelect = ORxSyncB; TestSetup.TestSetupInit(settings); Link.hw.Connect(TestSetupConfig.ipAddr, TestSetupConfig.port); Link.Mykonos.init_jesd204bframer(0, ref bankId, ref deviceId, ref laneId, ref M, ref K, ref scramble, ref externalSysref, ref serializerLanesEnabled, ref serializerLaneCrossbar, ref serializerAmplitude, ref preEmphasis, ref invertLanePolarity, ref lmfcOffset, ref newSysrefOnRelink, ref enableAutoChanXbar, ref obsRxSyncbSelectTEST, ref overSample); byte RxFramerSyncBSel = Link.spiRead(0x078); byte ORxFramerSyncBSel = Link.spiRead(0xDDF); Console.Write(obsRxSyncbSelectTEST); Console.Write(RxFramerSyncBSel); Console.Write(ORxFramerSyncBSel); Console.Write((RxFramerSyncBSel & 0x80) >> 7); Console.Write((ORxFramerSyncBSel & 0x80) >> 7); Assert.AreEqual(RxSyncB, ((RxFramerSyncBSel & 0x80) >> 7), "RxFramerSyncB Missmatch"); Assert.AreEqual(ORxSyncB, ((ORxFramerSyncBSel & 0x80) >> 7), "ORxFramerSyncB Missmatch"); }
public static void MykonosCheckDeviceRev() { byte[] readarmData = new byte[] { }; AdiCommandServerClient Link = AdiCommandServerClient.Instance; Link.hw.Connect(TestSetupConfig.ipAddr, TestSetupConfig.port); byte spiData1 = 0x0; byte devRev = 0x0; //Test Setup: //Run Init Cals TestSetup.MykonosInitCals(settings); System.Threading.Thread.Sleep(5000); spiData1 = Link.spiRead(0xD40); Console.WriteLine("SPI Addr: 0xD40:" + spiData1.ToString("X")); Assert.AreEqual(0x2, (spiData1 & 0x3), "Myk: Test Setup Failed Init Cals not completed"); //Check Device Revision value Link.Mykonos.getDeviceRev(ref devRev); Assert.GreaterOrEqual(devRev, 0, "Device Revision is less than 1"); Assert.Less(devRev, 4, "Device Revision is more than 3"); Console.WriteLine(devRev); spiData1 = Link.spiRead(0x004); //Check if the function returns the same value as the register Assert.AreEqual(spiData1, devRev, "Function return value not the same as register value"); Link.Disconnect(); }
public static void CheckPaProtectionSetup([Values(0x1E, 0x2BC)] int pwrThres, [Values(0x7, 0x2F)] byte attenStepSz, [Values(0x5, 0xF)] byte avgDur, [Values(0x0, 0x1)] byte enStickyFlg, [Values(0x0, 0x1)] byte enTxAttnCtrl) { AdiCommandServerClient Link = AdiCommandServerClient.Instance; Link.hw.Connect(TestSetupConfig.ipAddr, TestSetupConfig.port); byte spiData1 = 0x0; ushort spiData2 = 0x0; ushort temp = 0x0; Link.Mykonos.SetupPaProtection((ushort)pwrThres, attenStepSz, avgDur, enStickyFlg, enTxAttnCtrl); //Check Sticky Flag Enable //Check Avg Duration spiData1 = Link.spiRead(0x955); Console.WriteLine("PA Cfg 0x955: " + spiData1.ToString("X")); Assert.AreEqual(enStickyFlg, ((spiData1 & 0x40) >> 6), "Myk:PA Sticky Err Flg Enable not as expected"); Assert.AreEqual(avgDur, ((spiData1 & 0x1e) >> 1), "Myk:PA Avg Duration not as expected"); //Check Tx Attenuation Step Size //Check Tx Attn Ctrl Enable spiData1 = Link.spiRead(0x956); Console.WriteLine("PA Cfg 0x956: " + spiData1.ToString("X")); Assert.AreEqual(attenStepSz, ((spiData1 & 0xFE) >> 1), "Myk:PA Tx Attenuation Step Size not as expected"); Assert.AreEqual(enTxAttnCtrl, (spiData1 & 0x1), "Myk:PA Tx Attn Ctrl Enable not as expected"); //Check PA Protection Threshold spiData1 = Link.spiRead(0x957); Console.WriteLine("PA Cfg 0x957: " + spiData1.ToString("X")); spiData2 = Link.spiRead(0x958); Console.WriteLine("PA Cfg 0x958: " + spiData1.ToString("X")); temp = (ushort)(((spiData2 & 0x1F) << 8) | (ushort)(spiData1)); Assert.AreEqual(pwrThres, temp, "Myk: PA Protection Threshold not as expected"); Link.Disconnect(); }
public static void CheckSetRadioOffFromInit() { AdiCommandServerClient Link = AdiCommandServerClient.Instance; Link.hw.Connect(TestSetupConfig.ipAddr, TestSetupConfig.port); UInt32 radioState = 0; byte spiData1 = 0x0; //Test Setup: //Run Init Cals TestSetup.MykonosInitCals(settings); System.Threading.Thread.Sleep(5000); spiData1 = Link.spiRead(0xD40); Console.WriteLine("SPI Addr: 0xD40:" + spiData1.ToString("X")); Assert.AreEqual(0x2, (spiData1 & 0x3), "Myk: Test Setup Failed Radio State is Not in INIT STATE"); //Call API under test Link.Mykonos.radioOff(); //Check Pass Criteria //Radio Status Via Direct Spi Read //Radio Status Via API spiData1 = Link.spiRead(0xD40); Console.WriteLine("SPI Addr: 0xD40:" + spiData1.ToString("X")); Assert.AreEqual(0x02, (spiData1 & 0x03), "Myk: 2 Radio Satus not INIT as Expected"); Link.Mykonos.getRadioState(ref radioState); Console.WriteLine("MYKONOS RadioState = " + radioState.ToString("X")); Assert.AreNotEqual(0x3, (radioState & 0x3), "Myk: 3 Radio State is Still Radio ON"); Assert.AreEqual(0x2, (radioState & 0x3), "Myk: 4 Radio State not INIT"); Console.WriteLine("MYKONOS RadioState = " + radioState.ToString("X")); Link.Disconnect(); }
public static void testsetGpio3v3SourceCtrl() { AdiCommandServerClient Link = AdiCommandServerClient.Instance; Link.hw.Connect(TestSetupConfig.ipAddr, TestSetupConfig.port); byte spiData1 = 0x0; byte spiData2 = 0x0; UInt16 gpio3v3Oe = 0x0; UInt16 readGpioSrc = 0; foreach (Mykonos.GPIO3V3_MODE gpio3v3Mode3_0 in Enum.GetValues(typeof(Mykonos.GPIO3V3_MODE))) { foreach (Mykonos.GPIO3V3_MODE gpio3v3Mode7_4 in Enum.GetValues(typeof(Mykonos.GPIO3V3_MODE))) { foreach (Mykonos.GPIO3V3_MODE gpio3v3Mode11_8 in Enum.GetValues(typeof(Mykonos.GPIO3V3_MODE))) { Link.Mykonos.setGpio3v3SourceCtrl((UInt16)(((byte)gpio3v3Mode3_0 & 0x0F) | (((byte)gpio3v3Mode7_4 & 0x0F) << 4) | (((byte)gpio3v3Mode11_8 & 0x0F) << 8))); Link.spiWrite(0xB06, (byte)(((byte)gpio3v3Mode3_0 & 0x0F) | (((byte)gpio3v3Mode7_4 & 0x0F) << 4))); Link.spiWrite(0xB07, (byte)((byte)gpio3v3Mode11_8 & 0x0F)); spiData1 = Link.spiRead(0xB06); Console.WriteLine("0xB06: " + spiData1.ToString("X")); Assert.AreEqual(gpio3v3Mode3_0, (Mykonos.GPIO3V3_MODE)(spiData1 & 0x0F), "lower byte lower nibble readback not as expexted"); spiData1 = Link.spiRead(0xB06); Console.WriteLine("0xB06: " + spiData1.ToString("X")); Assert.AreEqual(gpio3v3Mode7_4, (Mykonos.GPIO3V3_MODE)((spiData1 & 0xF0) >> 4), "lower byte upper nibble readback not as expexted"); spiData1 = Link.spiRead(0xB07); Console.WriteLine("0xB07: " + spiData1.ToString("X")); Assert.AreEqual(gpio3v3Mode11_8, (Mykonos.GPIO3V3_MODE)(spiData1 & 0x00F), "upper byte lower nibble readback not as expexted"); } } } Link.Disconnect(); }
public static void EnableTxNCO() { /* not working yet */ AdiCommandServerClient Link = AdiCommandServerClient.Instance; Link.hw.Connect(TestSetupConfig.ipAddr, TestSetupConfig.port); string firPath = @"C:\svn\software\projects\mykonos\Filters\"; //TODO: replace with dynamic string txFirFile = firPath + "TxApp49_307p2_BW250_PriSigBW100.ftr"; //Link.Mykonos.programFir(Mykonos.FIR.TX1TX2_FIR, txFirFile); //Link.Mykonos.setEnsmPinMode(0); //Link.Mykonos.setEnsmState(Mykonos.ENSM_STATE.TX_RX); //Link.Mykonos.powerUpTxPath(Mykonos.TXCHANNEL.TX1_TX2); //Move to Radio On ARM state Link.Mykonos.radioOn(); byte spiReg = Link.spiRead(0x1B0); Console.WriteLine("SPI Reg x1B0 = " + spiReg.ToString("X")); spiReg = Link.spiRead(0x1B3); Console.WriteLine("SPI Reg x1B3 = " + spiReg.ToString("X")); Link.spiWrite(0xC40, 0x80); //enable Tx NCO Link.spiWrite(0x9CB, 0x5); //freq Link.spiWrite(0x9CC, 0x5); //freq Link.spiWrite(0x9CD, 0x5); //freq Link.spiWrite(0x9CE, 0x5); //freq Link.Disconnect(); }
public static void testSetRx2GainCtrlPin() { AdiCommandServerClient Link = AdiCommandServerClient.Instance; Link.hw.Connect(TestSetupConfig.ipAddr, TestSetupConfig.port); byte spiData1 = 0x0; int spiData2 = 0x0; int incStep = 7; int decStep = 7; uint gainInc = 0x2000; uint gainDec = 0x4000; int enCh = 1; Link.Mykonos.setRx2GainCtrlPin((byte)incStep, (byte)decStep, gainInc, gainDec, (byte)enCh); int wrtStep = (incStep << 0x05) | (decStep << 0x02) | (enCh << 0x01); int wrtPin = (0x00 | 0x40 | 0x10); spiData2 = Link.spiRead(0x433); spiData2 = (spiData2 & ~0xFE) | (wrtStep & 0xFE); spiData1 = Link.spiRead(0x433); Console.WriteLine("0x433: " + spiData1.ToString("X")); Assert.AreEqual(spiData2, spiData1, "wrtStep not as expected"); spiData2 = Link.spiRead(0x434); spiData2 = (spiData2 & ~0xF0) | (wrtPin & 0xF0); spiData1 = Link.spiRead(0x434); Console.WriteLine("0x434: " + spiData1.ToString("X")); Assert.AreEqual(spiData2, spiData1, "wrtPin not as expected"); Link.Disconnect(); }
public static void testSetGPIOMonitor() { AdiCommandServerClient Link = AdiCommandServerClient.Instance; Link.hw.Connect(TestSetupConfig.ipAddr, TestSetupConfig.port); byte spiData1 = 0x0; byte spiData2 = 0x0; byte monitorIndex; int monitorMask; Link.Mykonos.setupGpio(0x00FF, Mykonos.GPIO_MODE.GPIO_MONITOR_MODE, Mykonos.GPIO_MODE.GPIO_MONITOR_MODE, Mykonos.GPIO_MODE.GPIO_MONITOR_MODE, Mykonos.GPIO_MODE.GPIO_MONITOR_MODE, Mykonos.GPIO_MODE.GPIO_MONITOR_MODE); for (monitorIndex = 0; monitorIndex <= 0x35; monitorIndex++) { for (monitorMask = 0; monitorMask <= 0xFF; monitorMask++) { Link.Mykonos.setGpioMonitorOut(monitorIndex, (byte)monitorMask); spiData1 = Link.spiRead(0xB40); Console.WriteLine("0xB40: " + spiData1.ToString("X")); Assert.AreEqual((monitorIndex), spiData1, "Monitor Index not as expected"); spiData1 = Link.spiRead(0xB41); Console.WriteLine("0xB41: " + spiData1.ToString("X")); Assert.AreEqual((monitorMask), spiData1, "Monitor Mask not as expected"); } } Link.Disconnect(); }
public static void testConfigGpInterrupt([Values((UInt16)0x01, (UInt16)0x02, (UInt16)0x04, (UInt16)0x08, (UInt16)0x1)] UInt16 gpMask) { AdiCommandServerClient Link = AdiCommandServerClient.Instance; Link.hw.Connect(TestSetupConfig.ipAddr, TestSetupConfig.port); byte spiData1 = 0x0; byte spiData2 = 0x0; UInt16 readStatus = 0; Link.Mykonos.configGpInterrupt(gpMask); //int status = ((readStatus & 0xF0) | ((~readStatus) & 0x0F)); spiData1 = Link.spiRead(0xB42); Console.WriteLine("0xB42: " + spiData1.ToString("X")); spiData2 = Link.spiRead(0xB43); Console.WriteLine("0xB43: " + spiData2.ToString("X")); Assert.AreEqual(gpMask & 0xFF, spiData1, "gpMask register 1 not as expected"); Assert.AreEqual(((gpMask >> 8) & 0x01), spiData2, "gpMask register 2 not as expected"); Link.Mykonos.readGpInterruptStatus(ref readStatus); spiData1 = Link.spiRead(0xB44); Console.WriteLine("0xB44: " + spiData1.ToString("X")); spiData2 = Link.spiRead(0xB45); Console.WriteLine("0xB45: " + spiData2.ToString("X")); int status = (int)((((UInt16)(spiData1) & 0xE0U) | ((~(UInt16)(spiData1)) & 0x1F)) | (((UInt16)(spiData2) & 0x0003) << 0x08)); Assert.AreEqual(status, readStatus, "gpMask readback not as expected"); Link.Disconnect(); }
public static void CheckSetTxNcoEnable([Values(6000)] int toneFreq1_kHz, [Values(6000)] int toneFreq2_kHz) { AdiCommandServerClient Link = AdiCommandServerClient.Instance; Link.hw.Connect(TestSetupConfig.ipAddr, TestSetupConfig.port); Link.Mykonos.radioOn(); Link.Mykonos.enableTxNco(1, toneFreq1_kHz, toneFreq2_kHz); byte spiData1 = 0x0; byte spiData2 = 0x0; Int16 tx1Readback = 0x0; Int16 tx2Readback = 0x0; //Check Tx NCO is eanbled spiData1 = Link.spiRead(0xC40); Console.WriteLine("Myk: Tx NCO enable:" + spiData1.ToString("X")); Assert.AreEqual(0x80, ((spiData1 & 0x80)), "Myk: Tx NOC enable not set"); //Check Frequency Settings are as expected as per register map description Int16 tx1NcoTuneWord = (Int16)(((Int64)(toneFreq1_kHz) << 16) / (settings.txProfileData.IqRate_kHz * -1)); Int16 tx2NcoTuneWord = (Int16)(((Int64)(toneFreq2_kHz) << 16) / (settings.txProfileData.IqRate_kHz * -1)); spiData1 = Link.spiRead(0x9CB); spiData2 = Link.spiRead(0x9CC); tx1Readback = (Int16)((Int16)(spiData1 << 8) | (Int16)(spiData2)); Console.Write(tx1Readback.ToString("X")); Assert.AreEqual(tx1NcoTuneWord, tx1Readback); spiData1 = Link.spiRead(0x9CD); spiData2 = Link.spiRead(0x9CE); tx2Readback = (Int16)((Int16)(spiData1 << 8) | (Int16)(spiData2)); Assert.AreEqual(tx2NcoTuneWord, tx2Readback); Console.Write(tx2Readback.ToString("X")); Link.Disconnect(); }
public static void testSetGpio3v3PinLevel([Values((UInt16)0x01, (UInt16)0x10)] UInt16 gpio3v3PinLevel) { AdiCommandServerClient Link = AdiCommandServerClient.Instance; Link.hw.Connect(TestSetupConfig.ipAddr, TestSetupConfig.port); byte spiData1 = 0x0; byte spiData2 = 0x0; UInt16 gpio3v3Oe = 0xFF; ushort gpio3v3SetLevelReadback = 0x0; Mykonos.GPIO3V3_MODE gpio3v3Mode3_0 = Mykonos.GPIO3V3_MODE.GPIO3V3_BITBANG_MODE; Mykonos.GPIO3V3_MODE gpio3v3Mode7_4 = Mykonos.GPIO3V3_MODE.GPIO3V3_BITBANG_MODE; Mykonos.GPIO3V3_MODE gpio3v3Mode11_8 = Mykonos.GPIO3V3_MODE.GPIO3V3_BITBANG_MODE; Link.Mykonos.setupGpio3v3(gpio3v3Oe, gpio3v3Mode3_0, gpio3v3Mode7_4, gpio3v3Mode11_8); Link.Mykonos.setGpio3v3PinLevel(gpio3v3PinLevel); Link.Mykonos.getGpio3v3SetLevel(ref gpio3v3SetLevelReadback); spiData1 = Link.spiRead(0xB02); Console.WriteLine("0xB02: " + spiData1.ToString("X")); spiData2 = Link.spiRead(0xB03); Console.WriteLine("0xB03: " + spiData2.ToString("X")); Assert.AreEqual(gpio3v3PinLevel & 0xFF, spiData1, "GPIO3v3 7-0 not as expected"); Assert.AreEqual((gpio3v3PinLevel >> 8) & 0x0F, spiData2, "GPIO3v3 15-8 not as expected"); Assert.AreEqual(gpio3v3PinLevel, gpio3v3SetLevelReadback, "GPIO3v3 set level readback not as expexted"); Link.Disconnect(); }
public static void testSetupGpio3v3([Values(Mykonos.GPIO3V3_MODE.GPIO3V3_LEVELTRANSLATE_MODE, Mykonos.GPIO3V3_MODE.GPIO3V3_INVLEVELTRANSLATE_MODE, Mykonos.GPIO3V3_MODE.GPIO3V3_BITBANG_MODE, Mykonos.GPIO3V3_MODE.GPIO3V3_EXTATTEN_LUT_MODE)] Mykonos.GPIO3V3_MODE gpio3v3Mode3_0, [Values(Mykonos.GPIO3V3_MODE.GPIO3V3_LEVELTRANSLATE_MODE, Mykonos.GPIO3V3_MODE.GPIO3V3_INVLEVELTRANSLATE_MODE, Mykonos.GPIO3V3_MODE.GPIO3V3_BITBANG_MODE, Mykonos.GPIO3V3_MODE.GPIO3V3_EXTATTEN_LUT_MODE)] Mykonos.GPIO3V3_MODE gpio3v3Mode7_4, [Values(Mykonos.GPIO3V3_MODE.GPIO3V3_LEVELTRANSLATE_MODE, Mykonos.GPIO3V3_MODE.GPIO3V3_INVLEVELTRANSLATE_MODE, Mykonos.GPIO3V3_MODE.GPIO3V3_BITBANG_MODE, Mykonos.GPIO3V3_MODE.GPIO3V3_EXTATTEN_LUT_MODE)] Mykonos.GPIO3V3_MODE gpio3v3Mode11_8) { AdiCommandServerClient Link = AdiCommandServerClient.Instance; Link.hw.Connect(TestSetupConfig.ipAddr, TestSetupConfig.port); byte spiData1 = 0x0; byte spiData2 = 0x0; UInt16 gpio3v3Oe = 0xFF; Link.Mykonos.setupGpio3v3(gpio3v3Oe, gpio3v3Mode3_0, gpio3v3Mode7_4, gpio3v3Mode11_8); //Check GPIO3v3 direction control bit spiData1 = Link.spiRead(0xB00); Console.WriteLine("0xB00: " + spiData1.ToString("X")); Assert.AreEqual(gpio3v3Oe & 0xFF, spiData1, "GPIO3v3 direction control bit 7-0 not as expected"); spiData1 = Link.spiRead(0xB01); Console.WriteLine("0xB01: " + spiData1.ToString("X")); Assert.AreEqual((gpio3v3Oe >> 8) & 0x0F, spiData1, "GPIO3v3 direction control bit 15-8 not as expected"); //Check GPIO3v3 spiData1 = Link.spiRead(0xB06); Console.WriteLine("0xB06: " + spiData1.ToString("X")); spiData2 = Link.spiRead(0xB07); Console.WriteLine("0xB07: " + spiData2.ToString("X")); Assert.AreEqual(((((byte)gpio3v3Mode7_4) << 4) | (byte)gpio3v3Mode3_0), spiData1, "GPIO3v3 LSB not as expected"); Assert.AreEqual(((byte)gpio3v3Mode11_8 & 0x0F), spiData2, "GPIO3v3 MSB not as expected"); Link.Disconnect(); }
public static void MykonosReadTIA3dbCorner() { AdiCommandServerClient Link = AdiCommandServerClient.Instance; Link.hw.Connect(TestSetupConfig.ipAddr, TestSetupConfig.port); Link.setSpiChannel(TestSetup.MykonosSpi); //Just for debug -read TIA 3dB corner byte spiReg = 0; double rx1TiaCap = 480; //fF double rx2TiaCap = 480; //fF spiReg = Link.spiRead(0x224); Debug.WriteLine("0xRCAL code = " + spiReg.ToString("X")); spiReg = Link.spiRead(0x693); Debug.WriteLine("0x693 = " + spiReg.ToString("X")); rx1TiaCap += ((spiReg & 0x3F) * 10); spiReg = Link.spiRead(0x694); Debug.WriteLine("0x694 = " + spiReg.ToString("X")); rx1TiaCap += ((spiReg & 0x1F) * 320); Console.WriteLine("Rx1 TIA 3dB corner = " + (1 / (2 * System.Math.PI * 1100 * rx1TiaCap * System.Math.Pow(10, -9))) + " MHz"); spiReg = Link.spiRead(0x695); Debug.WriteLine("0x695 = " + spiReg.ToString("X")); rx2TiaCap += ((spiReg & 0x3F) * 10); spiReg = Link.spiRead(0x696); Debug.WriteLine("0x696 = " + spiReg.ToString("X")); rx2TiaCap += ((spiReg & 0x1F) * 320); Console.WriteLine("Rx1 TIA 3dB corner = " + (1 / (2 * System.Math.PI * 1100 * rx2TiaCap * System.Math.Pow(10, -9))) + " MHz"); Link.Disconnect(); }
public static void SetupAuxDacs() { AdiCommandServerClient Link = AdiCommandServerClient.Instance; Link.hw.Connect(TestSetupConfig.ipAddr, TestSetupConfig.port); /* * Link.setSpiChannel(1); * * //config[7] = 1 = add comp cap 400fF * //config[6] = AuxDAC step size (1= 12bit resolution, 0 = 11bit resolution) * //config[5:4] = VREF = 1 + ([5:4] * 0.5) * Link.spiWrite(0xBA0, 0x00); //AuxDAC0 config[7:4], AuxDAC0[11:8] (xBA0 - xBB3) * Link.spiWrite(0xBA1, 0x00); //AuxDAC0 [7:0] * * Link.spiWrite(0xB73, 0x3F); //enable manual mode for All AuxDACS [5:0] * Link.spiWrite(0xB74, 0x0F); //enable manual mode for All AuxDACS [9:6] * Link.spiWrite(0xB75, 0x3E); //clear power down bit for AuxDAC0 on GPIO 3.3[9] * Link.spiWrite(0xB76, 0x0F); * * Debug.WriteLine("0xB73: " + Link.spiRead(0xB73).ToString("X")); * Debug.WriteLine("0xB74: " + Link.spiRead(0xB74).ToString("X")); * Debug.WriteLine("0xB75: " + Link.spiRead(0xB75).ToString("X")); * Debug.WriteLine("0xB76: " + Link.spiRead(0xB76).ToString("X")); * * * * //Link.Mykonos.radioOn(); //autotoggle mode will follow the SPI bits as well if ENSM are in SPI mode. * //Link.spiWrite(0x1b0, 0x89); */ Link.hw.ReceiveTimeout = 0; UInt16 auxDacEnableMask = 0x0201; UInt16[] auxDacCode = new UInt16[] { 0, 10, 20, 30, 40, 50, 60, 70, 80, 512 }; Byte[] auxDacSlope = new Byte[] { 0, 1, 0, 1, 0, 1, 1, 1, 0, 0 }; Byte[] auxDacVref = new Byte[] { 0, 1, 2, 3, 0, 1, 2, 3, 0, 3 }; Link.Mykonos.init_auxDacStructure(1, ref auxDacEnableMask, ref auxDacCode, ref auxDacSlope, ref auxDacVref); Link.Mykonos.setupAuxDacs(); Link.hw.ReceiveTimeout = 5000; Debug.WriteLine("0xB73: " + Link.spiRead(0xB73).ToString("X")); Debug.WriteLine("0xB74: " + Link.spiRead(0xB74).ToString("X")); Debug.WriteLine("0xB75: " + Link.spiRead(0xB75).ToString("X")); Debug.WriteLine("0xB76: " + Link.spiRead(0xB76).ToString("X")); Link.Disconnect(); }
public static void CheckRunInitCalsFromReady() { AdiCommandServerClient Link = AdiCommandServerClient.Instance; Link.hw.Connect(TestSetupConfig.ipAddr, TestSetupConfig.port); Link.hw.ReceiveTimeout = 0; Link.setSpiChannel(MykonosSpi); byte spiData1 = 0x0; Console.WriteLine("Starting CheckRunInitCalsFromReady Test"); //Test Setup Check ARM in READY STATE spiData1 = Link.spiRead(0xD40); Console.WriteLine("SPI Addr: 0xD40:" + spiData1.ToString("X")); Assert.AreEqual(0x1, (spiData1 & 0x3), "Myk: Test Setup Failed Radio State is Not in READY STATE"); //Run Init Cals UInt32 testCalMask = 0x0; testCalMask = settings.calMask; Console.WriteLine("Test Setup: Cals" + testCalMask.ToString("X")); TestSetup.MykonosInitCals(settings); System.Threading.Thread.Sleep(10000); //Check ARM in INIT STATE //Via SPI Readback //Via API UInt32 radioState = 0; spiData1 = Link.spiRead(0xD40); Console.WriteLine("SPI Addr: 0xD40:" + spiData1.ToString("X")); Assert.AreEqual(0x2, (spiData1 & 0x3), "Myk: 1 Radio State is Not in INIT STATE"); Link.Mykonos.getRadioState(ref radioState); Console.WriteLine("MYKONOS RadioState = " + radioState.ToString("X")); Assert.AreEqual(0x2, (radioState & 0x3), "Myk: 2 Radio State not INIT"); //Check which Init calibrations were //Completed Sucessfully during last RUN_INIT byte[] armData = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0 }; Link.Mykonos.sendArmCommand(GetCmd, new byte[] { IntCalsDoneObjId }, 1); Link.Mykonos.readArmMem(0x20000000, 8, 1, ref armData); //armData[1] is the calmask [15:8], and armData[0] is calmask[7:0] since last init //armData[2] is the calmask [15:8], and armData[3] is calmask[7:0] since power up Console.WriteLine("Init Cals Requested: " + testCalMask.ToString("X")); Console.WriteLine("Init Cals Done Last Power Up: " + armData[2].ToString("X") + armData[3].ToString("X")); Console.WriteLine("Init Cals Done Last Init: " + armData[1].ToString("X") + armData[0].ToString("X")); Assert.AreEqual(testCalMask, ((UInt32)(((UInt32)(armData[1]) << 8) | ((UInt32)(armData[0])))), "Init Cals did not match the mask written to ARM memory"); Link.Disconnect(); }
public static void MykonosCheckInitCals() { AdiCommandServerClient Link = AdiCommandServerClient.Instance; Link.hw.Connect(TestSetupConfig.ipAddr, TestSetupConfig.port); Link.setSpiChannel(TestSetup.MykonosSpi); Console.WriteLine("InitArmCal(0x" + settings.calMask.ToString("X") + ")"); Console.WriteLine("SPIRead x119: " + Link.spiRead(0x119).ToString("X")); Console.WriteLine("SPIReadxD34: " + Link.spiRead(0xD34).ToString("X")); Link.Disconnect(); }
public void DpdApiTestInit() { settings = new TestSetupConfig(); AdiCommandServerClient Link = AdiCommandServerClient.Instance; //Start Calibration UInt32 calMask = (UInt32)(Mykonos.CALMASK.TX_BB_FILTER) | (UInt32)(Mykonos.CALMASK.ADC_TUNER) | (UInt32)(Mykonos.CALMASK.TIA_3DB_CORNER) | (UInt32)(Mykonos.CALMASK.DC_OFFSET) | (UInt32)(Mykonos.CALMASK.FLASH_CAL) | (UInt32)(Mykonos.CALMASK.PATH_DELAY) | (UInt32)(Mykonos.CALMASK.TX_LO_LEAKAGE_INTERNAL) | (UInt32)(Mykonos.CALMASK.TX_QEC_INIT) | (UInt32)(Mykonos.CALMASK.LOOPBACK_RX_LO_DELAY) | (UInt32)(Mykonos.CALMASK.LOOPBACK_RX_RX_QEC_INIT) | //(UInt32)(Mykonos.CALMASK.DPD_INIT) | (UInt32)(Mykonos.CALMASK.RX_QEC_INIT); settings.calMask = calMask; //Call Test Setup TestSetup.DpdTestSetupInit(settings); //Test Setup Ensure now in Init State Link.hw.Connect(TestSetupConfig.ipAddr, TestSetupConfig.port); byte spiData1 = Link.spiRead(0xD40); Console.WriteLine("SPI Addr: 0xD40:" + spiData1.ToString("X")); Assert.AreEqual(0x2, (spiData1 & 0x3), "Myk: Test Setup Failed Radio State is Not in INIT STATE"); Link.hw.Disconnect(); }
public static void CheckGetPendingTrackingCals() { AdiCommandServerClient Link = AdiCommandServerClient.Instance; Link.hw.Connect(TestSetupConfig.ipAddr, TestSetupConfig.port); //Link.Mykonos.setObsRxPathSource(Mykonos.OBSRXCHANNEL.OBS_INTERNALCALS); UInt32 calmask = 0; byte spiData1 = 0x0; Mykonos.OBSRXCHANNEL channel = Mykonos.OBSRXCHANNEL.OBS_RXOFF; //Test Setup: //Run Init Cals TestSetup.MykonosInitCals(settings); System.Threading.Thread.Sleep(5000); Link.Mykonos.getPendingTrackingCals(ref calmask); Console.WriteLine("calmask: " + calmask); spiData1 = Link.spiRead(0xD40); Console.WriteLine("SPI Addr: 0xD40:" + spiData1.ToString("X")); Assert.AreEqual(0x2, (spiData1 & 0x3), "Myk: Test Setup Failed Init Cals not completed"); //Enable RxQEC and TxQEC tracking cals Link.Mykonos.enableTrackingCals((UInt32)(195)); Link.Mykonos.radioOn(); Link.Mykonos.getPendingTrackingCals(ref calmask); //Check that those tracking cals are pending Assert.AreEqual(calmask, 20485, "incorrect calibrations are pending"); Console.WriteLine("calmask: " + calmask); Link.Disconnect(); }
public static void CheckInitTrackingCals() { AdiCommandServerClient Link = AdiCommandServerClient.Instance; Link.hw.Connect(TestSetupConfig.ipAddr, TestSetupConfig.port); Link.hw.ReceiveTimeout = 0; byte spiData1 = 0x0; UInt32 calmask = 0; //Test Setup: //Run Init Cals //And check INIT TestSetup.MykonosInitCals(settings); System.Threading.Thread.Sleep(5000); spiData1 = Link.spiRead(0xD40); Console.WriteLine("SPI Addr: 0xD40:" + spiData1.ToString("X")); Assert.AreEqual(0x2, (spiData1 & 0x3), "Myk: Test Setup Failed Init Cals not completed"); //Call API Under Test for (int i = 0; i <= 0x3ff; i++) { Link.Mykonos.enableTrackingCals((UInt32)(i)); Link.hw.ReceiveTimeout = 5000; Link.Mykonos.getEnabledTrackingCals(ref calmask); //Console.WriteLine("Enabled tracking calmask: " + calmask); Assert.AreEqual(i, calmask, "Tracking calmask did not match the mask returned from the function"); } Link.Disconnect(); }
public void ArmApiTestInit() { AdiCommandServerClient Link = AdiCommandServerClient.Instance; //Start Calibration UInt32 calMask = (UInt32)(Mykonos.CALMASK.TX_BB_FILTER) | (UInt32)(Mykonos.CALMASK.ADC_TUNER) | (UInt32)(Mykonos.CALMASK.TIA_3DB_CORNER) | (UInt32)(Mykonos.CALMASK.DC_OFFSET) | (UInt32)(Mykonos.CALMASK.FLASH_CAL) | (UInt32)(Mykonos.CALMASK.PATH_DELAY) | (UInt32)(Mykonos.CALMASK.TX_LO_LEAKAGE_INTERNAL) | (UInt32)(Mykonos.CALMASK.TX_QEC_INIT) | (UInt32)(Mykonos.CALMASK.LOOPBACK_RX_LO_DELAY) | (UInt32)(Mykonos.CALMASK.LOOPBACK_RX_RX_QEC_INIT) | //(UInt32)(Mykonos.CALMASK.RX_LO_DELAY) | (UInt32)(Mykonos.CALMASK.RX_QEC_INIT); settings.calMask = calMask; //Call Test Setup TestSetup.ArmTestSetupInit(settings); //Radio Status Via Direct Spi Read byte spiData1 = 0x0; Link.hw.Connect(TestSetupConfig.ipAddr, TestSetupConfig.port); spiData1 = Link.spiRead(0xD40); Console.WriteLine("SPI Addr: 0xD40:" + spiData1.ToString("X")); Assert.AreEqual(0x1, (spiData1 & 0x3), "ArmApiFunctional Test Setup: Radio State not READY"); Console.WriteLine("ArmApiFunctional Test Setup: Complete"); Link.Disconnect(); }
public static void EnableDeframerPrbsChecker([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); //setting SPI channel for 4-wire mode Link.setSpiChannel(1); Link.spiWrite(0x000, 0x18); Link.Mykonos.enableDeframerPrbsChecker(0xF, prbsorder, 1); byte PRBSspi = Link.spiRead(0xA5); if (prbsorder == Mykonos.MYK_PRBS_ORDER.PRBS7) { Assert.AreEqual(PRBSspi, 0xF1, "PRBS7 mismatch"); } else if (prbsorder == Mykonos.MYK_PRBS_ORDER.PRBS15) { Assert.AreEqual(PRBSspi, 0xF3, "PRBS15 mismatch"); } else { Assert.AreEqual(PRBSspi, 0xF5, "PRBS31 mismatch"); } Link.Disconnect(); }
public static void EnableRxFramerPrbs([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); //reset the device Link.Mykonos.resetDevice(); System.Threading.Thread.Sleep(100); //setting SPI channel for 4-wire mode Link.setSpiChannel(1); Link.spiWrite(0x000, 0x18); Link.Mykonos.enableRxFramerPrbs(prbsorder, 1); byte PRBSspi = Link.spiRead(0x72); if (prbsorder == Mykonos.MYK_PRBS_ORDER.PRBS7) { Assert.AreEqual(PRBSspi, 0x01, "PRBS7 mismatch"); } else if (prbsorder == Mykonos.MYK_PRBS_ORDER.PRBS15) { Assert.AreEqual(PRBSspi, 0x03, "PRBS15 mismatch"); } else { Assert.AreEqual(PRBSspi, 0x05, "PRBS31 mismatch"); } Link.Disconnect(); }
public static void CheckGetDacPower([Values(Mykonos.TXCHANNEL.TX1, Mykonos.TXCHANNEL.TX2)] Mykonos.TXCHANNEL TxCh) { AdiCommandServerClient Link = AdiCommandServerClient.Instance; Link.hw.Connect(TestSetupConfig.ipAddr, TestSetupConfig.port); byte spiData1 = 0x0; byte spiData2 = 0x0; byte channelPowerMsbMask = 0x03; UInt16 dacPower = 0; Link.Mykonos.GetDacPower(TxCh, ref dacPower); spiData1 = Link.spiRead(0x959); Console.WriteLine("power readback LSB: " + spiData1.ToString("X")); spiData2 = Link.spiRead(0x95A); Console.WriteLine("power readback MSB: " + spiData1.ToString("X")); Assert.AreEqual(dacPower, (spiData1 | (((UInt16)(spiData2 & channelPowerMsbMask)) << 8)), "Myk:PA Protection readback not as expected"); Link.Disconnect(); }
public static void ReadAuxAdc() { AdiCommandServerClient Link = AdiCommandServerClient.Instance; Link.hw.Connect(TestSetupConfig.ipAddr, TestSetupConfig.port); Link.hw.ReceiveTimeout = 0; Link.Mykonos.setAuxAdcChannel(3); UInt16 auxAdcCode = Link.Mykonos.readAuxAdc(); Debug.WriteLine("AuxADC Code: " + auxAdcCode); Link.hw.ReceiveTimeout = 5000; Debug.WriteLine("0xBC0: " + Link.spiRead(0xBC0).ToString("X")); Debug.WriteLine("0xBC1: " + Link.spiRead(0xBC1).ToString("X")); Debug.WriteLine("0xBC2: " + Link.spiRead(0xBC2).ToString("X")); Debug.WriteLine("0xBC3: " + Link.spiRead(0xBC3).ToString("X")); Debug.WriteLine("0xBC4: " + Link.spiRead(0xBC4).ToString("X")); Debug.WriteLine("0xBC5: " + Link.spiRead(0xBC5).ToString("X")); Debug.WriteLine("0xBC6: " + Link.spiRead(0xBC6).ToString("X")); Link.Disconnect(); }
public static void writeAuxDac() { AdiCommandServerClient Link = AdiCommandServerClient.Instance; Link.hw.Connect(TestSetupConfig.ipAddr, TestSetupConfig.port); Link.hw.ReceiveTimeout = 0; Link.Mykonos.writeAuxDac(0, 512); Link.hw.ReceiveTimeout = 5000; Debug.WriteLine("0xB73: " + Link.spiRead(0xB73).ToString("X")); Debug.WriteLine("0xB74: " + Link.spiRead(0xB74).ToString("X")); Debug.WriteLine("0xB75: " + Link.spiRead(0xB75).ToString("X")); Debug.WriteLine("0xB76: " + Link.spiRead(0xB76).ToString("X")); Link.Disconnect(); }
public static void ReadRxGainTable() { AdiCommandServerClient Link = AdiCommandServerClient.Instance; Link.hw.Connect(TestSetupConfig.ipAddr, TestSetupConfig.port); byte spiReg1 = 0; byte spiReg2 = 0; byte index = 0; byte feGain = 0; byte extControl = 0; byte digGain = 0; byte enableAtten = 0; Link.setSpiChannel(1); Link.spiWrite(0x00A, 0x84); spiReg1 = Link.spiRead(0x00A); Console.WriteLine("Scratch Reg Test: " + spiReg1.ToString("X")); Assert.AreEqual(0x84, spiReg1, "SPI not working"); Link.spiWrite(0x516, 0x0C); //Enable Rx1 gain table for readback Int16[] coefs = new Int16[128]; for (byte i = 255; i > 128; i--) { Link.spiWrite(0x500, i); index = Link.spiRead(0x50A); feGain = Link.spiRead(0x50B); extControl = Link.spiRead(0x50C); spiReg2 = Link.spiRead(0x50D); digGain = (byte)(spiReg2 & 0x7F); enableAtten = (byte)(spiReg2 >> 7); Console.WriteLine(index + ", " + feGain + ", " + extControl + ", " + digGain + ", " + enableAtten); } Link.spiWrite(0x516, 0x08); //Enable Rx1 gain table for readback Link.Disconnect(); }
//[Test] public static void MykonosCheckReset() { AdiCommandServerClient Link = AdiCommandServerClient.Instance; Link.hw.Connect(TestSetupConfig.ipAddr, TestSetupConfig.port); //Check that ENSM status is no longer in Alert State following Reset byte spiData1 = 0x0; spiData1 = Link.spiRead(0x1B3); Console.Write("0x1B3: " + spiData1.ToString("x")); Link.Mykonos.resetDevice(); System.Threading.Thread.Sleep(5000); spiData1 = Link.spiRead(0x1B3); Console.Write("0x1B3: " + spiData1.ToString("x")); Assert.AreEqual(0xFF, spiData1); Link.Disconnect(); }
public static void testSetGpioPinLevel([Values((UInt32)0x40, (UInt32)0x40000)] UInt32 gpioPinLevel) { AdiCommandServerClient Link = AdiCommandServerClient.Instance; Link.hw.Connect(TestSetupConfig.ipAddr, TestSetupConfig.port); UInt32 spiData1 = 0x0; UInt32 spiData2 = 0x0; UInt32 spiData3 = 0x0; UInt32 gpioSetLevelReadback = 0x0; UInt32 gpioReadback = 0x0; //set 9 of the GPIO pins as outputs and the other 9 as inputs uint gpioOe = 0x55554; //set all the source nibbles to the GPIO_BITBANG_MODE Mykonos.GPIO_MODE gpioMode3_0 = Mykonos.GPIO_MODE.GPIO_BITBANG_MODE; Mykonos.GPIO_MODE gpioMode7_4 = Mykonos.GPIO_MODE.GPIO_BITBANG_MODE; Mykonos.GPIO_MODE gpioMode11_8 = Mykonos.GPIO_MODE.GPIO_BITBANG_MODE; Mykonos.GPIO_MODE gpioMode15_12 = Mykonos.GPIO_MODE.GPIO_BITBANG_MODE; Mykonos.GPIO_MODE gpioMode18_16 = Mykonos.GPIO_MODE.GPIO_BITBANG_MODE; Link.Mykonos.setupGpio(gpioOe, gpioMode3_0, gpioMode7_4, gpioMode11_8, gpioMode15_12, gpioMode18_16); Link.Mykonos.setGpioPinLevel(gpioPinLevel); spiData1 = Link.spiRead(0xB23); Console.WriteLine("0xB23: " + spiData1.ToString("X")); spiData2 = Link.spiRead(0xB24); Console.WriteLine("0xB24: " + spiData2.ToString("X")); spiData3 = Link.spiRead(0xB25); Console.WriteLine("0xB25: " + spiData1.ToString("X")); Link.Mykonos.getGpioSetLevel(ref gpioSetLevelReadback); Link.Mykonos.getGpioPinLevel(ref gpioReadback); spiData1 = Link.spiRead(0xB23); Console.WriteLine("0xB23: " + spiData1.ToString("X")); spiData2 = Link.spiRead(0xB24); Console.WriteLine("0xB24: " + spiData2.ToString("X")); spiData3 = Link.spiRead(0xB25); Console.WriteLine("0xB25: " + spiData1.ToString("X")); spiData1 = Link.spiRead(0xB26); Console.WriteLine("0xB26: " + spiData1.ToString("X")); spiData2 = Link.spiRead(0xB27); Console.WriteLine("0xB27: " + spiData2.ToString("X")); spiData3 = Link.spiRead(0xB28); Console.WriteLine("0xB28: " + spiData1.ToString("X")); Assert.AreEqual(gpioPinLevel, gpioSetLevelReadback, "GPIO set Level readback not as expected"); Assert.AreEqual((((spiData3 & 0x07) << 16) | (spiData2 << 8) | spiData1), gpioReadback, "GPIO readback not as expexted"); Assert.AreEqual(gpioPinLevel >> 1, gpioReadback, "GPIO input not as expected"); Link.Disconnect(); }