Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
python_test_scripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LOFAR2.0
python_test_scripts
Commits
b33fb937
Commit
b33fb937
authored
Jun 17, 2021
by
Gijs Schoonderbeek
Browse files
Options
Downloads
Patches
Plain Diff
Register changes
parent
09609583
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
CCD_I2C.py
+50
-1
50 additions, 1 deletion
CCD_I2C.py
with
50 additions
and
1 deletion
CCD_I2C.py
+
50
−
1
View file @
b33fb937
...
...
@@ -122,7 +122,7 @@ def setup_pll() :
I2C_device
.
write_bytes
(
0x07
,
0x00
)
Write_byte_PLL
(
0x03
,
0x08
,
PLL_addr
)
Write_byte_PLL
(
0x04
,
0xFF
,
PLL_addr
)
# CF disable not used outputs, 00 enable all
Write_byte_PLL
(
0x05
,
0x
9
7
,
PLL_addr
)
Write_byte_PLL
(
0x05
,
0x
D
7
,
PLL_addr
)
Write_byte_PLL
(
0x06
,
0xE0
,
PLL_addr
)
# cp inv = 0xF4 other 0xE4
Write_byte_PLL
(
0x07
,
0x04
,
PLL_addr
)
# Divider R = 1 dec
Write_byte_PLL
(
0x08
,
0x01
,
PLL_addr
)
...
...
@@ -251,6 +251,53 @@ def read_temp():
else
:
print
(
"
Error reading tempeature
"
)
def
read_tacho
():
MAX6620
=
0x52
REG_GLOBAL
=
0x00
REG_TACH_MSP_REGS
=
[
0x10
,
0x12
,
0x14
]
REG_TACH_LSP_REGS
=
[
0x11
,
0x13
,
0x15
]
TACH_PERIODS
=
16
TACH_COUNT_FREQ
=
8192
FAN_TACHS
=
1
RUN_MONITOR
=
0x02
NOF_APS_FANS
=
3
DEBUG
=
1
fanmonitor_dev
=
I2C
(
MAX6620
)
fanmonitor_dev
.
bus_nr
=
I2CBUSNR
ret_ack
,
ret_value
=
fanmonitor_dev
.
read_bytes
(
1
)
if
ret_ack
<
1
:
stri
=
"
Device {0} at address 0x{1:X} not found
"
.
format
(
"
MAX6620
"
,
MAX6620
)
print
(
stri
)
status
=
False
else
:
if
DEBUG
:
stri
=
"
Device {0} at address 0x{1:X} is found
"
.
format
(
"
MAX6620
"
,
MAX6620
)
print
(
stri
)
ret_ack
,
reg_before
=
fanmonitor_dev
.
read_bytes
(
REG_GLOBAL
,
1
)
fanmonitor_dev
.
write_bytes
(
REG_GLOBAL
,
RUN_MONITOR
)
ret_ack
,
reg_after
=
fanmonitor_dev
.
read_bytes
(
REG_GLOBAL
,
1
)
if
DEBUG
:
stri
=
"
Reg at address 0x{0} before : {1} and after write action {2}
"
.
format
(
REG_GLOBAL
,
reg_before
,
reg_after
)
print
(
stri
)
fan_config_reg
=
int
((
math
.
log
(
TACH_PERIODS
)
/
math
.
log
(
2
)))
<<
5
for
fan_cnt
in
range
(
NOF_APS_FANS
):
fanmonitor_dev
.
write_bytes
(
0x02
+
fan_cnt
,
0x88
)
fanmonitor_dev
.
write_bytes
(
0x06
+
fan_cnt
,
fan_config_reg
)
ret_ack
,
tach_msb
=
fanmonitor_dev
.
read_bytes
(
REG_TACH_MSP_REGS
[
fan_nr
],
1
)
tach_msb
=
int
(
tach_msb
,
16
)
&
0xFF
if
tach_msb
>
254
:
if
DEBUG
:
tach_lsb
=
255
tach
=
99999
rpm
=
0
else
:
ret_ack
,
tach_lsb
=
fanmonitor_dev
.
read_bytes
(
REG_TACH_LSP_REGS
[
fan_nr
],
1
)
tach_lsb
=
int
(
tach_lsb
,
16
)
&
0xE0
tach
=
tach_msb
*
16
+
tach_lsb
/
8
rpm
=
float
((
TACH_COUNT_FREQ
*
TACH_PERIODS
*
60
))
/
(
FAN_TACHS
*
tach
)
if
DEBUG
:
stri
=
"
MSP: {0}, LSB: {1}, TACH : {2}
"
.
format
(
tach_msb
,
tach_lsb
,
tach
)
print
(
stri
)
if
CHECK_EEPROM
:
wr_rd_eeprom
()
...
...
@@ -273,5 +320,7 @@ if READ_LOCK:
else
:
print
(
"
Not locked --> PLL Error
"
)
read_tacho
()
if
READ_SENSOR
:
ccd_sensors
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment