openocd jtag pin toggle
[x300-pci] / openocd-jtag / stm32vldiscovery_bs.tcl
1 # Example script to test STM32VLDiscovery with boundary scan
2
3 init
4
5 echo "\n\nStarting basic STM32VLDiscovery JTAG boundary scan test\n"
6
7 source manual_bs.tcl
8
9 init_bs stm32f1x.bs 232
10 extest_mode
11 exchange_bsr
12 echo "All LEDs should be OFF, press Enter"
13 read stdin 1
14
15 # Set PC9 to output 1
16 set_bit_bsr 72 0
17 set_bit_bsr_do 71 1
18 echo "Green LED should be ON, blue LED OFF, press Enter"
19 read stdin 1
20
21 # Set PC8 to output 1
22 set_bit_bsr 75 0
23 set_bit_bsr_do 74 1
24 echo "Green and blue LEDs should be ON, press Enter"
25 read stdin 1
26
27 # Set PC9 to output 0
28 set_bit_bsr_do 71 0
29 echo "Blue LED should be ON, green LED OFF, press Enter"
30 read stdin 1
31
32 # Set PC9 to output 1
33 set_bit_bsr_do 71 1
34 foreach i {0 1} {
35     echo "Green and blue LEDs should be ON, do NOT press the USER button, press Enter"
36     read stdin 1
37     # Read PA0 state, there's a pulldown on board
38     if {[sample_get_bit_bsr 187] == 1} {
39         echo "Button is stuck at 1: ERROR, aborting"
40         shutdown
41         return
42     }
43
44     echo "Green and blue LEDs should be ON, DO press the USER button, press Enter"
45     read stdin 1
46     if {[sample_get_bit_bsr 187] == 0} {
47         echo "Button is stuck at 0: ERROR, aborting"
48         shutdown
49         return
50     }
51 }
52
53 echo "All tests passed SUCCESSFULLY, exiting"
54 shutdown