Skip to main content

STM32F4 Discovery Tutorial 1 Using NETMF - Setting Up the Environment

STM32F4








STM32F4 Discovery








I received my STM32F4 Discovery board few days ago. During these days I am searching for a good compiler for the STM32 which is free or provide a better code sized free version. I am already working in .Net environment using C#, and I it is pretty good. In Google search I saw STM32F4 programming using  .Net, the below link.

We are using a .net port for STM32F4, it is .Net micro framework. 
I am using Visual Studio Ultimate 2010 (Compatibility of others is not known).
I hope you have an STM32F4 Discovery Board.
Necessary Tools
1.      STM32 ST-LINK Utility            Get It ->
2.      USB Micro and USB Mini cable.
3.      .NET MicroFramework SDK  Get It ->  
4.      Download these files (Evaluation purpose only driver)
                                                              i.      If you are not a member, join
Install all the softwares.
Step 1
            Connect Board to PC using Micro USB
The board will get power and power LED & COM LED will be on, if your board is fresh the demo program will run blinking LEDs.
The computer will look for drivers, ( I installed the drivers included in some software already, so i didn’t seen it)
Install STM32 ST-LINK Utility   you downloaded. The driver will be automatically installed.
Step 2
You need to Erase the program and Configs in the controller.
For these, open the STLink Utility from where you installed it.
            Let’s first erase chip.
From Target select Erase chip ------Target > Erase Chip click Select ALL apply
After doing these you need to erase sector
For these select erase sector from target
Target >Erase sector

After these you have to load bootloader to the Discovery board.
In the stm32f4 Files.zip you will see some files: Open Tinybooter.hex in the STLink Utility
From Targets >Program
After it’s done,
Reset the board.



Step 3


After you have reset your board now plug-in the USB Micro USB and connect to PC(the other USB). Most of the smart phone cables should be Micro USB.  Once you connected the Micro USB, windows will start searching for driver and will fail. Now we got to install the driver we downloaded from the zip file. “STM32_WinUSB_drivers_(for_evaluation_purposes_only)  Folder. From device manager find the USB device then (May be its name is STM32F4 Test or unrecognized)
Double click on it, from DRIVER  tab  click update diver and browse it to the folder mentioned above and update it.

 Doing this you can see a device as shown in pic. Control Panel> Devices and printers
   




STM32F4 Discovery Programming






Step 4

Find the application Named MFDeploy.exe
Launch MFDeploy.exe (you should be able to find it in C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Tools\MFDeploy.exe) which you should have got when you installed the SDK. To make sure MFDeploy can see the board do as shown below.














If you see the Ping the everything is good till this point. Now download the other 2 .hex ER_Config.hex and ER_Flash.hex files extracted from stm32f4 Files.zip file to the board using the MFDeploy as shown below one by one.   (the Combo-box, you need to change it to USB, the STM Discovey board will be shown in right of it.)



Reset the board.






Step 5
Open Visual C# Express/ Visual Studio  Select the project type as given below









Now we need to change the properties, so that the Visual Express/Studio will deploy to the hardware. So change the project properties as shown below

 

  






Add Reference  Right Click On MFTest in Solution Explorer>Add Reference> Select the following sown in the figure>OK





 





Code


using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
namespace MFtest
{
public class Program
{
public static void Main()
{
OutputPort led1 = new OutputPort(Microsoft.SPOT.Hardware.STM32.Pins.GPIO_PIN_D_15, false); //LED Pins of Discovery Board
OutputPort led2 = new OutputPort(Microsoft.SPOT.Hardware.STM32.Pins.GPIO_PIN_D_14, false);
OutputPort led3 = new OutputPort(Microsoft.SPOT.Hardware.STM32.Pins.GPIO_PIN_D_13, false);
OutputPort led4 = new OutputPort(Microsoft.SPOT.Hardware.STM32.Pins.GPIO_PIN_D_12, false);






while (true)
{
led1.Write(true);
Thread.Sleep(500);
led1.Write(false);
Thread.Sleep(500);
led2.Write(true);
Thread.Sleep(500);
led2.Write(false);
Thread.Sleep(500);
led3.Write(true);
Thread.Sleep(500);
led3.Write(false);
Thread.Sleep(500);
led4.Write(true);
Thread.Sleep(500);
led4.Write(false);
Thread.Sleep(500);

}
}
}
}







ADD files HardwareProvider.cs and CPU.cs to project (step is same as adding reference right click> select Add existing Item)  from the zip file downloaded including the drivers.

Start debugging your code will be written to your Discovery, you can see the status at the bottom. Reset your board.

You Are Successfully Done!!!!!!!!!

Download Full Project Files










STM32F4 Discovery Board


