How much will an SUV cost you?

How much will an SUV cost you?

I was in the market for an SUV not too long ago and had a lot of opportunity to think about the SUV as a financial investment. With such a large financial decision I found myself wondering: How does the vehicle lose its value over time?

I have heard numerous general statements like “you lose a lot of value the minute you drive the car off the dealership parking lot” and  “foreign-made cars hold their value the longest”. Whenever I hear general statements I am always tempted to look at the data myself and verify their validity.

I decided to dust of the old web scraper and fit a few curves to the data and generate some general statements of my own.

Take a look at the analysis here: 01-How much does will an SUV cost you?

100 Days of ML Code

I recently stumbled upon the 100 Days of ML Code initiative, which is an initiative to devote 1 hour per day to either code or study machine learning for 100 days.


I started the challenge on July 9th and am going to use it to actively either improve machine learning models at work (which I unfortunately cannot blog about), or to pursue outside personal projects. Now I will take some liberties with the term “Machine Learning” and funnel it more towards “Data Science” so it will include data mining, data cleaning, and data presentation. Most of the time the actual building of machine learning model is a small sliver of the full project so I will devote my 100 days to the “full stack” of machine learning. Throughout the initiative I will occasionally blog about my progress as time permits.


Unfortunately, given that it is summer, I have started the challenge right around some vacation time, which sometimes takes me away from electronic devices. During those time periods I will read books. Two recommendations that I am currently working my way through are:

  1. Everybody Lies: Big Data, New Data, and What the Internet Can Tell Us About Who We Really Are
  2. How Not to Be Wrong: The Power of Mathematical Thinking

Both of these are excellent books and deal with topics of data collection, statistical inference, and how to create models of the world using information that is readily available.


For more information about the initiative, I encourage you to seek out the hashtag on Twitter.


VREP Video Tutorial Files updated

VREP Video Tutorial Files updated

A few years ago I created 5 tutorials for the virtual robot experimentation platform (VREP). Robot simulation is a vital part of automation and VREP had a high barrier to entry. I created these tutorials for my students at the time to help them with their simulations. These are slightly outdated and some menu items have moved, but these do still serve a purpose.

The tutorials with the corresponding file downloads can all be found at

What is the difference between Arduino and Raspberry Pi?

What is the difference between Arduino and Raspberry Pi?

Although they are often lumped together, the Raspberry Pi and the Arduino are quite different and have their strengths/weaknesses and areas of applications. I gave the following lecture in 2015 at the Edmonton Hardware Meetup to make people aware of the main differences between the Arduino (microcontroller) and the Raspberry Pi (single-board computer).

I was asked for the slides, which you can download the Powerpoint slides at: Powerpoint here.

If you make changes to the slides or have learned something from it, or find mistakes, please email me at edisondev[dot]net[at] That way I know that my work is out there and being used or is full of errors.

Resume in R and ShinyApps

Resume in R and ShinyApps

I have had a lot of opportunity to explore R and shinyapps recently. Shinyapps is used to create and upload interactive R visualizations that allow your readers to interact and modify parameters of your visualization. It is a move away from static images, which is said to leave the reader with a higher understanding of the points that you are trying to make.

Naturally, I tried to use the same principles and created an online interactive resume. My design principles were to visualize as many of the text-only aspects of a resume as possible. I feel like I can do better by tying in a few timeline libraries and will revisit the code in the near future. The interactive resume can be found here:

If you want to try creating your own resume or want to improve on it, you can find the code on github here:

I would love to hear any feedback that you might have at:

DS1307 real-time clock on the MSP430 Launchpad with Energia

DS1307 real-time clock on the MSP430 Launchpad with Energia

The following procedure will show you how to set up your launchpad with Energia and should work for both the MSP-430F5529 and the MSP-430G2553.

Where to Get Parts

The parts in this tutorial can be acquired:



I will be using the DS1307 chip + breakout board from Adafruit.

Breakout-Board Assembly

The MSP430 systems operate on 3.3 Volt logic, and Arduino-based systems use 5V logic. The original Adafruit break-our board is made for 5 Volt logic, but can be modified to work with 3.3Volt logic, by omitting the 2.2kΩ pull-up resistors that come with the kit. Solder the pins, the DS1307 IC, the capacitor and the crystal. When the board is fully assembled, it should look like:


