Pre-Lesson1: Part 6: Building First Example

First download example software(STSW-STM32140) from ST website here, as shown below.

Download Example Code - STSW-STM32140
 
 After unzip the file, browse to location as shown below and open uVisioni 5 project name STM32F0308-Discovery_Demo. We will be using this to ensure setup is working fine.

Since the project file is created for uVision4, there will be a pop up message asking to 'Migrate to Device Pack' or 'Install Legacy Support', just select 'Migrate to Device Pack'.
Launch Example Project File

Next click on 'Project' menu bar and select 'Build target'. Compilation will start with pop up of 'Build Output' window pane. At end of compilation you should see '0 Erros(s), 0 Warning (s)', which signify build successful.

Build Successful!

Before starting debugging session, ensure the correct debugger is being select.
  1. Go to menu bar 'Project' -> 'Options for target STM32F0308_Discovery' -> 'Debug' -> 'Use' -> 'ST-Link Debugger'. (Shown in below image)
  2. Click 'Settings' beside 'ST-Link Debugger' -> 'Flash Download' -> 'Add' -> 'STM32F0xx 64kB Flash'
  3. If you skip above steps, error message "Cannot Load Flash Device Description!" will pop up when you starting debugging process.
  4.  In dialog box 'Option for Target STM32F0308 Discovery', click on 'Utility' tab, under 'Use Target Driver For Flash Programming', select 'ST-Link Debugger'
Configure Debugger: ST-Link Debugger

Configure Debugger: ST-Link Debugger

Error Message When Not 'Configure Debugger: ST-Link Debugger'

Now we can start the debugging session, click on menu bar 'Debug' -> 'Start/Stop Debug Session'. Refer to below image, highlighted in black color box is tool bar button that is related to debugging process. For time being, just go to menu bar 'Debug' -> 'Run'.
Debugging Session Ready! Play time.
Now you should see one of the LED(label as LD3) is blinking. Pressing the USER button(label as USER) will:
  1. Light up another LED (LD4)
  2. change the blinking speed of the LED (LD3)
 This is the video showing the board behavior.
This conclude this session and ensure all the hardware, IDE, software tools is working fine. Then we can look into embedded system programming in no time.

4 comments:

  1. Hi, Cheng

    I am experiencing the following problem:

    When I connect the board to my laptop via the USB Type A to Mini B cable, it detected the board and began "Searching Windows Update" for "STM32 STLink" to install device driver software. It could not find the device driver software and hence there was no link to the board, causing failure at the "Debug -> Run" stage. Is there a fix/workaround for this problem?

    Additional info:
    1. Laptop model: Dell's Latitude E6420
    2. Operating System: Windows 7 Professional

    ReplyDelete
  2. Try below method:
    1. When windows searching for drivers, select 'Browse my computer for driver software'
    2. Select folder in path 'C:\Keil_v5\ARM\STLink'. Tick also 'include subfolders' option.
    3. Proceed until ended.
    4. [Optional] You can verified if your driver installation successful by open 'Device manager', under item 'Universal Serial Bus devices' you should see 'STMicroelectronics STLink dongle'

    ReplyDelete
    Replies
    1. I tried the method described and successfully setup my debugging session. Thanks!

      Delete
    2. Glad to hear that, keep up with your effort. I will assist whenever possible.

      Delete