Commit db8e4ac1 authored by Denia Bouhired-Ferrag's avatar Denia Bouhired-Ferrag

Merge remote-tracking branch 'origin/proposed-master'

parents f7b39015 95c30838
*pyc *pyc
*swp *swp
*pdf
*bin
*bit
*mcs
*txt
*cfi
*prm
*tps
*tcp
\ No newline at end of file
conv-ttl-blo-gw @ 0998df2c
Subproject commit c25835d2faf9b349c7bf3b6589e86cf53e207d44 Subproject commit 0998df2cb2e9ecb573e8ead301f0668479d0699d
conv-ttl-blo-tst @ 94d1363d
Subproject commit 5988404a66aff28278683bc181afb35ff81c2a41 Subproject commit 94d1363deac50b6386dd5f7fbb817e8dc8eea0ff
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
\noindent \rule{\textwidth}{.1cm} \noindent \rule{\textwidth}{.1cm}
\hfill February 09, 2017 \hfill September 27, 2018
\vspace*{3cm} \vspace*{3cm}
...@@ -24,8 +24,7 @@ ...@@ -24,8 +24,7 @@
%--------------------------------------------------------------- %---------------------------------------------------------------
% name % name
%--------------------------------------------------------------- %---------------------------------------------------------------
\noindent {\Large \textbf{Theodor-Adrian Stana (CERN/BE-CO-HT)}}\\ \noindent {\Large \textbf{(CERN/BE-CO-HT)}}\\
\noindent { \textit{Last modified by Denia Bouhired-Ferrag (CERN/BE-CO-HT)}}
\noindent \rule{\textwidth}{.05cm} \noindent \rule{\textwidth}{.05cm}
......
This diff is collapsed.
...@@ -38,10 +38,10 @@ ...@@ -38,10 +38,10 @@
ENABLED = False ENABLED = False
# Hostname, username and password # Hostname, username and password
HNAME = "" HNAME = "" # Add host name here Eg: HNAME = "cfv-774-celma3"
USER = "" USER = "" # Add host username here Eg: USER = "admin"
PWD = "" PWD = "" # Add host password here Eg: PWD = "ADMIN"
SLOT = 0 SLOT = 0 # Add slot number here Eg: SLOT = 5
# Boolean to tell the ei2c.py module whether to create a dump file for the ELMA # Boolean to tell the ei2c.py module whether to create a dump file for the ELMA
# command replies # command replies
......
Procedure for JTAG gateware upgrade for conv-ttl-xxx boards
-------------------------------------------------------------
This procedure is used to upgrade gateware on conv-ttl-xxx boards.
After upgrade a log file will be saved in the ./log folder recording board unique ID, previous and new gateware version and hardware version.
The target version for Golden and Release bitstreams needs to be maually entered in the gw-upgrade.py file,
by editing the lines:
# Target version
gwvers_target = 4.1
gwvers_gold_target = 0.3
In the same directory, binaries for release and golden bitstreams should be saved in folders ./gw-blo or ./gw-485 depending on which board should be upgraded.
Additionally the file ei2cdefine.py should be edited for local crate used for upgrade:
# Hostname, username and password
HNAME = "cfvm-774-elma3"
USER = "admin"
PWD = "ADMIN"
SLOT = 5
Once the target version and crate information has been entered, follow the procedure below to upgrade board version:
* At the prompt, run script gw-upgrade.py, by running the command:
>> python gw-upgrade.py
* Type "y"+Enter if you have a board you would like to upgrade gateware for, "n"+Enter if not.
* Place ESD strap on your wrist.
* Take conv-ttl-xxx board carefully out of box and ESD bag.
* Scan with the barcode reader the LHC barcode on the board. Press Enter after scan.
* Place board on slot 5 of Elma crate, without engaging it all the way.
* Plug the Xilinx Cable on the Xiling connector (JTAG) of the conv-ttl-xxx board.
* Engage the conv-ttl-xx board all the way in the VME crate, and press the front panel handles until they make a clicking noise.
* Type "ok"+Enter on the terminal prompt.
* The script checks the board ID and states whether the board in the slot is a conv-ttl-blo or conv-ttl-rs485. If board information is correct, type "y"+Enter, if not type "n"+Enter and restart the script with the correct board.
* The script then checks the current board hardware and gateware version number. If the the hardware version is older than v4.0 then the script will not be able to identify the exact version number, only that it is v3.0 or earlier.
* The script checks that the gateware version is different than the target upgrade. If it is the same as the target version, then upgrade is not necessary and the script aborts. If the current version does not match target version, than script proceeds with upgrade.
* Once upgrade starts, you need to wait a approx 7 minutes for it to be completed. The script will then display the new gateware version (hardware version WILL NOT change). The information is all saved in the log file.
* The script will ask you to remove the board and type "ok"+Enter. Make sure you are wearing the ESD bracelet. Put the board back in ESD bag and then in the box if any.
* If more boards need upgrading, type "y"+Enter and start the procedure from the top again.
--------------------------------------------------------------------------------------------------------------
Note:
The log file is created with the current date. All tests for the day are appended to the same file.
If you want to restart a new log file, it needs to be manually renamed and the script will write on a new one
Procedure for remote gateware upgrade for conv-ttl-xxx boards
-------------------------------------------------------------
This procedure is used to upgrade gateware on conv-ttl-xxx boards REMOTELY.
After upgrade a log file will be saved in the ./log folder recording with the crate name, slot number, unique board ID and hw and gw version information.
The target version for Golden and Release bitstreams needs to be maually entered in the remote-mass-gw-upgrade.py file,
by editing the lines:
# Target version
gwvers_target = 4.1
gwvers_gold_target = 0.3
Individual card information can be added by creatnig/editing crate_list.txt file in the following format:
Remote_crate_name Username Password Slot_number
The file can contain any number of lines, one per board. If a crate contains multiple boards, then the same line has to be repeated as many times, but with a different slot number.
Eg:
cfvm-361-cbaos13 admin ADMIN 16
cfvm-361-cbaos13 admin ADMIN 3
ctd-361-c01 admin ADMIN 12
Procedure for JTAG gateware upgrade for conv-ttl-xxx boards
-------------------------------------------------------------
This procedure is used to upgrade gateware on conv-ttl-xxx boards.
After upgrade a log file will be saved in the ./log folder recording board unique ID, previous and new gateware version and hardware version.
The target version for Golden and Release bitstreams needs to be maually entered in the gw-upgrade.py file,
by editing the lines:
# Target version
gwvers_target = 4.1
gwvers_gold_target = 0.3
In the same directory, binaries for release and golden bitstreams should be saved in folders ./gw-blo or ./gw-485 depending on which board should be upgraded.
Additionally the file ei2cdefine.py should be edited for local crate used for upgrade:
# Hostname, username and password
HNAME = "cfvm-774-elma3"
USER = "admin"
PWD = "ADMIN"
SLOT = 5
Once the target version and crate information has been entered, follow the procedure below to upgrade board version:
* At the prompt, run script gw-upgrade.py, by running the command:
>> python gw-upgrade.py
* Type "y"+Enter if you have a board you would like to upgrade gateware for, "n"+Enter if not.
* Place ESD strap on your wrist.
* Take conv-ttl-xxx board carefully out of box and ESD bag.
* Scan with the barcode reader the LHC barcode on the board. Press Enter after scan.
* Place board on slot 5 of Elma crate, without engaging it all the way.
* Plug the Xilinx Cable on the Xiling connector (JTAG) of the conv-ttl-xxx board.
* Engage the conv-ttl-xx board all the way in the VME crate, and press the front panel handles until they make a clicking noise.
* Type "ok"+Enter on the terminal prompt.
* The script checks the board ID and states whether the board in the slot is a conv-ttl-blo or conv-ttl-rs485. If board information is correct, type "y"+Enter, if not type "n"+Enter and restart the script with the correct board.
* The script then checks the current board hardware and gateware version number. If the the hardware version is older than v4.0 then the script will not be able to identify the exact version number, only that it is v3.0 or earlier.
* The script checks that the gateware version is different than the target upgrade. If it is the same as the target version, then upgrade is not necessary and the script aborts. If the current version does not match target version, than script proceeds with upgrade.
* Once upgrade starts, you need to wait a approx 7 minutes for it to be completed. The script will then display the new gateware version (hardware version WILL NOT change). The information is all saved in the log file.
* The script will ask you to remove the board and type "ok"+Enter. Make sure you are wearing the ESD bracelet. Put the board back in ESD bag and then in the box if any.
* If more boards need upgrading, type "y"+Enter and start the procedure from the top again.
--------------------------------------------------------------------------------------------------------------
Note:
The log file is created with the current date. All tests for the day are appended to the same file.
If you want to restart a new log file, it needs to be manually renamed and the script will write on a new one
cfvm-774-elma3 admin ADMIN 3
\ No newline at end of file
#===============================================================================
# CERN (BE-CO-HT)
# EI2C global definitions file
#===============================================================================
# author: Theodor Stana (t.stana@cern.ch)
#
# date of creation: 2014-03-05
#
# version: 1.0
#
# description:
#
# This module defines some global constants that are used by other scripts in
# the software suite. The constants and their definitions are in the code
# below.
#
#===============================================================================
# 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
#===============================================================================
# last changes:
# 2014-03-05 Theodor Stana File created
# 2017-02-15 Maciej Suminski Added 'SLOT' parameter
#===============================================================================
# TODO: -
#===============================================================================
# Boolean to specify whether hostname, user & password are used
ENABLED = False
# Hostname, username and password
HNAME = "cfvm-774-elma3"
USER = "admin"
PWD = "ADMIN"
SLOT = 5
# Boolean to tell the ei2c.py module whether to create a dump file for the ELMA
# command replies
DUMP = False
In this folder you need to add one single binary for your upgrades.
The binary file should be the concatenated version of the golden and release gateware.
Usually in the format:
golden-v0.x_release-vx.y.bin
Got to https://www.ohwr.org/projects/conv-ttl-blo-gw/wiki/ For latest release
In this folder you need to add one single binary for your upgrades.
The binary file should be the concatenated version of the golden and release gateware.
Usually in the format:
golden-v0.x_release-vx.y.bin
Got to https://www.ohwr.org/projects/conv-ttl-rs485-gw/wiki/ For latest release
This diff is collapsed.
#!/bin/bash
echo Power OFF ELMA crate
snmpset -v2c -c ADMIN cfvm-774-elma3 1.3.6.1.4.1.37968.1.1.7.2.1.3.1 i 1
#!/bin/bash
echo Power ON ELMA crate
snmpset -v2c -c ADMIN cfvm-774-elma3 1.3.6.1.4.1.37968.1.1.7.2.1.3.1 i 0
#!/usr/bin/python
#===============================================================================
# CERN (BE-CO-HT)
# Pulse test script
#===============================================================================
# author: Denia Bouhired(t.stana@cern.ch)
#
# date of creation:
#
# version: 1.0
#
# description:
# This script is used during manual upgrade of conv-ttl boards.
# It is used to:
# - Scan barcode of board
# - Read hw version
# - Read gw version
# - Read unique temperature chip ID
# - Output information on log file
#
#===============================================================================
# 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
#===============================================================================
#===============================================================================
# TODO:
#===============================================================================
import sys
sys.path.append("../ei2c")
sys.path.append("../multiboot/lib-multiboot")
import time
from ei2c import *
from ei2cexcept import *
import binascii
import re
import subprocess
import os
import traceback
from xil_multiboot import *
##-------------------------------------------------------------------------------------------------
## Method to turn on the VME crate.
##-------------------------------------------------------------------------------------------------
## It calls the men-on script which sends the necessary SMTP commands to the ELMA crate to turn on
## power to the VME backplane.
##-------------------------------------------------------------------------------------------------
def men_on():
print("Switching on the ELMA crate")
subprocess.call("./men-on", shell=True, stdout=None, stderr=None)
time.sleep(1)
##-------------------------------------------------------------------------------------------------
## Method to turn off the VME crate.
##-------------------------------------------------------------------------------------------------
## It calls the men-off script which sends the necessary SMTP commands to the ELMA crate to turn off
## power to the VME backplane.
##-------------------------------------------------------------------------------------------------
def men_off():
print("Switching off the ELMA crate")
subprocess.call("./men-off", shell=True, stdout=None, stderr=None)
time.sleep(1)
##-------------------------------------------------------------------------------------------------
# Define registers memory address
IDREG = 0x00 # Board ID register
SRREG = 0x04 # Status register
UIDREGLS = 0xac # 1-wire chip Unique ID - LSB
UIDREGMS = 0xb0 # 1-wire chip Unique ID - MSB
# Status register offsets
CSR_GWVERS_OFS = 0
CSR_HWVERS_OFS = 22
# Target version
gwvers_target = 0.0 # Add release version here Eg: gwvers_target = 1.0
gwvers_gold_target = 0.0 # Add golden version here Eg: gwvers_gold_target = 0.2
#gateware to write
#gw_file="golden-v"+str(gwvers_gold_target)+".bin"
gw_file="golden-v"+str(gwvers_gold_target)+"_release-v"+str(gwvers_target)+".bin"
##-------------------------------------------------------------------------------------------------
## Method to check hardware and gateware version
##-------------------------------------------------------------------------------------------------
def gw_hw_version():
hwvers = (elma.read(slot, SRREG) & 0x0fc00000) >> CSR_HWVERS_OFS
gwvers = (elma.read(slot, SRREG) & 0xFF) >> CSR_GWVERS_OFS
#print ("maj is %d, min is %d" % int(hwvers >> 2), int(hwvers & 0x03))
hwvers = int(hwvers >> 2)+float(hwvers & 0x03)/10
gwvers = int(gwvers >> 4)+float(gwvers & 0xF)/10
return hwvers, gwvers;
##-------------------------------------------------------------------------------------------------
## Main "method" of upgrade module
##-------------------------------------------------------------------------------------------------
if __name__ == "__main__":
crate_list = "crate_list.txt"
fin = open ('./crate_list.txt', 'r')
for crate_line in fin:
#Split each line into list of strings
crate_info=crate_line.split()
# Get the IP, user and password for the ELMA crate from ei2cdefine.py
ip = crate_info[0]
user = crate_info[1]
pwd = crate_info[2]
slot = int(crate_info[3])
elma = EI2C(ip, user, pwd)
try:
elma.open()
print ("---------------------------------")
print ("Connecting to crate %s ... \n" % ip)
# Get board ID and gateware version, fail if incorrect
bid = elma.get_bid(slot)
(hwvers, gwvers) = gw_hw_version()
upgrade=True
#Check whether upgrade is required
if (gwvers == gwvers_target):
upgrade=False
baseaddr = 0x100
if (bid == "TBLO"):
gw_path="./gw-blo/"
elif (bid == "T485"):
gw_path="./gw-rs485/"
if upgrade==True:
print("Upgrade file is %s \n" % gw_path+gw_file)
mb = XilMultiboot(ELMA_I2C_MULTIBOOT, elma, slot, baseaddr, "")
mb.set_bitstream_file(gw_path+gw_file)
multiboot_addr = "0x0"
multiboot_addr = int(multiboot_addr, 16)
mb.write(multiboot_addr)
mb.iprog(multiboot_addr)
time.sleep(10)
(hwvers_new, gwvers_new) = gw_hw_version()
if (hwvers_new == 0.0):
hwvers_new_str = "<4.0"
else:
hwvers_new_str = str(hwvers_new)
IDMS = elma.read(slot, UIDREGMS)
IDLS = elma.read(slot, UIDREGLS)
except BadHostnameError:
print("... Bad crate name ... \n")
(IDMS, IDLS, hwvers_new_str, gwvers, gwvers_new) = (0,0,"BadHostname",0,0)
except BadUsernameError:
print("... Bad user name ... \n")
(IDMS, IDLS, hwvers_new_str, gwvers, gwvers_new) = (0,0,"BadUsername",0,0)
except BadPasswordError:
print("... Bad password ... \n")
(IDMS, IDLS, hwvers_new_str, gwvers, gwvers_new) = (0,0,"BadPassword",0,0)
except NAckError:
print("... Board not responding... \n")
(IDMS, IDLS, hwvers_new_str, gwvers, gwvers_new) = (0,0,"NAckError",0,0)
#Generate log file
# Generate output file named according to current time
fname = bid+"-"+time.strftime("remote-gwupgrade-%s-%Y-%m-%d", bid, time.localtime()) + ".txt"
ret = subprocess.call(["ls ./log | grep " + fname], shell=True, stdout=None, stderr=None)
print ("%d" % ret)
if (ret != 0):
f = open("./log/" + fname, "w")
f.write("\n")
f.write("CONV-TTL-XXX Upgrade log created on %s \n" % time.strftime("%Y-%m-%d-%Hh%Mm%Ss", time.localtime()))
f.write("--------------------------------------------------------------------------------- \n")
f.write("* Target version is (v%2.1f)\n" % gwvers_target)
f.write("* Hardware (v0.0) means board is (v3.0) or earlier \n")
f.write("\n")
f.write("--------------------------------------------------------------------------------- \n")
f.write("Crate name| Slot |Barcode | PCB ID | HW version | Old gw version | New gw version\n")
f.write("--------------------------------------------------------------------------------- \n")
f.close()
print("Upgrade log can be found in ./log/%s \n" % fname)
f = open("./log/" + fname, "a")
f.write("%s \t %d \t %x%x \t (%s) \t (%2.1f) \t (%2.1f) \n" % (ip, slot, IDMS, IDLS, hwvers_new_str, gwvers, gwvers_new) )
f.close()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment