Programming the MCBSTM32F400 evaluation board

This recipe will detail modifications that are necessary for the Blinky program created by the Eclipse project wizard and will show how to use the MDK-ARM Eclipse plug-in to flash the STM32F407IG part. We'll call this recipe GNU_ARM_Blinky_c9v0.

How to do it…

  1. Invoke Eclipse.
  2. The MCBSTM32F400 evaluation board uses the STM32F407IG device, so we install the pack supporting this. To install the pack, switch to the Packs perspective and right-click the name of the pack:
    How to do it…
  3. Refer to http://www.keil.com/support/man/docs/ecluv/ecluv_flashSetup.htm and install the MDK-ARM Eclipse plug-in. Note that, once this plug-in is successfully installed, the uVision icon and menu will appear in the toolbar:
    How to do it…
  4. Switch to the C/C++ perspective. Select FileNewC Project and create a new project; give the project a name, select the STM32F4xx toolchain, and click Next:

    How to do it…

  5. Choose the STM32F407xx Chip Family, and select None (no trace output) in Trace output:
    How to do it…
  6. Open BlinkLed.c; in the blink_led_int() function, search for the following statement:
    GPIO_InitStructure.Pull = GPIO_PULLUP;

    Replace this statement with the following one:

    GPIO_InitStructure.Pull = GPIO_PULLDOWN;
  7. Open the header file named BlinkLed.h. Replace the STM32F4DISCOVERY definitions with the following:
    // MCBSTM32F400 Eval. Board defs (led G6, active high)
    
    #define BLINK_PORT_NUMBER               (6)
    #define BLINK_PIN_NUMBER                (6)
    #define BLINK_ACTIVE_LOW                (0)
    How to do it…
  8. Select ProjectBuild All and build the project (or use the hammer icon shortcut).
  9. Select U-Link LoadFlash Download Configurations… and create a new configuration as shown in the following screenshot. Note that selecting Target Options will open the familiar uVision project options dialog window.
    How to do it…
  10. Select Flash Download. We may need to reset the board (depending on how we set the Target Options).

How it works…

We've simply configured the U-Link as a device programmer in this recipe. If you find that this doesn't work, then refer to http://www.keil.com/support/docs/3061.htm. Copy the .hex file created by Eclipse to a uVision project and use uVision to flash the board. You may need to use the UL2_EraseFW.exe utility that we discussed in Chapter 2, C Language Programming. If you do erase the U-Link firmware and subsequently flash the board using Eclipse, then expect the following to appear in the uVision Output Console:

How it works…

The calls to the trace_printf() function that appear in main can be ignored (or commented out). They are present to allow text strings to be displayed in the console debug window using a U-Link communication channel; however, although they work with the discovery board emulator, they don't with the U-Link2 hardware. This is not a serious problem because Chapter 2, C Language Programming describes other equally good approaches to debugging code.

You may have noticed that the GPIO support for LEDs provided by the Eclipse wizard is inferior to that in uVision. To drive multiple LEDs, we'll need to adapt some of the functions in the LED.c uVision file that is part of the Hello_Blinky project that we encountered in Chapter 1, A Practical Introduction to Arm® Cortex®.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.235.188