Commit 2d791335 authored by Dave Newbold's avatar Dave Newbold

Updating script

parent 6ebbcc92
......@@ -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)
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