-
-
Save flatz/1bd02ecf684874fa37da0e723bb6fc6b to your computer and use it in GitHub Desktop.
JTAG Boundary-Scan Examples for OpenOCD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# OpenOCD script to demonstrate JTAG Boundary-Scan I/O | |
# It will blink the LED connected to Pin34 of VQ44 package. | |
# Supports XC2C64 and XC2C64A . | |
# See xc2c64_vq44.bsd or xc2c64a_vq44.bsd | |
# | |
# Invoke it like this: | |
# openocd -f interface/ftdi/openocd-usb.cfg -f XC2C64-Blink-Test.ctl | |
adapter speed 1000 | |
transport select jtag | |
jtag newtap xc2c64 bs -irlen 8 -ignore-version -expected-id 0x06c5e093 -expected-id 0x06e5e093 | |
init | |
# IDCODE | |
irscan xc2c64.bs 1 | |
if ![string match ?6\[ce\]5\[89abcdef\]093 [drscan xc2c64.bs 32 0x00000000]] { | |
error "Unexpected IDCODE" | |
} | |
# SAMPLE/PRELOAD | |
irscan xc2c64.bs 3 | |
drscan xc2c64.bs 192 0x000000000000000000000000000000000000000000000000 | |
# EXTEST | |
irscan xc2c64.bs 0 | |
while true { | |
drscan xc2c64.bs 192 0x000000200000000000000000000000000000000000000000 | |
sleep 500 | |
drscan xc2c64.bs 192 0x000000600000000000000000000000000000000000000000 | |
sleep 500 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# OpenOCD script to demonstrate JTAG Boundary-Scan I/O | |
# It will update the state of LED connected to Pin34 according to | |
# input from SW1 (Pin30) and SW2 (Pin29) . | |
# Supports CR2DIP CPLD lerning kit. ( XC2C64 and XC2C64A ) | |
# See xc2c64_vq44.bsd or xc2c64a_vq44.bsd | |
# | |
# Invoke it like this: | |
# openocd -f interface/ftdi/openocd-usb.cfg -f XC2C64-Response-Test.ctl | |
adapter speed 1000 | |
transport select jtag | |
jtag newtap xc2c64 bs -irlen 8 -ignore-version -expected-id 0x06c5e093 -expected-id 0x06e5e093 | |
init | |
# IDCODE | |
irscan xc2c64.bs 1 | |
if ![string match ?6\[ce\]5\[89abcdef\]093 [drscan xc2c64.bs 32 0x00000000]] { | |
error "Unexpected IDCODE" | |
} | |
# SAMPLE/PRELOAD | |
irscan xc2c64.bs 3 | |
set sample [drscan xc2c64.bs 192 0x000000000000000000000000000000000000000000000000] | |
# EXTEST | |
irscan xc2c64.bs 0 | |
while true { | |
set sw1 [expr (0x[string range $sample 9 9] & 8) ? 0 : 1] | |
set sw2 [expr (0x[string range $sample 12 12] & 8) ? 0 : 1] | |
# echo "$sw1 $sw2" | |
if [expr ($sw1 ^ $sw2)] { | |
set send_data 0x000000200000000000000000000000000000000000000000 | |
} else { | |
set send_data 0x000000600000000000000000000000000000000000000000 | |
} | |
set sample [drscan xc2c64.bs 192 $send_data] | |
# sleep 100 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment