STM32 Value line discovery

stm32vld.jpg

The STM32 Value line discovery is an evaluation board for the ARM Cortex-M3 STM32F100 MCU.

This board has an integrated STLink compatible interface which can be configured to allow the programming of either the board itself or to program an external device.

As with all STM evaluation boards there is lengthy list of restrictions in place regarding what you can and can't do with an evaluation board. See this document.

Pinout

GND  1          STLINKv1 USB         28 GND
NC   2                               27 NC
3V3  3                               26 5V
VBAT 4                               25 PB9
PC13 5                               24 PB8
PC14 6                               23 BOOT
PC15 7                               22 PB7
PD0  8      SWD             CN3      21 PB6
PD1  9  VDD_TARGET x         x       20 PB5
NRST 10 SWCLK      x         x       19 PB4
PC0  11 GND        x         x       18 PB3
PC1  12 SWDIO      x         x       17 PD2
PC2  13                              16 PC12
PC3  14                              15 PC11
PA0  15                              14 PC10
PA1  16                              13 PA15
PA2  17                              12 PA14
PA3  18                              11 PA13
PA4  19 JP1     STM32F100RBT6B       10 PA12
PA5  20 idd                           9 PA11
PA6  21                               8 PA10 RXD
PA7  22                               7 PA9  TXD
PC4  23                               6 PA8
PC5  24                               5 PC9
PB0  25                               4 PC8
PB1  26 PA0                    RST    3 PC7
PB2  27 USER                   RESET  2 PC6
GND  28                               1 GND
      GREEN LED               BLUE LED
      PC9                     PC8
        1    2    3    4    5    6
       PB10 PB11 PB12 PB13 PB14 PB15

CN3 is used to configure either internal or external programming.

Issues

This device is recognised as a mass storage device which doesn't actually work.

On the RPi add the following to /boot/cmdline.txt and reboot.

usb-storage.quirks=483:3744:i,483:374b:i,483:374e:i

With ARMBIAN, update /boot/armbianEnv.txt and reboot.

usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u,0x0483:0x3744:i,0x0483:0x374b:i,0x0483:0x374e:i

Similar modprobe options are used if mass storage is a module.

options usb-storage quirks=483:3744:i,483:374b:i,483:374e:i

When the device is plugged in, something like this is logged:

usb-storage 1-1.2.1:1.0: USB Mass Storage device detected
usb-storage 1-1.2.1:1.0: device ignored

This will stop mass storage using the device, however, it doesn't mean it will function correctly and will take a number of probes until it operates and may never work.

A solution is as follows

#! /bin/sh
#
# ON DEVICE ERROR
# RUN THIS SCRIPT
# UNPLUG STM32 VL Discovery
# PLUG IN STM32 VL Discovery
# CTRL-C
#
while test 1; do
        openocd -f "interface/stlink.cfg" -c "transport select hla_swd" -f "target/stm32f1x.cfg"
        sleep 0.1
done

Clocks

HSE 8000000 X2 ESA8.00000F20D25F
HSI 8000000
LSE 32768   X3 MC306-G-06Q-32.768
LSI 40000

LED demo

Install OpenCM3.

NB STLink no longer operates with this board's firmware.

Install STLink programmer.

Enter the OpenCM3 fancy blink example's sub-directory and program the chip.

cd /embedded/arm-cortex/src/libopencm3-examples/examples/stm32/f1/stm32vl-discovery/fancyblink/
make PREFIX=/embedded/arm-cortex/gcc-arm-none-eabi-4_9-2015q1/bin/arm-none-eabi fancyblink.stlink-flash
 FLASH fancyblink.bin
 INFO src/stlink-common.c: Loading device parameters....
 INFO src/stlink-common.c: Device connected is: F1 Medium/Low-density Value Line device, id 0x10016420
 INFO src/stlink-common.c: SRAM size: 0x2000 bytes (8 KiB), Flash: 0x20000 bytes (128 KiB) in pages of 1024 bytes
 INFO src/stlink-sg.c: Successfully opened a stlink v1 debugger
 INFO src/stlink-common.c: Attempting to write 1224 (0x4c8) bytes to stm32 address: 134217728 (0x8000000)
Flash page at addr: 0x08000400 erased
 INFO src/stlink-common.c: Finished erasing 2 pages of 1024 (0x400) bytes
 INFO src/stlink-common.c: Starting Flash write for VL/F0/F3 core id
 INFO src/stlink-common.c: Successfully loaded flash loader in sram
  1/1 pages written
 INFO src/stlink-common.c: Starting verification of write complete
 INFO src/stlink-common.c: Flash written and verified! jolly good!
STM32Flash

As an alternative to STLink install STM32Flash and program via the serial UART boot loader.

STM32              CP2102 (NB Baite module has incorrect labels)
=====              ======
3V3     ----------
BOOT    ---220R---
PA10 RX ---------- RXD (TX)
PA9  TX ---------- TXD (RX)
GND     ---------- GND

Press RESET to enter boot loader mode and use STM32Flash to program and execute the code. Repeat as necessary.

stm32flash -b 115200 -w fancyblink.bin -v -g 0x0 /dev/ttyCP2102
stm32flash 0.4

http://stm32flash.googlecode.com/

Using Parser : Raw BINARY
Interface serial_posix: 115200 8E1
Version      : 0x22
Option 1     : 0x00
Option 2     : 0x00
Device ID    : 0x0420 (Medium-density VL)
- RAM        : 8KiB  (512b reserved by bootloader)
- Flash      : 128KiB (sector size: 4x1024)
- Option RAM : 16b
- System RAM : 2KiB
Write to memory
Erasing memory
Wrote and verified address 0x080004c8 (100.00%) Done.

Starting execution at address 0x08000000... done.

Resources

This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information