General troubleshooting

    Symptoms

    Cause + Fix

    • All: The device is not (properly) connected. Check the USB connection usinglsusb or the Device Manager.
    • Linux: You may not have enough permission to open the device. Try again withsudo. 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:

    1. $ openocd -f (..)
    2. (..)
    3. Error: jtag status contains invalid mode value - communication failure
    4. Polling target stm32f3x.cpu failed, trying to reexamine
    5. Examination failed, GDB will be halted. Polling again in 100ms
    6. Info : Previous state query failed, trying to reconnect
    7. Error: jtag status contains invalid mode value - communication failure
    8. Polling target stm32f3x.cpu failed, trying to reexamine
    9. 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:

    1. $ arm-none-eabi-gdb $file
    2. Start address 0x8000194, load size 31588
    3. Transfer rate: 22 KB/sec, 5264 bytes/write.
    4. Ignoring packet error, continuing...
    5. 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

    1. $ rustup update nightly