The F5529 board uses the P3.0 (SDA0) and P3.1 (SCL) pins for I2C communication. For more information, see the F5529 board pinout here.

Connect the Launchpad and the RTC breakout board according to the following diagram:

The RTC is powered by the 5 volt line. The SQW pin is not connected in this tutorial, but can be used to receive a square wave output at varying frequencies. The SDA and the SCA pins are connected through a 1.8 kΩ pull-up resistor each to the P3.0 and P3.1 pins, respectively.


Energia Installation

  1. Download the latest Energia version from here(in my case I used the Windows Binary release).
  2. Extract the .zip file into a working folder.

RTC Library Installation

  1. Download the elpaso RTC Library from github. There are many others out there, but this one worked for me.
  2. Extract the .zip file into the /Energia/libraries/RTCLib folder.
  3. Restart Energia to make sure that the libraries are loaded. You can check if a library is set up, by clicking on Sketch->Import Library…->RTCLib, which will add the line #include <RTClib.h> to your sketch.

Sketch Creation

Copy and paste the following sketch into Energia. The code will show you the current time and a time 7 days and 30 seconds into the future to ensure that the math works.

#include <Wire.h>
#include <RTClib.h>

void setup () {

// following line sets the RTC to the date & time this sketch was compiled
//RTC.adjust(DateTime(__DATE__, __TIME__));

void loop () {
DateTime now =;
Serial.print(now.year(), DEC);
Serial.print(now.month(), DEC);
Serial.print(, DEC);
Serial.print(' ');
Serial.print(now.hour(), DEC);
Serial.print(now.minute(), DEC);
Serial.print(now.second(), DEC);
Serial.print(" since 2000 = ");
Serial.print("s = ");
Serial.print(now.get() / 86400L);
// calculate a date which is 7 days and 30 seconds into the future
DateTime future (now.get() + 7 * 86400L + 30);
Serial.print(" now + 7d + 30s: ");
Serial.print(future.year(), DEC);
Serial.print(future.month(), DEC);
Serial.print(, DEC);
Serial.print(' ');
Serial.print(future.hour(), DEC);
Serial.print(future.minute(), DEC);
Serial.print(future.second(), DEC);

Uploading Sketch

The first time you try to read data from the RTC (or after the battery has been removed for more than 3 seconds) you should see the date of 2000/01/01 and it will not change. This happens after evry reset. You must first set the date before it starts to work.

The line RTC.adjust() is currently commented out. This line sets the time of the RTC to the current computer time, so make sure that the computer time is correct. Once you run the code, you will see the time change every 3 seconds.

Important: Make sure to comment out the RTC.adjust() line and uploading the sketch before removing power to the RTC. Otherwise, the time will be reset every time the RTC gets power to whatever time the code was generated

The Serial Monitor output can be accessed by pressing [Ctrl]+[Shift]+[M] and should show something like this:


In this tutorial you were shown how to interface the DS1307 with the MSP430F5529 board.


Finding the IP of a headless single-board computer on your network


Anyone starting with single-board computers can save a lot of money/hassle in extra purchases, by connecting their Raspberry Pi / Beaglebone Black / Udoo to their network via an Ethernet cable. Remotely controlling the device in a headless configuration saves the hassle of connecting keyboard, mouse, computer screen and buying micro HDMI cables, powered hubs, etc.

One of the first problems that you run into on a first boot though is that the device is not set up with a static IP, thus forcing you to find the device on your network. This tutorial will show you three (of many) ways of finding the IP of the devices connected on your network (I will update this list as time goes on):

  1. Using your Router
  2. Using Fing – Network Tools
  3. Using the net view command

In this tutorial I have a Raspberry Pi (with Occidentalis) and an Udoo Quad (with udoobuntu) connected on the network.

1. Router Method

This method will require you to have access to your router. You can log into your router through a browser window.

  1. Open your browser
  2. Type in your router IP address into the address bar (the IP varies, but try: or or your default gateway-address, which sometimes works).
  3. You will be asked to login, which requires you to know the router login information. You can ask whoever is in charge of your network. If this is not an option, try one of the other methods.
  4. If you logged in successfully, there should be a section that talks about the status of the network and shows all the clients that are connected:

Note that the Udoo ( shows up as “Unknown”, but you can still see its IP and connect to it. This should only be troublesome if you have many “Unknown” systems on your network, which will mean that you will have to try and log into each. The Raspberry Pi ( shows up fully identified with the IP showing.

2. ‘Nmap’

You can download Nmap for Windows, Linux, and Mac here. Once installed you can either use the command line or the GUI. Here is the GUI output:

The Raspberry Pi MAC addresses start with: B8:27:EB. You can see Raspberry IP ( next to the manufacturer info (Raspberry Pi Foundation).

The udoo was also found (, but if you didn’t know that the manufacturer was Seco and if you had more devices on your network, you would have to search a bit.

3. Fing – Network Tools

In this step you will need Fing – Network Tools which is available for free from the Google Play store. It will work on any Android device and tell you information about your network. All you have to do is ensure that your Android device is connected to the same network as your Singleboard Computer and then press the “scan” button.
See following image for a sample output. (Tip: press power button + volume down for two seconds on Android devices to take a screenshot):

The program was able to identify both the udoobuntu ( and the raspberry pi ( with the appropriate IP addresses. Fing managed to find all other random network devices that make up a modern household. The program also has other useful features (I think) but I am only using it for IP identification thus far.

4. ‘Net View’ Command

I did not have any luck with this command on Windows 8.1, but someone mentioned it to me and who knows, it might work for you.

  1. Press the [Windows key] + [R] button
  2. In the dialog type cmd and press enter
  3. in the command prompt type net view and get the following output:

The command only found the personal computers that run windows on my network. The command did not find the Raspberry Pi or the UDOO nor any smart phones. It might work for you though. Give it a try.

Getting Started with Raspberry Pi and Occidentalis

Getting Started with Raspberry Pi and Occidentalis


This tutorial assumes that you are able to write a linux distribution onto an SD-card. See the following tutorial here:


Writing Linux images to SD card with Win32DiskImager
Write your Linux distribution onto an SD card


In this tutorial you will be shown how to setup the Raspberry Pi with Occidentalis by Adafruit. The version for this tutorial is v0.2 and can be downloaded here (900 MB .zip file).

  1. After you have downloaded and extracted the zip file, you will need to write the .img file onto a sufficiently large SD card (4GB minimum). To write the Linux image onto the SD Card, you will need a program like Win32 Disk Imager. See this tutorial for details.
  2. The next step is to plug the SD card into the Raspberry Pi and connect all the cables. There are two options: you can either use it as a computer or remotely connect to the Pi.
  3. Use the Raspberry Pi as a computer, you will need to connect a monitor, mouse, keyboard and a 5V power or USB cable. There have been issues reported with USB power issuer to mouse and keyboard, so you may need to connect these items through an external powered USB hub.
  4. Connect remotely to the Pi, all you need is a 5V power cable or a micro-USB cable and an Ethernet cable. The following will only apply if you want to connect via the network:
    1. To connect to the pi, you will need an ssh program like Putty. You will need to know the IP address of the Pi, which you can find if you have access to your Ethernet hub.
    2. An alternate method for Windows machines is to connect to raspberrypi.local rather than knowing the IP address. You may need ton install Bonjour Print Services to find it.
    3. Test to see if you can reach raspberrypi.local, by pinging it (type “ping raspberrypi.local” to see if you can find it on the network)
  5. Once you start the Raspberry Pi with the Occidentalis distribution, you will be prompted to a login. For Occidentalis the default:
    login is: pi
    password is: raspberry
    Once you have successfully logged in, you will see the following command prompt:
  6. Initially, when you write your Linux distribution image to the SD card, it will only be approximately 2.6GB, which is how much space you will have available regardless of what size SD card you used. You can display how much space you have available by typing in df -h. The “Avail” column will show you how much space you have available in the various partitions.
    To make linux aware of the additional space, you need to run the command: sudo raspi-config in the commands prompt and you should get the following menu to appear:

    When you select “Expand Filesystem” the rest of your SD card will become available to you. The select “Finish” and the program will ask you for a reboot. Select “Yes”. If you selected “No”, you can reboot your Raspberry Pi at any time, by typing sudo reboot into the command line.
    After the reboot, use df -h to check if the procedure has been successful. You should see additional gigabytes of free space, depending on your SD card size.
  7. Your next step will be to update all of the software on your Raspberry Pi. The updating occurs in two steps and requires a working internet connection. You can check your internet connection with ping Your RPi should then start pinging google and tell you how long it too to get a response. You can stop pinging by pressing the [Ctrl] + [C] keys, which will interrupt the process. You can interrupt many Linux processes with that key combination.
    The first step in updating your Software is to synchronize your list of installed software and their versions, via sudo apt-get update. After this procedure you will need to actually upgrade your software using: sudo apt-get upgrade. A prompt will ask you if you want to continue, to which you should type y if you do and n if you don’t want to update your software.
Writing Linux images to SD card with Win32DiskImager

Writing Linux images to SD card with Win32DiskImager

In this tutorial you will be shown how to properly write a Linux distribution onto an SD card. The Software for this tutorial will be the Win32DiskImager. The Linux distribution used will be Occidentalis by Adafruit for the Raspberry Pi, however any linux distribution can be written onto an SD card in this manner. The version for this tutorial is v0.2 and can be downloaded here (900 MB .zip file).

  1. Get a Linux distribution for your system, whether it is the Beaglebine Black or the Raspberry Pi. Your linux ditribution image should be a single file with a .img extension.
  2. To write the Linux image onto the SD Card, you will need a program like Win32 Disk Imager.
  3. Run Win32DiskImager via Win32DiskImager.exe and you should see the following screen:
  4. Insert an SD card into your computer. It should have sufficient size for the image (i.e. a 2.7 GB Linux image will require a 4GB SD card).
  5. Click on the file folder icon , navigate to the folder with your image file, select the image file with .IMG extension and click Open.
  6. Next select the arrow in the device dialogue

    and select the appropriate drive letter for your SD card. Warning: make sure you select the proper drive letter, everything on that drive will be overwritten.
  7. Once you have selected the proper image file and the proper drive letter, you are ready to write the image file onto your SD. Your dialogue should look similar to. Select Write to write the image to your SD card. You will be asked for confirmation and just select Yes or Continue.
  8. The actual writing might take a few minutes. If everything was successful, you will see:

After the process is done you are ready to plug in the SD card into your single-board computer and ready to get started.

Setting up Eclipse with STM32 Discovery Boards + BlinkLED

Setting up Eclipse with STM32 Discovery Boards + BlinkLED


This tutorial shows you how to set up your STM32 Discovery Board in a free Eclipse programming environment. The write-up is partially based on a Tutorial for STM32F4-boards and adapted it for the STM32L152 board. I am setting this up on Windows 8 and the board that I will be using is the STM32L-Discovery board.

Where to Buy

The STM32 boards can be purchased at Amazon:

  • Amazon US Link


    Installing Prerequisite Software

    1. First download and install the Java JRE (Java Runtime Environment) which can be downloaded here: . Jave is needed for running Eclipse.
    2. The next step is to download the Eclipse Helios IDE for C and C++, which can be downloaded at: . First select “Eclipse IDE for C/C++ Developers” in the middle column and on the next page select your Windows version (in my case Windows x64) from the “Download Links”. The download is a .zip file, which I extracted to “C:\Eclipse\” . The Eclipse Software is now installed and you can start it via eclipse.exe
    3. When you start eclipse.exe you will be asked for a workspace, which will contain all of you projects. I selected the folder “C:\stm32-discovery-projects\workspace”. The “C:\stm32-discovery-projects” will be called the project folder throughout the tutorial.

    4. This step will have you download the Software and drivers that are specific to the STM32L Discovery Board. If you have a STM32F or similar you should search the website for drivers for your device. Go to and under “Sample and Buy” click the red download button next to STSW-STM32072. Download and extract and install the STM32L1 Discovery Firmware Pack. Make note of the installation folder where you download it.

      1. Navigate to the installation folder (my default: C:\Program Files (x86)\STMicroelectronics\STM32L1_Discovery_Firmware_Pack_V1.0.3) and copy the three folders in the “Libraries” Directory to C:\stm32-discovery-projects\ The three folders to be copied are:
        • CMSIS
        • STM32L1xx_StdPeriph_Driver
        • STMTouch_Driver (may not be needed?)
      2. Go to and download the STM32L1xx Standard Peripherals Library, which contains 80 code examples on the use of STM32L1 evaluation boards. We will need a folder that contains drivers specific to the evaluation board. Download the STSW-STM32072 file at the bottom of the page and unzip it.
      3. From the Utilities folder of the unzipped file copy STM32_EVAL into your project directory.
      4. Your project folder should look like this now:

    5. Download and install Code Sourcery Lite ARM GNU Tool chain, which is an embedded C/C++ development environment on ARM and other architectures. We will be using the IA32 Windows installer from this link.
      1. Install the file with the default options by clicking next. Select the “Typical” installation at this dialog.

      2. Navigate to the installation directory for CodeSourcey (my default “C:\Program Files (x86)\CodeSourcery\Sourcery G++ Lite\bin”) and copy “cs-rm.exe” and paste it in the same folder. You will get a file called “cs-rm – Copy.exe”. Rename it to “rm.exe”
      3. Note: You may need to restart Windows after this step to update the PATH variable. Press [Windows Key] + [r] and type cmd to bring up a command prompt. Type in path and press [enter] to view the PATH variable. The CodeSourcery directory should be in there after installation. If it is not, try rebooting your computer.
    6. Now start eclipse with eclipse.exe and you will see the following screen:

      1. Select Help->Install New Software… and then click the blue link “Available Software Sites” and then type “cdt” and click the checkmark to get:

      2. Click “OK” and the “Work with:” should have changed to : If it did not, enter the link manually.
      3. Click the arrow by “CDT Optional Features” and select the check-mark next to “C/C++ Cross Compiler Support” to get:

      4. Click next and the download should begin. After the installation click next and then check “I accept the license agreement” and then Finish, which should start the installation. You will be prompted to restart Eclipse, so select Restart Now.

    Creating a Template File

    1. The template file will contain all the necessary information and can be re-used for each of the STM32 based projects. In Eclipse, select File->New->C++ Project.
      1. In the “C++ Project”-window enter “Template” for the project name and select “Cross-Compile Project” and the Cross GCC. Your dialog should look like:

      2. Press next and enter the Command Prefix arm-none-eabi- exactly as it appears and point the command path to the CodeSourcery \bin directory as shown in the following dialog:

      3. Select Finish and you will be returned to the Eclipse window after some installation. Press the “Workbench”-button to go to the workbench:

        You will then be taken to the Eclipse C++ development environment:

      4. Right-click on the Template folder in the “Project Explorer” and select Properties.
      5. The “Properties for Template”-window should now open. In the sidebar expand C/C++ Build and select Tool Chain Editor to get the following dialog:

        Press the Select Tools… button to edit the tools that will be used for compile and link the projects.
      6. In the “Select Tools” window select GCC Assembler on the left and click Add Tool–> and the press OK

      7. You must also select the proper builder in the “ToolChain Editor” window. Select CDT Internal Builder from the drop down menu (red box in image above)
      8. Now we need to change the properties of the GCC Assembler that has been added. You should now be in the “Properties for Template” window. In the sidebar select Settings under C/C++ Build and scroll down until you select GCC Assembler the dialog should look something like that:

      9. Change the Command entry to arm-none-eabi-as (see red box in above image). This file corresponds to a file in the CodeSourcery /bin/ directory.
      10. Click on General under the GCC Assembler and add the following flag: -mthumb -mcpu=cortex-m3

      11. In the same way, select GCC Assembler->Miscallaneous add the flag: -c -mthumb -mcpu=cortex-m3 -mfix-cortex-m3-ldrd instead of the default -c -fmessage-length=0
      12. Then select Cross G++ Compiler->Miscallaneous add the flag: -c -mthumb -mcpu=cortex-m3 -mfix-cortex-m3-ldrd instead of -c -fmessage-length=0
      13. Now select Cross G++ Linker->Miscallaneous add the flag: -T “${ProjDirPath}\startup_src\stm32_flash.ld” -mthumb -mcpu=cortex-m3 -mfix-cortex-m3-ldrd -Wl, -Wl,-cref -Wl,–gc-sections
      14. For a line-by-line breakdown of each entry, take a look at the page from the following tutorial Press OK to close the Template properties.
    2. Create two folders in your Template project. Right click in the Project Explorer, select New->Folder and create two folders, src for your porgamming files and startup_src for initialization files related to the board.

      1. Copy the file startup_stm32l1xx_md.s from C:\stm32-discovery-projects\CMSIS\Device\ST\STM32L1xx\Source\Templates\TrueSTUDIO to the startup_src folder. You can do this by dragging and dropping it into the folder in eclipse. You should also rename the file to startup_stm32l1xx_md.S (note: capital S), because of potential problems with eclipse file extensions.
      2. Now copy the file stm32_flash.ld from the C:\Program Files (x86)\STMicroelectronics\STM32L1_Discovery_Firmware_Pack_V1.0.3\Projects\AN3964-Temperature_sensor\TrueSTUDIO\STM32L152RB(STM32L-Discovery) folder into the startup_src directory.
    3. In this step you will set up the src folder for the libraries.
      1. Copy the file lcd_log_conf_template.h from the project folder STM32_EVAL/Common/ into the src folder and rename it to lcd_log_conf.h.
        1. Edit the file lcd_log_conf.h line 38 to say: #include “stm32l152_eval_lcd.h
      2. Navigate to the folder: C:\Program Files (x86)\STMicroelectronics\STM32L1_Discovery_Firmware_Pack_V1.0.3\Projects\AN3964-Temperature_sensor\inc and copy stm32l1xx_conf.h and stm32l1xx_it.h into the src folder.
      3. Navigate to the folder: C:\Program Files (x86)\STMicroelectronics\STM32L1_Discovery_Firmware_Pack_V1.0.3\Projects\AN3964-Temperature_sensor\src and copy system_stm32l1xx.c and stm32l1xx_it.c into the src folder.
      4. Download the blink LED example main.c file from this link and place it into the src directory.
      5. Now your src folder should contain these files:

    4. In this step you will add the libraries and source files to link and compile the libraries. Right click on Template, select Properties. Then go to C/C++ General->Path and Symbols in the sidebar. Select the Source Location tab.
      1. Click Add Folder and add the src and the startup_src directories. It should look like:

      2. Select Link folder and make sure to check the “Link to folder in file system”.

        Note: that I have been told that there are potential issues with errors at this step. If you get a The folder ‘src’ already exists-error, then change the name in Folder name to something else, as shown in the above image. Select Browse and navigate to the following folders:
      • C:\stm32-discovery-projects\CMSIS\Include
      • C:\stm32-discovery-projects\STM32L1xx_StdPeriph_Driver\src
      • C:\stm32-discovery-projects\STM32_EVAL\STM32L152_EVAL
      1. Select the Includes-tab and GNU C. Click the Add… button and check the “Is a workspace path” and add the following path:

        The ${ProjName} variable will change its value so that you can easily copy the template elsewhere.
      2. Now also add the following folders (not all of them may be necessary?):
      • C:/stm32-discovery-projects/CMSIS/Device/ST/STM32L1xx/Include
      • C:/stm32-discovery-projects/CMSIS/Include
      • C:/stm32-discovery-projects/STM32L1xx_StdPeriph_Driver/inc
      • C:/stm32-discovery-projects/STM32_EVAL/STM32L152_EVAL
      • C:/stm32-discovery-projects/STM32_EVAL/Common
      1. Your include tab should look like:

    5. Add some Environment Variable next. In the “Template Property”-window go to C/C++ Build->Settings->Cross GCC Compiler->Symbols and add the following defined variables by clicking Add next to the defined variables:
      • USE_STM32L152_EVAL
    6. In the “Template Property”-window go to C/C++ Build->Settings->Build Steps and add the following commands in the Post-build steps Command exactly as it appears arm-none-eabi-objcopy -S -O binary “${ProjName}” “${ProjName}.bin”
      This command should create a binary file, which can be uploaded via the STLink Utility.
      1. Close the “Template Property” window by pressing OK. When prompted click Yes to rebuild.
    7. In the next steps you will have to edit the stm32l152_eval.h file from the stm32-discovery-projects\STM32_EVAL\STM32L152_EVAL directory to select the proper LED pins. In this tutorial the pins will be for the STM32L152 board. You can find out the proper pins from the manual (page 20).
    8. Open stm32l152_eval.h and scroll down to line 121, which starts with #define LEDn 4. The STM32 board have 4 pin ports which are designated A,B,C,D and each port has 15 pins or so. The user LEDs 3 and 4 on the STM32L152 are connected to PB7 (port B, pin 7) and PB6 (port B, pin 6), respectively.
      1. Change #define LED3_PIN to say GPIO_Pin_7
      2. Change #define LED3_GPIO_PORT to say GPIOB
      3. Change #define LED3_GPIO_CLK to say ‘RCC_AHBPeriph_GPIOB
      4. Do the same thing for the LED4_ entries, except change the pin to GPIO_Pin_6
      5. Your stm32l152_eval.h LED entries should look like:

      6. Note: The used-buttons and any other definitions in stm32l152_eval.h may not be properly set up for your board. The manual will tell you which pins, the buttons and other peripherals are connected to. If the pin defines are wrong, your program may not work.

    Build and Upload

    1. Download the STLink Utility from
      Install it with the default settings. This program will be used to communicate with the board over the USB cable.
    2. From the Eclipse main menubar click Run->External Tools->External Tools Configurations
      1. Select Program from the sidebar and click the New button. In the next dialog click Browse to navigate to the STM32STLinkUtility.exe on your computer. Give the entry a meaningful name (like “STLink Utility”) and then click Apply

      2. Click on the Build tab and deselect Build before launch to stop the project being rebuilt every time STLink utility is launched
      3. You can test if it was properly linked by clicking Run, which should launch STLink Utility. Otherwise click Close
    3. Right click the Template folder and click Build Project. If the build was successful, the Console output should look something like:

      arm-none-eabi-objcopy -S -O binary Template Template.bin
      Build complete for project Template
    4. Build errors could fall into three categories:
      1. Problems with the executable paths: these problems stem from incorrectly entered compile/build options or if there are problems with reaching the .exe files in the CodeSourcery directory.
      2. Problems with include/source paths: The console output will usually tell you which ‘.h file cannot be reached and which should be added in the include directories. A little bit of tinkering with the folders can fix these errors.
      3. Problems with Functions not Found: these problems could stem from the .c files not being included as source. Or from incorrectly defined definitions in the Cross GCC Compiler->Symbols area.
    5. Once the files have been correctly built, run the STLink Utility from Run->StLink Utility

    6. The following STLink Interface will open:

    7. Connect your STMDiscovery board through via the USB cable.
    8. Click File->Open File…” and navigate to the workspace/Template/Debug folder and open Template.bin. If the file is not there, then the project was not built correctly, or there is a problem set the Post-build steps Command”’.
    9. Once the file is loaded and with your device connected over the USB, click the Program verify button:

    10. In the next dialog click the start button to start the upload. Note: Any previous programs on the board will be overwritten!

    11. Your blue (PB6) and green (PB7) LEDs should now start blinking. First the green one turns on, then the blue and green, then both off.
    12. If you want to upload the demo program that came with the original board (to verify that your board works properly), select the STM32L-Discovery.hex file from C:\Program Files (x86)\STMicroelectronics\STM32L1_Discovery_Firmware_Pack_V1.0.3\Projects\AN3413-Current_consumption_touch_sensing\Binary when uploading in ST Link. This will verify if you are using the ST Link Software correctly and can help you with troubleshooting.


    This tutorial showed you how to install and setup an Eclipse environment with your STM32F1xx board and how to setup and create a blink LED program. If you find any mistakes or have feedback, please let me know at edisondev[dot]net[at]gmail[dot]com.

    Potential Problems

    • Internal Builder: Cannot run program “arm-none-eabi-gcc” (in directory “C:\stm32-discovery-projects\workspace\Template\Debug”): Create Process error=2, The system cannot find the file specified

    Solution: Under Properties->Environmnet check your path variables that it points to the proper CodeSourcery folder