Navigation Menu

Skip to content

Commit

Permalink
Handle UART exception for PMU7xx
Browse files Browse the repository at this point in the history
  • Loading branch information
JianXiongZ committed Oct 13, 2017
1 parent 7addaa1 commit 288c65c
Showing 1 changed file with 28 additions and 18 deletions.
46 changes: 28 additions & 18 deletions scripts/avalon7/avalon7-pmu-test.py
Expand Up @@ -12,7 +12,11 @@
parser.add_option("-c", "--choose", dest="is_rig", default="0", help="0 Is For Rig Testing")
(options, args) = parser.parse_args()

ser = Serial(options.serial_port, 115200, 8, timeout=0.2) # 1 second
ser = None
try:
ser = Serial(options.serial_port, 115200, 8, timeout=0.2) # 1 second
except Exception as e:
print str(e)

PMU721_TYPE = ( 'PMU721' )
PMU741_TYPE = ( 'PMU741' )
Expand Down Expand Up @@ -343,23 +347,29 @@ def test_polling():
if __name__ == '__main__':
while (True):
if options.is_rig == '0':
set_led_state("0000")
set_vol_value("88dd")
if detect_version() == True:
time.sleep(3)
ret = get_result()
if ret == 0:
set_led_state("0101")
print(PMU_TYPE + " test pass")
elif ret == 1:
set_led_state("0801")
print(PMU_TYPE + " Slice 1 test fail")
elif ret == 2:
set_led_state("0108")
print(PMU_TYPE + " Slice 2 test fail")
else:
set_led_state("0202")
print(PMU_TYPE + " test fail")
try:
set_led_state("0000")
set_vol_value("88dd")
if detect_version() == True:
time.sleep(3)
ret = get_result()
if ret == 0:
set_led_state("0101")
print(PMU_TYPE + " test pass")
elif ret == 1:
set_led_state("0801")
print(PMU_TYPE + " Slice 1 test fail")
elif ret == 2:
set_led_state("0108")
print(PMU_TYPE + " Slice 2 test fail")
else:
set_led_state("0202")
print(PMU_TYPE + " test fail")
except:
print("Errors are found on USB or connections.")
print("Please check the cable and run it again!")
raw_input("Press any key to exit!")
sys.exit(1)

raw_input("Please enter to continue:")
elif options.is_rig == '1':
Expand Down

0 comments on commit 288c65c

Please sign in to comment.