Skip to content
Snippets Groups Projects
Commit 3792b91e authored by Paulus Kruger's avatar Paulus Kruger
Browse files

new CCDTR working

parent 62dc276f
No related branches found
No related tags found
No related merge requests found
#!/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
...@@ -9,12 +9,23 @@ drivers: ...@@ -9,12 +9,23 @@ drivers:
type: i2c_dev #I2C devices type: i2c_dev #I2C devices
parent: I2C parent: I2C
status: CCDTR_I2C_error 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 - 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 parent: I2C_CLK
devreg: [IO1.GPIO1,IO1.GPIO1,IO1.GPIO1,IO1.GPIO1] devreg: [IO1.GPIO1,IO1.GPIO1,IO1.GPIO1,IO1.GPIO1]
parameters: [4,7,5,6] 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 #This is the I2C devices in the RCU
device_registers: device_registers:
- name: IO1 - name: IO1
...@@ -31,11 +42,11 @@ device_registers: ...@@ -31,11 +42,11 @@ device_registers:
address: 7 address: 7
store: True store: True
- name: GPIO1 - 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 address: [0,2] #Read / Write address different
store: True store: True
- name: GPIO2 - 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 address: [1,3] #Read / Write address different
store: True store: True
...@@ -97,7 +108,7 @@ device_registers: ...@@ -97,7 +108,7 @@ device_registers:
- name: MAX - name: MAX
description: MAX6620 fan speed controller description: MAX6620 fan speed controller
address: 0x29 address: 0x29
driver: I2C_CLK driver: I2C_FAN
registers: registers:
- { name: GLOBAL, address: 0x00} - { name: GLOBAL, address: 0x00}
- { name: TACH1, address: 0x10} - { name: TACH1, address: 0x10}
...@@ -120,6 +131,12 @@ variables: ...@@ -120,6 +131,12 @@ variables:
rw: ro #server RW variable, not linked to IO rw: ro #server RW variable, not linked to IO
dtype: uint8 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 - name: CCDTR_monitor_rate
description: Monitor rate in seconds description: Monitor rate in seconds
rw: variable rw: variable
...@@ -170,6 +187,8 @@ variables: ...@@ -170,6 +187,8 @@ variables:
rw: ro rw: ro
dtype: boolean dtype: boolean
driver: I2C_CLK driver: I2C_CLK
# devreg: IO1.GPIO2
# bitoffset: 4
devreg: IO1.GPIO2 devreg: IO1.GPIO2
bitoffset: 4 bitoffset: 4
width: 1 width: 1
...@@ -258,17 +277,25 @@ variables: ...@@ -258,17 +277,25 @@ variables:
monitor: true monitor: true
- name: CCD_FAN_RPM - name: CCD_FAN_RPM
driver: I2C_CLK driver: I2C_FAN
devreg: MAX.TACH1 devreg: MAX.TACH1
# bitoffset: 5 # bitoffset: 5
width: 16 width: 16
rw: ro rw: ro
dtype: double dtype: double
# scale: 1.52588e-5 #FAN_TACHS/TACH_COUNT_FREQ/TACH_PERIODS = 1/8192/16 *2 (bitoffset=5) - not working correctly # 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 convert_unit: period2RPM
monitor: true monitor: true
- name: CCD_BACK_ID
driver: LMP_GPIO
devreg: ROM.ID #this is ignored
width: 6
rw: ro
dtype: uint8
methods: methods:
- name: CCDTR_Init #Called after startup to load. Should have all stored registers - name: CCDTR_Init #Called after startup to load. Should have all stored registers
...@@ -278,6 +305,7 @@ methods: ...@@ -278,6 +305,7 @@ methods:
- CCDTR_I2C_error : 0 - CCDTR_I2C_error : 0
- CCD_IO1_GPIO1 : Update - CCD_IO1_GPIO1 : Update
- CCD_IO1_GPIO2 : Update - CCD_IO1_GPIO2 : Update
- CCD_BACK_ID: Update
- IO1.CONF1: Update - IO1.CONF1: Update
- IO1.CONF2: Update - IO1.CONF2: Update
# - CCDTR_Update: 0 # - CCDTR_Update: 0
...@@ -287,9 +315,9 @@ methods: ...@@ -287,9 +315,9 @@ methods:
driver: I2C_CLK driver: I2C_CLK
debug: True debug: True
instructions: instructions:
# - CCD_PCB_ID : Update - CCD_PCB_ID : Update
# - CCD_PCB_version : Update - CCD_PCB_version : Update
# - CCD_PCB_number : Update - CCD_PCB_number : Update
- CCD_PWR_on: Update - CCD_PWR_on: Update
- CCD_INPUT_10MHz_good: Update - CCD_INPUT_10MHz_good: Update
- CCD_INPUT_PPS_good: Update - CCD_INPUT_PPS_good: Update
...@@ -303,20 +331,22 @@ methods: ...@@ -303,20 +331,22 @@ methods:
description: Configure clock. Monitored using CCD_PWR_on description: Configure clock. Monitored using CCD_PWR_on
instructions: instructions:
- CCDTR_I2C_error : 0 - CCDTR_I2C_error : 0
- IO1.CONF1: 0x2C #0010 1100 SCLK,CS,SDI - CCDTR_FAN_I2C_error : 0
- IO1.CONF2: 0xE7 #1110,0111 - IO1.CONF1: 0x2C #0010 1100 SCLK,CS,SDI = output
- IO1.GPIO1: 0x02 # - IO1.CONF2: 0xCF #1100 1111 Pwr on/off, CLR_LOCK
- IO1.GPIO2: 0x14 #PWR enable - IO1.GPIO2: 0x10 #Pwr on
- IO1.GPIO1: 0x42 #0100 0010 CS=high
- WAIT: 200
- CCD_PLL_setup: 0
- MAX.0x00 : 0x00 - MAX.0x00 : 0x00
- MAX.0x02 : 0x08 - MAX.0x02 : 0x08
- MAX.0x01 : 0x0F - MAX.0x01 : 0x0F
- MAX.0x06 : 0x60 - MAX.0x06 : 0x60
- MAX.0x28 : 227 - MAX.0x28 : 227
- MAX.0x29 : 0x80 - MAX.0x29 : 0x80
- WAIT: 500 #ms to wait before checking lock
- WAIT: 200 - CCD_clear_lock: 1
- CCD_PLL_setup: 0 - CCD_clear_lock: 0
- WAIT: 200 #ms to wait before checking lock
- CCDTR_Update: 0 #refresh all settings - CCDTR_Update: 0 #refresh all settings
- name: CCD_off - name: CCD_off
...@@ -324,8 +354,9 @@ methods: ...@@ -324,8 +354,9 @@ methods:
description: Switch clock off. Monitored using CCD_PWR_on description: Switch clock off. Monitored using CCD_PWR_on
instructions: instructions:
- CCDTR_I2C_error : 0 - CCDTR_I2C_error : 0
- IO1.GPIO1: 0x00 - IO1.CONF1: 0xFF #all input
- IO1.GPIO2: 0x00 - IO1.GPIO2: 0x00 #Power off
- IO1.CONF2: 0xEF #only pwr on/off output
- MAX.0x00 : 0x10 - MAX.0x00 : 0x10
- MAX.0x02 : 0x08 - MAX.0x02 : 0x08
- MAX.0x28 : 0x00 - MAX.0x28 : 0x00
...@@ -336,27 +367,24 @@ methods: ...@@ -336,27 +367,24 @@ methods:
driver: I2C_CLK driver: I2C_CLK
debug: true debug: true
instructions: instructions:
- PLL1.0x03: 0x08 #Set power, this is default - PLL1.0x04: 0x00
- PLL1.0x04: 0xFF # - PLL1.0x05: 0x00
- PLL1.0x05: 0xD7 # - PLL1.0x06: 0x01
- PLL1.0x06: 0xE0 - PLL1.0x07: 0x00
- PLL1.0x08: 0x47
- PLL1.0x07: 0x04 #Stop R divider - PLL1.0x09: 0x50
- PLL1.0x08: 0x01 #Set R divider - PLL1.0x0A: 0x40
- PLL1.0x07: 0x00 #Start R divider - PLL1.0x0B: 0x00
- PLL1.0x0C: 0x01
- PLL1.0x09: 0x10 #Stop N divider - PLL1.0x45: 0x00
- PLL1.0x0A: 0x01 #Set N divider=1 - PLL1.0x3D: 0x08
- PLL1.0x09: 0x00 #Start N divider - PLL1.0x3E: 0x0A
- PLL1.0x3F: 0x0A
- PLL1.0x0B: 0x00 # - PLL1.0x40: 0x03
- PLL1.0x0D: 0x01 #Divider output 1=1 - PLL1.0x41: 0x02
- PLL1.0x0E: 0x00 # - PLL1.0x4B: 0x80
- PLL1.0x0F: 0x01 #Divider output 2=1 - PLL1.0x4D: 0x80
- PLL1.0x11: 0x01 #Divider output 3=1 - PLL1.0x4F: 0x80
- PLL1.0x12: 0x00 # - PLL1.0x51: 0x80
- PLL1.0x13: 0x01 #Divider output 4=1 - PLL1.0x53: 0x80
- PLL1.0x14: 0x01 # - PLL1.0x5A: 0x0F
#!/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();
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment