Verify the installation

Let’s verify that all the tools were installed correctly.

Linux only

Verify permissions

Connect the F3 to your laptop using an USB cable. Be sure to connect the cable to the “USB ST-LINK”port, the USB port in the center of the edge of the board.

The F3 should now appear as a USB device (file) in /dev/bus/usb. Let’s find out how it gotenumerated:

  1. $ lsusb | grep -i stm
  2. Bus 003 Device 004: ID 0483:374b STMicroelectronics ST-LINK/V2.1
  3. $ # ^^^ ^^^

In my case, the F3 got connected to the bus #3 and got enumerated as the device #4. This means thefile /dev/bus/usb/003/004 is the F3. Let’s check its permissions:

  1. $ ls -l /dev/bus/usb/003/004
  2. crw-rw-rw- 1 root root 189, 20 Sep 13 00:00 /dev/bus/usb/003/004

The permissions should be crw-rw-rw-. If it’s not … then check your udevrules and try re-loading them with:

  1. $ sudo udevadm control --reload-rules

Now let’s repeat the procedure for the Serial module.

Unplug the F3 and plug the Serial module. Now, figure out what’s its associated file:

  1. $ lsusb | grep -i ft232
  2. Bus 003 Device 005: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC

In my case, it’s the /dev/bus/usb/003/005. Now, check its permissions:

  1. $ ls -l /dev/bus/usb/003/005
  2. crw-rw-r-- 1 root root 189, 21 Sep 13 00:00 /dev/bus/usb/003/005

As before, the permissions should be crw-rw-r--.

All

First OpenOCD connection

First, connect the F3 to your laptop using an USB cable. Connect the cable to the USB port in thecenter of edge of the board, the one that’s labeled “USB ST-LINK”.

Two red LEDs should turn on right after connecting the USB cable to the board.

Next, run this command:

  1. $ # *nix
  2. $ openocd -f interface/stlink-v2-1.cfg -f target/stm32f3x.cfg
  3. $ # Windows
  4. $ # NOTE cygwin users have reported problems with the -s flag. If you run into
  5. $ # that you can call openocd from the `C:\OpenOCD\share\scripts` directory
  6. $ openocd -s C:\OpenOCD\share\scripts -f interface/stlink-v2-1.cfg -f target/stm32f3x.cfg

NOTE Windows users: C:\OpenOCD is the directory where you installed OpenOCD to.

IMPORTANT There is more than one hardware revision of the STM32F3DISCOVERY board. For olderrevisions, you’ll need to change the “interface” argument to -f interface/stlink-v2.cfg (note:no -1 at the end). Alternatively, older revisions can use -f board/stm32f3discovery.cfginstead of -f interface/stlink-v2-1.cfg -f target/stm32f3x.cfg.

You should see output like this:

  1. Open On-Chip Debugger 0.10.0
  2. Licensed under GNU GPL v2
  3. For bug reports, read
  4. http://openocd.org/doc/doxygen/bugs.html
  5. Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
  6. adapter speed: 1000 kHz
  7. adapter_nsrst_delay: 100
  8. Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
  9. none separate
  10. Info : Unable to match requested speed 1000 kHz, using 950 kHz
  11. Info : Unable to match requested speed 1000 kHz, using 950 kHz
  12. Info : clock speed 950 kHz
  13. Info : STLINK v2 JTAG v27 API v2 SWIM v15 VID 0x0483 PID 0x374B
  14. Info : using stlink api v2
  15. Info : Target voltage: 2.915608
  16. Info : stm32f3x.cpu: hardware has 6 breakpoints, 4 watchpoints

(If you don’t … then check the general troubleshooting instructions.)

openocd will block the terminal. That’s fine.

Also, one of the red LEDs, the one closest to the USB port, should start oscillating between redlight and green light.

That’s it! It works. You can now close/kill openocd.