Skip to content
Snippets Groups Projects
Commit 81416dc3 authored by Gijs Schoonderbeek's avatar Gijs Schoonderbeek
Browse files

First version after HW mod. working at 10Mbit/s

parent d53092fe
No related branches found
No related tags found
1 merge request!2Modified the scripts to run on Raspberry Pi.
...@@ -137,8 +137,52 @@ def read_link_status(ports=4): ...@@ -137,8 +137,52 @@ def read_link_status(ports=4):
stri += "link down " stri += "link down "
print(stri) print(stri)
# Read phy registister status # Read phy registister status
# read_switch(0x80+cnt,0x1e) for cnt in range(4):
ret = read_switch(0x80+cnt,0x02, pr_stri = False)
stri = " Phy status ch {} ".format(cnt)
if ret[1] & 0x20 :
stri += "AN_complete "
if ret[1] & 0x04:
stri += "link up "
if ret[1] & 0x10:
stri += "remote fault "
# print(stri)
ret = read_switch(0x80+cnt,0x14, pr_stri = False)
stri += " 1000BASE-T status ch{} ".format(cnt)
if ret[2] & 0x10:
stri += "remote status is good "
if ret[2] & 0x20:
stri += "local status is good "
if ret[2] & 0x40:
stri += "local master"
else:
stri += "local slave"
else:
stri += " No link "
print(stri)
write_switch_bytes(0x80+cnt, 0x3c, [0x35, 0x08])
ret = read_switch(0x80+cnt,0x3e)
if 0:
print("Drop packet count register")
for cnt in range(16):
# read_switch(0x41,0x80+2*cnt)
read_switch(0x0,0x0 + cnt)
print("Port State Override")
for cnt in range(16):
# read_switch(0x41,0x80+2*cnt)
read_switch(0x0,0x60 + cnt)
read_switch(0x0,0x10)
read_switch(0x0,0x20)
if 1:
print("Receive count register")
if 1:
print("Receive count register")
for cnt in range(16):
write_switch_bytes(0x10+cnt, 0x20, [0xD0, 0x09])
time.sleep(0.5)
for cnt in range(16):
# read_switch(0x41,0x80+2*cnt)
read_switch(0x10+cnt,0x2e)
# Open a connection to a specific bus and device (chip select pin) # Open a connection to a specific bus and device (chip select pin)
...@@ -172,12 +216,23 @@ elif sys.argv[1] == "set": ...@@ -172,12 +216,23 @@ elif sys.argv[1] == "set":
read_switch(0x40,0x01) read_switch(0x40,0x01)
print("strap resistors") print("strap resistors")
read_switch(0x01,0x70) read_switch(0x01,0x70)
if 1:
print("write and read SGMII register CH0") print("write and read SGMII register CH0")
write_switch_bytes(0x10, 0x24, [0x44, 0x00]) write_switch_bytes(0x10, 0x24, [0x44, 0x00])
read_switch(0x10,0x24) read_switch(0x10,0x24)
print("write and read SGMII register CH3") print("write and read SGMII register CH3")
write_switch_bytes(0x13, 0x24, [0x44, 0x00]) write_switch_bytes(0x13, 0x24, [0x44, 0x00])
read_switch(0x13,0x24) read_switch(0x13,0x24)
write_switch_bytes(0x0, 0x20, [0x06])
for cnt in range(16):
write_switch_bytes(0x0, 0x0+cnt, [0x00])
for cnt in range(4):
write_switch_bytes(0x80+cnt, 0x00, [0x00, 0x01])
ret = read_switch(0x80+cnt,0x00)
for cnt in range(16):
write_switch_bytes(0x10+cnt, 0x00, [0x40, 0x11])
write_switch_bytes(0x10+cnt, 0x20, [0xD0, 0x09])
else: else:
print("spi_switch_Unb2c stat for status") print("spi_switch_Unb2c stat for status")
print("spi_switch_Unb2c set to set registers") print("spi_switch_Unb2c set to set registers")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment