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
b39362d9
Commit
b39362d9
authored
Aug 12, 2021
by
Gijs Schoonderbeek
Browse files
Options
Downloads
Patches
Plain Diff
Clean-up fan monitor code, ready for test on HW.
parent
b4b978e2
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
APSPU_I2C.py
+6
-7
6 additions, 7 deletions
APSPU_I2C.py
rd_apspu.py
+20
-22
20 additions, 22 deletions
rd_apspu.py
with
26 additions
and
29 deletions
APSPU_I2C.py
+
6
−
7
View file @
b39362d9
...
...
@@ -30,16 +30,15 @@ EEPROM = 0x50
MAX6620
=
0x29
REG_GLOBAL
=
0x00
REG_TACH_1_MSP
=
0x10
REG_TACH_1_LSP
=
0x11
REG_TACH_2_MSP
=
0x12
REG_TACH_2_LSP
=
0x13
REG_TACH_3_MSP
=
0x14
REG_TACH_3_LSP
=
0x15
REG_TACH_MSP_REGS
=
[
0x10
,
0x12
,
0x14
]
REG_TACH_LSP_REGS
=
[
0x11
,
0x13
,
0x15
]
TACH_PERIODS
=
32
TACH_COUNT_FREQ
=
8192
FAN_TACHS
=
2
RUN_MONITOR
=
0x02
NOF_APS_FANS
=
3
######################
# Functions
...
...
This diff is collapsed.
Click to expand it.
rd_apspu.py
+
20
−
22
View file @
b39362d9
...
...
@@ -20,6 +20,7 @@ This file contains the UniBoard2 class with all monitoring function. It can be u
import
sys
sys
.
path
.
insert
(
0
,
'
.
'
)
import
os
import
math
# import time
from
APSPU_I2C
import
*
if
os
.
name
==
"
posix
"
:
...
...
@@ -215,27 +216,25 @@ class FanmonitorClass:
ret_ack
,
reg_before
=
self
.
fanmonitor_dev
.
read_bytes
(
REG_GLOBAL
,
1
)
self
.
fanmonitor_dev
.
write_bytes
(
REG_GLOBAL
,
RUN_MONITOR
)
ret_ack
,
reg_after
=
self
.
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
)
self
.
fanmonitor_dev
.
write_bytes
(
0x02
,
0x88
)
self
.
fanmonitor_dev
.
write_bytes
(
0x03
,
0x88
)
self
.
fanmonitor_dev
.
write_bytes
(
0x04
,
0x88
)
self
.
fanmonitor_dev
.
write_bytes
(
0x05
,
0x88
)
self
.
fanmonitor_dev
.
write_bytes
(
0x06
,
0xe0
)
self
.
fanmonitor_dev
.
write_bytes
(
0x07
,
0xe0
)
self
.
fanmonitor_dev
.
write_bytes
(
0x08
,
0xe0
)
self
.
fanmonitor_dev
.
write_bytes
(
0x09
,
0xe0
)
fan_config_reg
=
math
.
log2
(
TACH_PERIODS
)
<<
5
for
fan_cnt
in
range
(
NOF_APS_FANS
)
self
.
fanmonitor_dev
.
write_bytes
(
0x02
+
fan_cnt
,
0x88
)
self
.
fanmonitor_dev
.
write_bytes
(
0x06
+
fan_cnt
,
fan_config_reg
)
def
read_
fan
(
self
,
REG_TACH_MSP
,
REG_TACH_LSP
):
def
read_
(
self
,
fan_nr
):
#
# Function to a single fan
#
ret_ack
,
tach_msb
=
self
.
fanmonitor_dev
.
read_bytes
(
REG_TACH_MSP
,
1
)
tach_msb
=
int
(
tach_msb
,
16
)
ret_ack
,
tach_lsb
=
self
.
fanmonitor_dev
.
read_bytes
(
REG_TACH_LSP
,
1
)
tach_lsb
=
int
(
tach_lsb
,
16
)
ret_ack
,
tach_msb
=
self
.
fanmonitor_dev
.
read_bytes
(
REG_TACH_MSP
_REGS
[
fan_nr
]
,
1
)
tach_msb
=
int
(
tach_msb
,
16
)
&
0xFF
ret_ack
,
tach_lsb
=
self
.
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
=
(
8192
*
32
*
60
)
/
(
2
*
tach
)
rpm
=
(
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
)
return
rpm
...
...
@@ -244,9 +243,8 @@ class FanmonitorClass:
#
# Function to read all fan's
#
self
.
rpm
.
append
(
self
.
read_fan
(
REG_TACH_1_MSP
,
REG_TACH_1_LSP
))
self
.
rpm
.
append
(
self
.
read_fan
(
REG_TACH_2_MSP
,
REG_TACH_2_LSP
))
self
.
rpm
.
append
(
self
.
read_fan
(
REG_TACH_3_MSP
,
REG_TACH_3_LSP
))
for
fan_counter
in
range
(
NOF_APS_FANS
):
self
.
rpm
.
append
(
self
.
read_fan
(
fan_counter
))
def
print_status
(
self
):
#
...
...
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