diff --git a/LTS_clk.yaml b/LTS_clk.yaml index cb4572b3583ac9b643b51d9a39a5f59195f2eaf1..58ae764f2450bfe0eb7c1be8ace23df2842e28c4 100644 --- a/LTS_clk.yaml +++ b/LTS_clk.yaml @@ -55,20 +55,17 @@ Variables: # var_bitoffset: 5 # var_R/W: RO - # - var_name: CONF -# var_dev: IO3.CONF1 -# var_width: 8 -# var_R/W: RO + - var_name: CONF + var_dev: IO3.CONF1 + var_width: 8 - # - var_name: OUT -# var_dev: IO3.OUT1 -# var_width: 8 -# var_R/W: RO + - var_name: OUT + var_dev: IO3.OUT1 + var_width: 8 - # - var_name: IN -# var_dev: IO3.IN1 -# var_width: 8 -# var_R/W: RO + - var_name: IN + var_dev: IO3.IN1 + var_width: 8 Methods: diff --git a/LTS_clkPLL.yaml b/LTS_clkPLL.yaml index 0bee1a69616db003f4bf27e7a81134bfdd64d68f..c6e99bb74ccc33cc5454bbc8b10766e1f8948d44 100644 --- a/LTS_clkPLL.yaml +++ b/LTS_clkPLL.yaml @@ -5,28 +5,6 @@ I2C_devices: dev_registers: - reg_name: a0 reg_addr: 0x00 - - reg_name: a3 - reg_addr: 0x03 - - reg_name: a5 - reg_addr: 0x05 - - reg_name: a6 - reg_addr: 0x06 - - reg_name: a7 - reg_addr: 0x07 - - reg_name: a8 - reg_addr: 0x08 - - reg_name: a9 - reg_addr: 0x09 - - reg_name: aA - reg_addr: 0x0A - - reg_name: aD - reg_addr: 0x0D - - reg_name: aF - reg_addr: 0x0F - - reg_name: a11 - reg_addr: 0x11 - - reg_name: a13 - reg_addr: 0x13 Variables: - var_name: locked @@ -38,28 +16,28 @@ Methods: - method_name: Power_off method_invisible: 1 registers: - - PLL1.a3: [0x88] + - PLL1.3: [0x88] - method_name: Power_on method_invisible: 1 registers: - - PLL1.a3: [0x08] + - PLL1.3: [0x08] - method_name: Reset method_invisible: 1 registers: - - PLL1.a3: [0x0C] + - PLL1.3: [0x0C] - method_name: Setup method_invisible: 1 registers: - - PLL1.a3: [0x08] - - PLL1.a5: [0x97] - - PLL1.a6: [0x10] - - PLL1.a7: [0x04] - - PLL1.a8: [0x01] - - PLL1.a7: [0x00] - - PLL1.a9: [0x10] - - PLL1.aA: [0x14] - - PLL1.a9: [0x00] - - PLL1.aD: [0x01] #02? - - PLL1.aF: [0x01] - - PLL1.a11: [0x01] - - PLL1.a13: [0x01] + - PLL1.3: [0x08] + - PLL1.5: [0x97] + - PLL1.6: [0x10] + - PLL1.7: [0x04] + - PLL1.8: [0x01] + - PLL1.7: [0x00] + - PLL1.9: [0x10] + - PLL1.10: [0x14] #0x0A + - PLL1.9: [0x00] + - PLL1.13: [0x01] #0x0D + - PLL1.15: [0x01] #0x0F + - PLL1.17: [0x01] #0x11 + - PLL1.19: [0x01] #0x13 diff --git a/LTS_pypcc.yaml b/LTS_pypcc.yaml index 465ff180e34d26bb663bc96cee55b4e163745387..a059a312ba6e84e319a4a0eb09d9743a7b0e7e4d 100644 --- a/LTS_pypcc.yaml +++ b/LTS_pypcc.yaml @@ -1,6 +1,5 @@ dev_name: PCC_I2C dev_children: -# - child_name: Switch1 - child_dev : I2Cswitch child_conf: LTS_switch - child_addr: 1 \ No newline at end of file + child_addr: 1 #I2C port on raspberry pi \ No newline at end of file diff --git a/LTS_switch.yaml b/LTS_switch.yaml index 510cb8c2fcbd0857555d195a9233df389a1d3cef..4b843b5f126778d3272161ff2a2b3cbd2e8ae1a5 100644 --- a/LTS_switch.yaml +++ b/LTS_switch.yaml @@ -1,8 +1,7 @@ dev_name: Switch1 -dev_address: 0x70 #A0,1,2=0 -#dev_device: TCA9548 +dev_address: 0x70 +dev_device: TCA9548 # LTS midplane: I2C 0-5 = RCU 0-5, I2C 6 = UNB2_N0, I2C 7 = UNB2 -# Todo: change RCU-5 to Clock board dev_children: - child_name: RCU01 child_dev: I2Cdevices diff --git a/README.md b/README.md index 85fb769803b61180b6192e491a9df99c41944124..5b1056dff1fbf85e8089725ff6fbb9c5a91f76c3 100644 --- a/README.md +++ b/README.md @@ -2,4 +2,13 @@ # PyPCC Python OPC-UA server to control the I2C devices in the LTS. -+ opcuserv.py: OPC-UA server that expose (visible) variables and methods. ++ opcuserv.py: OPC-UA server that expose (visible) variables and methods. + +LTS structure: +> Raspberry pi (LTS_pypcc.yaml -> I2C controller on raspberry pi) +>> Control PCB (LTS_switch.yaml -> I2C switch) +>>> RCU2 PCB (LTS_RCUx.yaml -> I2C devices) +>>>> RCU2 Dither source (LTS_RCU2_dither.yaml -> I2C bitbang) +>>>> ADC (LTS_RCU2_ADC.yaml -> SPI bitbang2) +>>> Clock PCB (LTS_clk.yaml I2C device) +>>>> PLL (LTS_clkPLL.yaml -> SPI bitbang1) diff --git a/SPIbitbang2.py b/SPIbitbang2.py index bc12db43a7899d5269a2c0938c7f23df367a5131..9badad3e3fe497fec087167b7dc680e5df63e318 100644 --- a/SPIbitbang2.py +++ b/SPIbitbang2.py @@ -5,7 +5,7 @@ class SPIbitbang2(I2Cdevices): def I2CSet(self,dev,reg,value,I2Ccallback,width=8,bitoffset=0): SPI=Find(self.D['I2C_devices'],'dev_name',dev) Reg=Find(SPI['dev_registers'],'reg_name',reg) - reg_address=Reg['reg_addr'] + reg_address=(Reg['reg_addr'] if Reg else int(reg)) SetBit=I2Ccallback # dev_rw = 0x00 # 0 for write, 1 for read @@ -27,7 +27,7 @@ class SPIbitbang2(I2Cdevices): SPI=Find(self.D['I2C_devices'],'dev_name',dev) Reg=Find(SPI['dev_registers'],'reg_name',reg) - reg_address=Reg['reg_addr'] + reg_address=(Reg['reg_addr'] if Reg else int(reg)) # print(ADC_reg_address,CS,SDIOdir,SDI,SDO,CLK) SetBit=I2Ccallback ADC_bytes = 0x00 diff --git a/test_ADCs.py b/test_ADCs.py index 5c1cea71a7fd11c7e7e9441440064be1116f59f6..b0c18ee84b543a7cc85afa692d4a3a92dfed3f63 100644 --- a/test_ADCs.py +++ b/test_ADCs.py @@ -1,4 +1,5 @@ -import pypcc; +#import pypcc; +import pypcc_test as pypcc; P1=pypcc.pypcc("LTS_pypcc.yaml") diff --git a/test_clk.py b/test_clk.py index 98ba0a8e50cb331784705555088a0e2c80b999a2..04c59107e635cc4e95178449e619eef4b614d7c4 100644 --- a/test_clk.py +++ b/test_clk.py @@ -1,4 +1,5 @@ -import pypcc; +#import pypcc; +import pypcc_test as pypcc; P1=pypcc.pypcc("LTS_pypcc.yaml") @@ -34,92 +35,6 @@ if True: Getvalue("OUT") Getvalue("IN") Getvalue("PLL_locked") - -exit() -if False: - P1.CallMethod("RCU01_Init_ADCR",None) - Getvalue("ADC_lock1") - -if False: - Setvalue("Band1",1) - Setvalue("Band2",0) - Setvalue("Band3",1) - Getvalue("Band1") - Getvalue("Band2") - Getvalue("Band3") -#exit() - -if False: -# Setvalue("Dth3_Pwr",0) -# Setvalue("Dth2_Pwr",0) -# Setvalue("Dth3_Pwr",1) -# Setvalue("Dth2_Pwr",1) - P1.CallMethod("RCU01_Dither1_Setup",None) - P1.CallMethod("RCU01_Dither2_Setup",None) - P1.CallMethod("RCU01_Dither3_Setup",None) - -# a=[0,0,0,0] -# P1.GetVarValue("RCU01_Dth1_FREQ",a) -# print("GET:",a[0]) -# Getvalue("Dither1_Frequency") - Setvalue("Dither1_Frequency",101.0) - Setvalue("Dither2_Frequency",101.2) - Getvalue("Dither1_Frequency") - Getvalue("Dither2_Frequency") -# Getvalue("Dth1_FREQ") - -if False: -# a=[0,0,0] -# P1.GetVarValue("RCU01_V_x",a) -# print("GET:",a[0]) -# import time -# time.sleep(0.2) -# Setvalue("V_x",0xC0) -# time.sleep(0.2) -# a=[0,0,0] -# P1.GetVarValue("RCU01_Temp",a) -# print("GET:",a[0]) - Getvalue("Temp") -#exit() -if False: - P1.CallMethod("RCU01_ADC1_Switch_on",None) - Getvalue("ADC1_locked") - Getvalue("ADC2_locked") - Getvalue("ADC3_locked") -#Getvalue("ADC_lock3") -#Getvalue("ADC_lock1") -#Setvalue("LED0",1) -#Getvalue("LED0") -#Setvalue("Band2",1) -#Getvalue("Band2") -#Getvalue("LED0") -exit() - -#Setvalue("Dth3_Pwr",1) -Setvalue("Dth2_Pwr",0) -Setvalue("Dth2_SDA",0) -Setvalue("Dth2_SCL",0) -Setvalue("Dth3_Pwr",0) -Setvalue("Dth3_SDA",0) -Setvalue("Dth3_SCL",0) - -Setvalue("LED0",2) - -Setvalue("Att1",10) -Setvalue("Att2",10) -Setvalue("Att3",10) - - -#Setvalue("Dth3_Pwr",1) -#Setvalue("Dth2_SCL",1) - -#assert(a[0]==1) -#print(P1.SetVarValue("RCU01_Band1",3)) -#print(P1.SetVarValue("RCU02_Band1",0)) -#print(P1.GetVarValue("RCU01_Band1",a)) -#print(a[0]) -#assert(a[0]==3) -#print(P1.GetVarValue("RCU02_Band1",a)) -#assert(a[0]==0) - +# P1.CallMethod("CLK_PLL_Setup",None) + Getvalue("PLL_locked")