Comments

  1. Hello friends,
    Some files are uploaded in our facebook group. If you have any trouble in downloading the file please comment here. You need to be a member in the group to download the files.

    ReplyDelete
    Replies
    1. Stm32F4 Discovery Tutorial 1 Using Netmf - Setting Up The Environment >>>>> Download Now

      >>>>> Download Full

      Stm32F4 Discovery Tutorial 1 Using Netmf - Setting Up The Environment >>>>> Download LINK

      >>>>> Download Now

      Stm32F4 Discovery Tutorial 1 Using Netmf - Setting Up The Environment >>>>> Download Full

      >>>>> Download LINK en

      Delete
  2. Discovery is great. I run couple of shields on this like: SD Card, RTC, GPS, GSM SIM900, LCD with keypad, OneWire => iButton Reader.

    It is unfortunate that there are no people who would like to be proud of their actions of this module. Forum on codeplex looks inactive. Oberon also says nothing. New version port on netfm 4.3 would be great.

    Regards
    Darek

    ReplyDelete
  3. Hello Darek,
    Thanks for your comment and interest. I have done the Smart Home Project on Discovery. I wish to do it as open source, but i didnt found required resources. So i forced to do it using Mikroc. The support from Mikroe team and forum is great.

    I would like to transform the project to open source. It would be nice if you share some resources on this. If you have a facebook ID, join our group. You can find lot of Geeks there.

    ReplyDelete
  4. Hello Vishal,
    Every thing went well except at the very end, It could not locate Microsoft.SPOT.Hardware.STM32
    It finds Microsoft.SPOT.Hardware -- I am somehow missing this driver, and looked at your tutorial 4 times but I don't see where you loaded it.
    Thank you for your help.
    Best regards,
    Norm

    ReplyDelete
  5. @Marvin Did you installed .Net Micro framework?

    ReplyDelete
  6. http://msdn.microsoft.com/en-us/library/cc532289.aspx

    ReplyDelete
  7. Thank you Vishal,
    I will reload the .NET Framework and try again.
    Best regards,
    Marvin

    ReplyDelete
  8. Thanks for your information. And the steps given for setting up the environment is really useful. In STM32 F4 series, there are five product lines and this results in the symbiosis of real time control capabilities of Micro controller unit. They are,

    STM32F401
    STM32F405/415
    STM32F407/417
    STM32F427/437
    STM32F429/439
    Chennai final year projects

    ReplyDelete
  9. It is a great work! But wouldn't it be better if ST-Link (mini USB) is used for .C# code transfer and debug so that micro usb is spare and can be used as USB device/host?
    Best Regards
    Pradeep Maskeri

    ReplyDelete
  10. @maskeri
    USB can be used as per requirement after uploading code.

    ReplyDelete
  11. Nice idea ! Can I do it using vb.net?

    ReplyDelete
  12. Stm32F4 Discovery Tutorial 1 Using Netmf - Setting Up The Environment >>>>> Download Now

    >>>>> Download Full

    Stm32F4 Discovery Tutorial 1 Using Netmf - Setting Up The Environment >>>>> Download LINK

    >>>>> Download Now

    Stm32F4 Discovery Tutorial 1 Using Netmf - Setting Up The Environment >>>>> Download Full

    >>>>> Download LINK K6

    ReplyDelete

Post a Comment

Popular posts from this blog

PIC 16F877A Microcontroller Based Electronic Lock 16x2LCD 4x3 Keypad

 Circuit Diagram Security is a prime concern in our day-today life. Everyone wants to be as much secure as possible. An access control for doors forms a vital link in a security chain. The microcontroller based digital lock for Doors is an access control system that allows only authorized persons to access a restricted area. An electronic lock or digital lock is a device which has an electronic control assembly attached to it. They are provided with an access control system. This system allows the user to unlock the device with a password. The password is entered by making use of a keypad. The user can also set his password to ensure better protection. The major components include a Keypad, LCD and the controller PIC16F877A. This article describes the making of an electronic code lock using the 16F877A microcontroller. The system is fully controlled by the 8 bit microcontroller 16F877A which has a 8Kbytes of ROM for the program memory. The password is stored in...

Electronic Voting Machine Using 8051 Microcontroller (AT89C51)

  Circuit Electronic voting machine has now replaced the traditional mechanism of voting due to several advantages like security, automatic counting etc. This project presents a way to develop an electronic voting machine which displays the count of votes on a 16x2 LCD interface. A user can get his/her vote register through a set of switches (one for each candidate). After every cast of vote, the subsequent count can be seen on LCD. The circuit uses AT89C51 microcontroller and the code for the project has been written in C. This LCD based electronic voting machine is designed for four candidates. The input part consists of a set of six tactile switches. The switches and 16x2 LCD are interfaced to microcontroller AT89C51 for various operations and displays. The provision of casting votes for the candidates has been provided through four of these switches. These switches are made active high and connected to pins 2-5 (P1^1 – P1^4) of the controller. The remaining ...

PC Based Digital Voltmeter Using PIC 16F877A

Voltmeter C# .Net PIC, Arduino, AVR This is a simple voltmeter which measures 0-5V at a precision of 4.8 mV. This is a simple design using inbuilt ADC of PIC 16F877A. PIC 16F877A have 8 channel 10bit ADC.   This is a computer interfaced project. Measured voltage is output in serial interface software in computer. There is a serial interface circuit (MAX232) is necessary for interfacing with computer, which is not included in the circuit. Please check       PIC Serial Communication Tutorial (UART)   for the circuit and more details. Using one of the most popular 8 bit PIC 16f877A, for instance, reading the datasheet , we'll find that the ADC modules (10 bit) are controlled by four different registers. The first two, ADCON0 and ADCON1 , are used to set and start the ADC module. When high level language is used, the programmer doesn't need to care a lot of the register connected to the results because they are normally stored in...