Saturday 18 September 2010

Life on Planet STM.

This step is relatively simple after the last one - you connect the Serial converter built in the last post to the STM32. There are two wires - one runs from PA10 (actually USART1/Rx) on the STM to pin 12 of the MAX3232, the second one runs from PA9 (actually USART1/Tx) on the STM to pin11 of the MAX3232.

You can see the wires (the two green ones) here.

The completed programming circuit for the STM32 Discovery
The software I used to check it was working I got from this page STM32 ARM Cortext bootloader. It is a python app called "stm32loader" and the link is about half way down the main text.  It requires python and pyserial to work.

If you download this file, reset the STM32 board using the black button, then run the program with the following :-

python stm32loader.py -p /dev/ttyS0

with a bit of luck it will echo back at you :

Bootloader version 22
Chip id `['0x4', '0x20']'



You may have to try a few times. It seems a little unreliable on my machine, not related to the baud rate either. The thing that seems to help is having a short gap between the reset press and running the python application.

It will sometimes echo "Can't init. Ensure that BOOT0 is enabled and reset device" back instead. I'm not sure if this is the application or the hardware.

Various possible causes spring to mind - the STM programmer interfering, the buggy USB key interfering, the circuitry being wrong.

I have found a C program which claims to do the same thing, and will experiment with that.

7 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. gdb/gdbserver works with the STM32 on Windows - it is usable even on my MSI Wind Netbook. Here is what you need to do:

    The Atollic gdb server does not work as installed.

    1. The server is located in
    "Program Files/Atollic/TrueSTUDIO STM32 Lite 1.4.0/Servers/ST-Link_gdbserver"

    ST-Link_gdbserver.bat will start the server using the config.txt file. However, this file is missing one important option: -d
    Add the following lines to the end of this file:

    ##############################################################
    # -d enable STD mode
    # ############################################################
    -d

    From a DOS box, launch gdbserver (assuming you have the server in your path):
    ST-Link_gdbserver.bat

    2. The ARM tool chain is located in
    "Program Files/AtollicTrueSTUDIO STM32 Lite 1.4.0/ARMTools"
    This includes arm-atollic-eabi-gdb.exe.

    From another DOS box launch gdb:
    Program Files/AtollicTrueSTUDIO STM32 Lite 1.4.0/ARMTools/bin/arm-atollic-eabi-gdb.exe
    Connect to the server using the following at the gdb command prompt
    target remote localhost:61234
    You should see messages on the gdbserver console indicating connection and you should see the
    gdb prompt in this DOS box.

    The following command will display the registers:
    info regs


    There are some additional options available for the gdbserver. use the -h switch to see them.


    I have not tried any other tool chains yet as it take forever to build them under cygwin.

    ReplyDelete
  3. I just hacked my protoboard so I could work with this board:

    http://maujabur.blogspot.com/2010/11/stm32-discovery-pinout-fail.html

    ReplyDelete
  4. If you would like also to program the STM32F103 on the discovery board : https://sites.google.com/site/mcu314/project-updates/programalsothestm32f103onthediscoveryboard

    ReplyDelete
  5. Tim - YOU ARE THE MAN! i've been tearing my hair out trying to get my discovery board doing *anything* and i was able to get gdb talking to the board with your guide. now if only i could figure out how to start sending code from atollic....

    ReplyDelete
  6. Really sorry guys, but where are the tutorials to be found?

    ReplyDelete
  7. chrltn101 - here is a good tutorial for getting the stm32 discovery boards working with Linux or Mac OS X http://cu.rious.org/make/stm32f4-discovery-board-with-linux/

    ReplyDelete