Friday 24 September 2010

Blinky II

After having installed the GNU ARM Compiler, you need to change your path so it can access the executables. You can do this via :

export PATH=$PATH:/aux/arm-gcc/bin

for example (this assumes the executables are in /aux/arm-gcc/gin - it will vary depending on where you built them)

You now need to download the very simple sources for Blinky 2 at http://www.robsons.org.uk/blinky.zip - this is a very simple file which flashes the two LEDs and varying rates, stopping one flashing whenever the button is pressed.

To build it, just type

make

and to run it, reset the STM32 Discovery, type

stm32flash -w blinky.bin -v /dev/ttyS0 -g 0x0

which instructs the flash loader to write the binary, verify it, and run it - using /dev/ttyS0 as the interface. You should have flashing LEDs. 

The link (mine) is still not 100% reliable. It seems to work best if you press the reset and immediately run the command.

In my next post I will take a look at what blinky.c is actually doing.

3 comments:

  1. I connected 100K pull-up resistor between TX pin (PA9) and +3.3V, that fixed link reliability issue.

    ReplyDelete
  2. i always get this error:

    ze@ze-KPC:~/teste$ sudo stm32flash -w blinky.bin -v /dev/ttyUSB0 -g 0x0
    stm32flash - http://stm32flash.googlecode.com/

    Using Parser : Raw BINARY
    Serial Config: 57600 8E1
    read_byte: Success
    stm32flash: stm32.c:90: stm32_read_byte: Assertion `0' failed.
    Aborted


    I have the stm32discovery kit connected to usb to power it.
    I have a ftdi converter with tx connect to PA10 and rx to PA9, and of course GND to GND.
    I have a resistor between Boot and 5V.

    ReplyDelete
  3. Done :D I just didn't read the reset part :p

    ReplyDelete