Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
Conv TTL RS485 - Testing
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Conv TTL RS485 - Testing
Commits
ee1c7c8a
Commit
ee1c7c8a
authored
Oct 30, 2017
by
Denia Bouhired-Ferrag
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added new test to check whether hardware version is correct
parent
2f3e37ed
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
99 additions
and
0 deletions
+99
-0
hwvertest.py
pts-fm/python/hwvertest.py
+99
-0
No files found.
pts-fm/python/hwvertest.py
0 → 100644
View file @
ee1c7c8a
##_______________________________________________________________________________________________
##
## CONV-TTL-RS485 PTS
##
## CERN,BE/CO-HT
##_______________________________________________________________________________________________
##
##-----------------------------------------------------------------------------------------------
##
## CONV-TTL-RS485 pcb version
##
##-----------------------------------------------------------------------------------------------
##
## Description Test whether the version of PCB is the expected one
##
##
## Authors Maciej Lipinski (maciej.lipinski@cern.ch)
## Website http://www.ohwr.org/projects/pts
## Date 17/08/2017
##-----------------------------------------------------------------------------------------------
##
##------------------------------------------------------------------------------------------------
## GNU LESSER GENERAL PUBLIC LICENSE
## ------------------------------------
## This source file is free software; you can redistribute it and/or modify it under the terms of
## the GNU Lesser General Public License as published by the Free Software Foundation; either
## version 2.1 of the License, or (at your option) any later version.
## This source is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
## without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
## See the GNU Lesser General Public License for more details.
## You should have received a copy of the GNU Lesser General Public License along with this
## source; if not, download it from http://www.gnu.org/licenses/lgpl-2.1.html
##-------------------------------------------------------------------------------------------------
##-------------------------------------------------------------------------------------------------
## Import
##-------------------------------------------------------------------------------------------------
# Import system modules
import
sys
sys
.
path
.
append
(
"log/"
)
import
time
import
os
,
errno
,
re
,
sys
,
struct
import
os.path
import
traceback
import
glob
import
binascii
# Import common modules
from
ctypes
import
*
from
ptsexcept
import
*
from
vv_pts
import
*
from
ptsdefine
import
*
##-------------------------------------------------------------------------------------------------
## main --
##-------------------------------------------------------------------------------------------------
def
main
(
bus
,
tname
,
inf
,
log
):
"""
tests : Hardware version
uses : pts.bit and hwvertest.py
"""
HWVERS
=
4.0
pel
=
PTS_ERROR_LOGGER
(
inf
,
log
)
try
:
# Read PCB version: a 6 bits representing HW/PCB version number
# 4 MSB represent HW version number (major)
# 2 LSB represent number of execution (minor)
# Eg: value 010010 represents PCB version 4.2
hwvers
=
(
bus
.
vv_read
(
HWVERS
)
maj
=
int
(
hwvers
>>
HWVERS_VERS_OFS
)
min
=
float
(
hwvers
&
0x03
)
min
/=
10
hwvers
=
maj
+
min
# and now check if appropriate
if
(
hwvers
==
HWVERS
):
msg
=
"HW/PCB version correct:
%2.1
f
\n
"
%
(
hwvers
)
inf
.
write
(
msg
)
else
:
msg
=
"ERROR: HW/PCBe version (
%2.1
f) incorrect - expected
%2.1
f"
%
(
hwvers
,
HWVERS
)
pel
.
set
(
msg
)
print
"-->
%
s"
%
msg
return
pel
.
get
()
except
BusException
,
e
:
raise
PtsError
(
"SKT Exception:
%
s"
%
(
e
))
except
BusWarning
,
e
:
raise
PtsError
(
"SKT Warning:
%
s"
%
(
e
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment