Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
SPEC7
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
5
Issues
5
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Projects
SPEC7
Commits
f31a10f9
Commit
f31a10f9
authored
May 15, 2020
by
Peter Jansweijer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Ton's SMBus scripts
parent
10c82f69
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
0 deletions
+51
-0
notes.pdf
sw/SMBus_reset/notes.pdf
+0
-0
spec7_reset.sh
sw/SMBus_reset/spec7_reset.sh
+51
-0
No files found.
sw/SMBus_reset/notes.pdf
0 → 100644
View file @
f31a10f9
File added
sw/SMBus_reset/spec7_reset.sh
0 → 100644
View file @
f31a10f9
#!/bin/sh
#
# Script to reset the SPEC7 card via SMBus
# Author <Ton Damen>tond@nikhef.nl
# Date: 9 april 2020
# Relies on the rpm package "i2c-tools"
#
which i2cdetect
>
/dev/null 2>&1
if
test
$?
-ne
0
;
then
echo
"Missing i2c-utils"
exit
fi
if
test
$(
id
-u
)
-ne
0
;
then
echo
"Need root privilege"
exit
fi
BUS
=
$(
i2cdetect
-l
|
awk
-e
'/SMBus/ { print substr($1,5) }'
)
CHIP_ADDR
=
0x20
CHIP_INPUT_REG
=
0
CHIP_OUTPUT_REG
=
1
CHIP_CONF_REG
=
3
echo
"Found SMBUS on bus
$BUS
"
REG_VAL
=
$(
i2cget
-y
$BUS
$CHIP_ADDR
$CHIP_INPUT_REG
2>/dev/null
)
if
test
-z
$REG_VAL
;
then
echo
"I2C on SPEC not present"
exit
fi
echo
"Read value
$REG_VAL
on address 0 (expect 0xff)"
echo
"Issuing reset.."
# set bit0 to output
i2cset
-r
-y
-m
1
$BUS
$CHIP_ADDR
$CHIP_CONF_REG
0
# set bit0 to 0
i2cset
-r
-y
-m
1
$BUS
$CHIP_ADDR
$CHIP_OUTPUT_REG
0
# set bit0 to 1
i2cset
-r
-y
-m
1
$BUS
$CHIP_ADDR
$CHIP_OUTPUT_REG
1
if
test
$?
-eq
0
;
then
echo
"Success"
else
echo
"Failed"
fi
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