The Cortex M3 board

From ConceptCar
Revision as of 13:38, 13 October 2009 by Donald (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The Cortex M3 board

Manufacturer: Olimex --> (http://olimex.com/dev/stm32-p103.html)

CPU: Cortex M3 (STM32F103RBT6 @ 72MHz, 20k RAM, 128k ROM)

Flashing the board

Easiest way: Use ARM USB TINY JTAG adaptor (http://olimex.com/dev/arm-usb-tiny.html).

You need OpenOCD version 0.2.0, a windows executable and the config file is here --> SVN

Compiling OpenOCD

Get openocd-0.2.0, libusb-win32-device-bin-0.12.2, ftdi drivers 2.04.16.

Compile with cygwin gcc, but for cygwin-independent target.

Enabled programmers are the usbProg and the ARM-USB-TINY.

Compile this way:

> ./configure --enable-usbprog --enable-ft2232_ftd2xx \
  --with-ftd2xx-win32-zipdir=<path_to_ftd2xx_driver> \
  CC="gcc -mno-cygwin" \ 
  CFLAGS="-I<path_to_libusb-win32-device-bin>/include/"\
  LDFLAGS="-L<path_to_libusb-win32-device-bin>/lib/"
> make

After that, the executable openocd.exe is in the src folder. It should be identical to the openocd-0.2.0-win32.exe from SVN.

Flashing a new firmware (using ARM-USB-TINY)

The SVN contains a file main.bin which is a very simple blinking lights demo for the board.

  • Open a console (cygwin bash or DOS shell) and enter the directory with the following files:
    • openocd-0.2.0-win32.exe
    • olimex_stm32_h103_ft2232.cfg
  • Run the command:
> openocd-0.2.0-win32 -f olimex_stm32_h103_ft2232.cfg
  • The console should show this output:
Open On-Chip Debugger 0.2.0 (2009-10-13-12:05) Release
$URL: http://svn.berlios.de/svnroot/repos/openocd/tags/openocd-0.2.0/src/openocd.c $
For bug reports, read http://svn.berlios.de/svnroot/repos/openocd/trunk/BUGS
jtag_speed: 0
jtag_nsrst_delay: 100
jtag_ntrst_delay: 100
Info : device: 4
Info : deviceID: 364511236
Info : SerialNumber: FTS92Y5TA
Info : Description: Olimex OpenOCD JTAG TINY A
Info : JTAG tap: stm32.cpu tap/device found: 0x3ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x3)
Info : JTAG Tap/device matched
Info : JTAG tap: stm32.bs tap/device found: 0x16410041 (mfg: 0x020, part: 0x6410, ver: 0x1)
Info : JTAG Tap/device matched
  • Open a secondary console and enter the directory your binary file is in (in this case the main.bin demo)
  • Launch a telnet session:
> telnet localhost 4444
  • Execute the following command sequence:
> reset
> halt
> flash write_image erase main.bin 0x08000000
  • Your console prompt should be showing something like this:
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Open On-Chip Debugger
> reset
JTAG tap: stm32.cpu tap/device found: 0x3ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x3)
JTAG Tap/device matched
JTAG tap: stm32.bs tap/device found: 0x16410041 (mfg: 0x020, part: 0x6410, ver: 0x1)
JTAG Tap/device matched
> halt
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x21000000 pc: 0x000000c2
> flash write_image erase main.bin 0x08000000
auto erase enabled
device id = 0x20036410
flash size = 128kbytes
wrote 4052 byte from file main.bin in 0.375000s (10.552083 kb/s)
  • Congratulations! Your new firmware is flashed. You can start it by resetting the MCU or by issuing another command in the telnet session:
> resume 0

If you flashed the blinking demo, the LED is blinking right now ...

Flashing a new firmware (using UsbProg)

Should be similar, but this device sucks in openOCD mode ...

Remarks

  • Flashing speed is quite high, > 10kBytes/s, so the whole process takes only seconds.