Fast mode not working

OpenOCD JTAG debugging with the Bus Pirate.

Fast mode not working

Postby marcus » Sun Jun 03, 2012 9:26 pm

Hi there!
I"m using a V3.5c Bus Pirate with bootloader v4.4 and firmware v6.1 r1676 plus OpenOCD version 0.5.0 to programm STM32F101 and F103 microcontrollers.
Thanks to the many tutorials out there I already got flashing and debugging working using OpenOCD. However, I am currently not able to use the fast mode. The normal mode is ok to download small programs, but debugging (jumping through breakpoints) is no fun.
Here is bus pirate part of the openocd config file:
Code: Select all
# Interface configuration
# Bus Pirate V3.5
interface buspirate
# you need to specify port on which BP lives
buspirate_port /dev/buspirate
# communication speed setting
buspirate_speed normal # normal or fast
# voltage regulator Enabled = 1 Disabled = 0
buspirate_vreg 1
# pin mode normal or open-drain
buspirate_mode normal
# pullup state Enabled = 1 Disabled = 0
buspirate_pullup 0

And here the error message:
Code: Select all
$ openocd -f openocd_buspirate.cfg
Open On-Chip Debugger 0.5.0 (2012-05-22-15:24)
Licensed under GNU GPL v2
[...] documentation url removed, because apparently my post looks to spamy! :-) [...]
Warn : Adapter driver 'buspirate' did not declare which transports it allows; assuming legacy JTAG-only
Info : only one transport option; autoselect 'jtag'
srst_only separate srst_gates_jtag srst_open_drain
1000 kHz
adapter_nsrst_delay: 100
jtag_ntrst_delay: 100
cortex_m3 reset_config sysresetreq
Error: Error reading data
Error: Buspirate did not ack speed change

Anybody out there knowing a solution or has some hints where to problem could be?

Thanks a lot!

:-) Marcus
Posts: 2
Joined: Sun Jun 03, 2012 9:12 pm

Re: Fast mode not working

Postby robots » Wed Jun 06, 2012 3:04 am

marcus wrote:Hi there!
The normal mode is ok to download small programs, but debugging (jumping through breakpoints) is no fun.

Using hardware breakpoints helps a bit.

Put this in the ".gdbinit" file (must be in the same directory where you are starting gdb)
Code: Select all
monitor gdb_breakpoint_override hard

Maybe it would be enough to put it in the openocd.cfg, not sure (without the "monitor" keyword)

Could you rerun your experiment with debug ? "-d 3" parameter. Thanks.
User avatar
Hero Member
Hero Member
Posts: 569
Joined: Sat Dec 05, 2009 11:19 am
Location: CZ/Prague

Re: Fast mode not working

Postby lis0r » Wed Nov 07, 2012 5:11 am

Fast mode doesn't work because of a bug in the OpenOCD buspirate code. On some systems, the change of baudrate occurs so quickly that the outgoing data is discarded, and the speed change command never arrives. I added a 100ms sleep before the call to buspirate_serial_setspeed() in buspirate_jtag_set_speed(), and that sorted it right out.
Posts: 1
Joined: Wed Nov 07, 2012 5:05 am

Re: Fast mode not working

Postby ian » Wed Dec 05, 2012 2:42 am

Thanks for the fix, I added it to the tracker.
User avatar
Posts: 10803
Joined: Mon Jul 06, 2009 6:14 am

Re: Fast mode not working

Postby master » Thu Dec 27, 2012 3:18 pm

Ok, to fix BP v3 fast mode
for Open On-Chip Debugger 0.6.1 (2012-12-27-16:18)
go to: openocd-0.6.1/src/jtag/drivers/buspirate.c

edit line 787 inside function
Code: Select all
static void buspirate_jtag_set_speed(int fd, char speed)
//...some things
usleep(100);//add this line of sleep
buspirate_serial_setspeed(fd, speed);
//...some more things
usleep(100);//add this line of some more sleep

this works from as low as usleep(70) before and after serial_setspeed
thanks, lis0r
Posts: 3
Joined: Wed Dec 26, 2012 10:40 pm

Return to OpenOCD JTAG