diff --git a/disable_services.sh b/disable_services.sh new file mode 100755 index 0000000000000000000000000000000000000000..fcab502fe49a79377e2038d08f6645ec90a122ff --- /dev/null +++ b/disable_services.sh @@ -0,0 +1,12 @@ +#!/bin/bash +sudo systemctl stop recvtr.service +sudo systemctl stop apscttr.service +sudo systemctl stop apsputr.service +sudo systemctl stop unb2tr.service +sudo systemctl disable recvtr.service +sudo systemctl disable apscttr.service +sudo systemctl disable apsputr.service +sudo systemctl disable unb2tr.service + +sudo systemctl stop ccdtr.service +sudo systemctl disable ccdtr.service diff --git a/pypcc/config/CCDTR.yaml b/pypcc/config/CCDTR.yaml index 0d2b59f1fc40400d57b31764f792a662d482da02..067c2bd14754f610d9daf0e76eab24c0c11a2c5c 100644 --- a/pypcc/config/CCDTR.yaml +++ b/pypcc/config/CCDTR.yaml @@ -9,12 +9,23 @@ drivers: type: i2c_dev #I2C devices parent: I2C status: CCDTR_I2C_error + - name: I2C3 + type: i2c + parameters: [3] #I2C port number + - name: I2C_FAN + type: i2c_dev #I2C devices + parent: I2C3 + status: CCDTR_FAN_I2C_error - name: SPIbb1 - type: spibitbang2 #SPI bitbang via GPIO expander: CLK, SDI,SDO,CS + type: spibitbang3 #SPI bitbang via GPIO expander: CLK, SDI,SDO,CS parent: I2C_CLK devreg: [IO1.GPIO1,IO1.GPIO1,IO1.GPIO1,IO1.GPIO1] parameters: [4,7,5,6] + - name: LMP_GPIO + type: gpio_id + parameters: [21,20,16,12,7,8] + #This is the I2C devices in the RCU device_registers: - name: IO1 @@ -31,11 +42,11 @@ device_registers: address: 7 store: True - name: GPIO1 - description: Input/Ouput port 1 + description: "Input/Ouput port 1. P0,1,3:NC, P02:lock, P04,5,6,7: SCLK,SDO,CS,SDO" address: [0,2] #Read / Write address different store: True - name: GPIO2 - description: Input/Ouput port 2 + description: "Input/Ouput port 2. P0: 1pps_mon, P1: 10MHz_mon, P2: loss_loc, P3,6,7NC, P4: Pwr_on/off, P5: CLR_LOCK" address: [1,3] #Read / Write address different store: True @@ -97,7 +108,7 @@ device_registers: - name: MAX description: MAX6620 fan speed controller address: 0x29 - driver: I2C_CLK + driver: I2C_FAN registers: - { name: GLOBAL, address: 0x00} - { name: TACH1, address: 0x10} @@ -120,6 +131,12 @@ variables: rw: ro #server RW variable, not linked to IO dtype: uint8 + - name: CCDTR_FAN_I2C_error + description: 0=good, >0 indicates an I2C communication error + driver: I2C_FAN + rw: ro #server RW variable, not linked to IO + dtype: uint8 + - name: CCDTR_monitor_rate description: Monitor rate in seconds rw: variable @@ -170,6 +187,8 @@ variables: rw: ro dtype: boolean driver: I2C_CLK +# devreg: IO1.GPIO2 +# bitoffset: 4 devreg: IO1.GPIO2 bitoffset: 4 width: 1 @@ -258,17 +277,25 @@ variables: monitor: true - name: CCD_FAN_RPM - driver: I2C_CLK + driver: I2C_FAN devreg: MAX.TACH1 # bitoffset: 5 width: 16 rw: ro dtype: double # scale: 1.52588e-5 #FAN_TACHS/TACH_COUNT_FREQ/TACH_PERIODS = 1/8192/16 *2 (bitoffset=5) - not working correctly - scale: 4.7684e-7 #FAN_TACHS/TACH_COUNT_FREQ/TACH_PERIODS = 1/8192/16 /16 (bitoffset=0) +# scale: 4.7684e-7 #FAN_TACHS/TACH_COUNT_FREQ/TACH_PERIODS = 1/8192/16 /16 (bitoffset=0) + scale: 9.53674e-7 #FAN_TACHS/TACH_COUNT_FREQ/TACH_PERIODS = 1/8192/8 /16 (bitoffset=0) convert_unit: period2RPM monitor: true + - name: CCD_BACK_ID + driver: LMP_GPIO + devreg: ROM.ID #this is ignored + width: 6 + rw: ro + dtype: uint8 + methods: - name: CCDTR_Init #Called after startup to load. Should have all stored registers @@ -278,6 +305,7 @@ methods: - CCDTR_I2C_error : 0 - CCD_IO1_GPIO1 : Update - CCD_IO1_GPIO2 : Update + - CCD_BACK_ID: Update - IO1.CONF1: Update - IO1.CONF2: Update # - CCDTR_Update: 0 @@ -287,9 +315,9 @@ methods: driver: I2C_CLK debug: True instructions: -# - CCD_PCB_ID : Update -# - CCD_PCB_version : Update -# - CCD_PCB_number : Update + - CCD_PCB_ID : Update + - CCD_PCB_version : Update + - CCD_PCB_number : Update - CCD_PWR_on: Update - CCD_INPUT_10MHz_good: Update - CCD_INPUT_PPS_good: Update @@ -303,20 +331,22 @@ methods: description: Configure clock. Monitored using CCD_PWR_on instructions: - CCDTR_I2C_error : 0 - - IO1.CONF1: 0x2C #0010 1100 SCLK,CS,SDI - - IO1.CONF2: 0xE7 #1110,0111 - - IO1.GPIO1: 0x02 # - - IO1.GPIO2: 0x14 #PWR enable + - CCDTR_FAN_I2C_error : 0 + - IO1.CONF1: 0x2C #0010 1100 SCLK,CS,SDI = output + - IO1.CONF2: 0xCF #1100 1111 Pwr on/off, CLR_LOCK + - IO1.GPIO2: 0x10 #Pwr on + - IO1.GPIO1: 0x42 #0100 0010 CS=high + - WAIT: 200 + - CCD_PLL_setup: 0 - MAX.0x00 : 0x00 - MAX.0x02 : 0x08 - MAX.0x01 : 0x0F - MAX.0x06 : 0x60 - MAX.0x28 : 227 - MAX.0x29 : 0x80 - - - WAIT: 200 - - CCD_PLL_setup: 0 - - WAIT: 200 #ms to wait before checking lock + - WAIT: 500 #ms to wait before checking lock + - CCD_clear_lock: 1 + - CCD_clear_lock: 0 - CCDTR_Update: 0 #refresh all settings - name: CCD_off @@ -324,8 +354,9 @@ methods: description: Switch clock off. Monitored using CCD_PWR_on instructions: - CCDTR_I2C_error : 0 - - IO1.GPIO1: 0x00 - - IO1.GPIO2: 0x00 + - IO1.CONF1: 0xFF #all input + - IO1.GPIO2: 0x00 #Power off + - IO1.CONF2: 0xEF #only pwr on/off output - MAX.0x00 : 0x10 - MAX.0x02 : 0x08 - MAX.0x28 : 0x00 @@ -336,27 +367,24 @@ methods: driver: I2C_CLK debug: true instructions: - - PLL1.0x03: 0x08 #Set power, this is default - - PLL1.0x04: 0xFF # - - PLL1.0x05: 0xD7 # - - PLL1.0x06: 0xE0 - - - PLL1.0x07: 0x04 #Stop R divider - - PLL1.0x08: 0x01 #Set R divider - - PLL1.0x07: 0x00 #Start R divider - - - PLL1.0x09: 0x10 #Stop N divider - - PLL1.0x0A: 0x01 #Set N divider=1 - - PLL1.0x09: 0x00 #Start N divider - - - PLL1.0x0B: 0x00 # - - PLL1.0x0D: 0x01 #Divider output 1=1 - - PLL1.0x0E: 0x00 # - - PLL1.0x0F: 0x01 #Divider output 2=1 - - PLL1.0x11: 0x01 #Divider output 3=1 - - PLL1.0x12: 0x00 # - - PLL1.0x13: 0x01 #Divider output 4=1 - - PLL1.0x14: 0x01 # - - - + - PLL1.0x04: 0x00 + - PLL1.0x05: 0x00 + - PLL1.0x06: 0x01 + - PLL1.0x07: 0x00 + - PLL1.0x08: 0x47 + - PLL1.0x09: 0x50 + - PLL1.0x0A: 0x40 + - PLL1.0x0B: 0x00 + - PLL1.0x0C: 0x01 + - PLL1.0x45: 0x00 + - PLL1.0x3D: 0x08 + - PLL1.0x3E: 0x0A + - PLL1.0x3F: 0x0A + - PLL1.0x40: 0x03 + - PLL1.0x41: 0x02 + - PLL1.0x4B: 0x80 + - PLL1.0x4D: 0x80 + - PLL1.0x4F: 0x80 + - PLL1.0x51: 0x80 + - PLL1.0x53: 0x80 + - PLL1.0x5A: 0x0F diff --git a/scripts/CCDoff.py b/scripts/CCDoff.py new file mode 100755 index 0000000000000000000000000000000000000000..3ae77aded645e84f13e87b2451e534387e303ab4 --- /dev/null +++ b/scripts/CCDoff.py @@ -0,0 +1,24 @@ +#!/usr/local/bin/python3.11 +from test_common import * +connect("opc.tcp://localhost:4843/") + +#callmethod("APSCT_off") +#time.sleep(1) +callmethod("CCD_off") +#callmethod("APSCT_160MHz_on") +for x in range(10): + busy=get_value("CCDTR_translator_busy_R") + print(busy) + if not(busy): break + time.sleep(0.1) + +#time.sleep(1) +#callmethod("CLK_PLL_setup") +#exit() +#time.sleep(1) +#callmethod("RCU_on") +#callmethod("RCU_on") +#time.sleep(1) +#callmethod("ADC_on") + +disconnect();