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

Updating script

parent 6ebbcc92
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
import uhal import uhal
import time import time
import sys import sys
import random
from I2CuHal import I2CCore from I2CuHal import I2CCore
uhal.setLogLevelTo(uhal.LogLevel.ERROR) uhal.setLogLevelTo(uhal.LogLevel.ERROR)
...@@ -18,20 +19,24 @@ spi.getNode("ctrl").write(0x2410) # 16b transfer length, auto CSN ...@@ -18,20 +19,24 @@ spi.getNode("ctrl").write(0x2410) # 16b transfer length, auto CSN
spi.getNode("ss").write(0x1) # Enable SPI slave 0 spi.getNode("ss").write(0x1) # Enable SPI slave 0
hw.dispatch() hw.dispatch()
spi.getNode("d0").write(0x04a5) # Write 0xa5 into register 0x4 for i in range(256):
spi.getNode("ctrl").write(0x2510) # Do it
hw.dispatch() di = random.randint(0x00,0xff)
d = spi.getNode("d0").read() spi.getNode("d0").write(0x0400 + di) # Write 0xa5 into register 0x4
c = spi.getNode("ctrl").read() spi.getNode("ctrl").write(0x2510) # Do it
hw.dispatch() hw.dispatch()
print hex(d), hex(c)
# d = spi.getNode("d0").read()
spi.getNode("d0").write(0x8400) # Read from register 0x4 # c = spi.getNode("ctrl").read()
spi.getNode("ctrl").write(0x2510) # Do it # hw.dispatch()
hw.dispatch() # print hex(d), hex(c)
d = spi.getNode("d0").read() spi.getNode("d0").write(0x8400) # Read from register 0x4
c = spi.getNode("ctrl").read() spi.getNode("ctrl").write(0x2510) # Do it
hw.dispatch() hw.dispatch()
print hex(d), hex(c)
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