General troubleshooting
Symptoms
Cause + Fix
- All: The device is not (properly) connected. Check the USB connection using
lsusb
or the Device Manager. - Linux: You may not have enough permission to open the device. Try again with
sudo
. If that works, you can use to make OpenOCD workwithout root privilege. - Windows: You are probably missing the ST-LINK USB driver. Installationinstructions here.
Symptoms
Upon trying to establish a new connection with the device you get an errorthat looks like this:
$ openocd -f (..)
(..)
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f3x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 100ms
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f3x.cpu failed, trying to reexamine
Info : Previous state query failed, trying to reconnect
Cause
The microcontroller may have get stuck in some tight infinite loop or it may becontinuously raising an exception, e.g. the exception handler is raising anexception.
Fix
- Close OpenOCD, if running
- Launch the OpenOCD command
- Now, release the reset button
Symptoms
Cause
The USB connection was lost.
Fix
- Close OpenOCD
- Disconnect and re-connect the USB cable.
- Re-launch OpenOCD
Symptoms
While flashing the device, you get:
$ arm-none-eabi-gdb $file
Start address 0x8000194, load size 31588
Transfer rate: 22 KB/sec, 5264 bytes/write.
Ignoring packet error, continuing...
Ignoring packet error, continuing...
Cause
Or, itmdump
was called after the monitor tpiu
was issued thus makingitmdump
delete the file / named-pipe that OpenOCD was writing to.
Fix
- Close/kill GDB, OpenOCD and
- Remove the file / named-pipe that
itmdump
was using (for example,itm.txt
). - Launch OpenOCD
- Then, launch
itmdump
- Then, launch the GDB session that executes the
monitor tpiu
command.
Cargo problems
Symptoms
Cause
You are using a toolchain older than nightly-2018-04-08
and forgot to call rustup target add
thumbv7em-none-eabihf
.
Fix
$ rustup update nightly