Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
E
euro-adc-65m-14b-40cha-gw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
eurocard
euro-adc-65m-14b-40cha
euro-adc-65m-14b-40cha-gw
Commits
2d791335
Commit
2d791335
authored
Aug 21, 2017
by
Dave Newbold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updating script
parent
6ebbcc92
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
17 deletions
+22
-17
spi_test.py
projects/64ch/software/spi_test.py
+22
-17
No files found.
projects/64ch/software/spi_test.py
View file @
2d791335
...
...
@@ -3,6 +3,7 @@
import
uhal
import
time
import
sys
import
random
from
I2CuHal
import
I2CCore
uhal
.
setLogLevelTo
(
uhal
.
LogLevel
.
ERROR
)
...
...
@@ -18,20 +19,24 @@ spi.getNode("ctrl").write(0x2410) # 16b transfer length, auto CSN
spi
.
getNode
(
"ss"
)
.
write
(
0x1
)
# Enable SPI slave 0
hw
.
dispatch
()
spi
.
getNode
(
"d0"
)
.
write
(
0x04a5
)
# Write 0xa5 into register 0x4
spi
.
getNode
(
"ctrl"
)
.
write
(
0x2510
)
# Do it
hw
.
dispatch
()
d
=
spi
.
getNode
(
"d0"
)
.
read
()
c
=
spi
.
getNode
(
"ctrl"
)
.
read
()
hw
.
dispatch
()
print
hex
(
d
),
hex
(
c
)
spi
.
getNode
(
"d0"
)
.
write
(
0x8400
)
# Read from register 0x4
spi
.
getNode
(
"ctrl"
)
.
write
(
0x2510
)
# Do it
hw
.
dispatch
()
d
=
spi
.
getNode
(
"d0"
)
.
read
()
c
=
spi
.
getNode
(
"ctrl"
)
.
read
()
hw
.
dispatch
()
print
hex
(
d
),
hex
(
c
)
for
i
in
range
(
256
):
di
=
random
.
randint
(
0x00
,
0xff
)
spi
.
getNode
(
"d0"
)
.
write
(
0x0400
+
di
)
# Write 0xa5 into register 0x4
spi
.
getNode
(
"ctrl"
)
.
write
(
0x2510
)
# Do it
hw
.
dispatch
()
# d = spi.getNode("d0").read()
# c = spi.getNode("ctrl").read()
# hw.dispatch()
# print hex(d), hex(c)
spi
.
getNode
(
"d0"
)
.
write
(
0x8400
)
# Read from register 0x4
spi
.
getNode
(
"ctrl"
)
.
write
(
0x2510
)
# Do it
hw
.
dispatch
()
d
=
spi
.
getNode
(
"d0"
)
.
read
()
c
=
spi
.
getNode
(
"ctrl"
)
.
read
()
hw
.
dispatch
()
print
hex
(
di
),
hex
(
d
&
0xff
),
hex
(
c
)
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