Skip to main content
Topic: Fast mode not working (Read 5155 times) previous topic - next topic

Fast mode not working

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]
# 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]
$ 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

Re: Fast mode not working

Reply #1
[quote author="marcus"]Hi there!
The normal mode is ok to download small programs, but debugging (jumping through breakpoints) is no fun.
[/quote]


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]
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.

Re: Fast mode not working

Reply #2
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.

Re: Fast mode not working

Reply #3
Thanks for the fix, I added it to the tracker.
Got a question? Please ask in the forum for the fastest answers.

 

Re: Fast mode not working

Reply #4
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]
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