NETMF 4.2 Deployment Tutorial for the STM32F4DISCOVERY, STEP BY STEP

Oct 22, 2012 at 11:43 AM

Hi All,

After many searches and clicked URLs, I finally succeeded in installing NETMF4.2 QFE2 on my STM32F4DISCOVERY board. To help you to do that more quickly than I did, here's a step by step tutorial that made me finally run my first Microframework console App successfully..

I hope this will help !

STEP 1 : Make you in conditions to success

  1. Create a Directory on your computer where to store all you need,
  2. From CodePlex : http://netmf4stm32.codeplex.com/, download the following :
    1. the binary image stm32fdiscovery.zip (then unzip it in a sub directory "binaries"),
    2. the st-link utility (then unzip it in a sub directory "utilities"),
    3. the STM32_WinUSB_drivers_(for_evaluation_purposes_only).zip driver (then unzip it in a subdirectory "Test driver"),
  3. From ST web site http://www.st.com/internet/evalboard/product/251168.jsp, download the following :
    1. The ST-LINK V2 Driver for Windows 7, vista and XP in the SW DRIVERS part (then unzip in "ST driver"),
    2. The ST-Link V2 last Firmware upgrade (then unzip in Utilities),
  4. From Microsoft Codeplex, download NETMF 4.2 SDF QFE2, and if you need, also the Porting Kit,

STEP 2 : Make your board compliant to MFDeploy !

  1. Install the NETMF 4.2 QFE2 SDK and PK on your computer,
  2. Install ST-LINKV2 Utility and last USB Driver,
  3. Plug your STM32F4D board, using the mini USB plug, to the computer,
  4. After a while, STM32 STLink peripheral should appear. If it has an exclamation on the icon, retry to update the driver, and check you effectively installed the V2 USB Driver !
  5. When all is ok with the USB driver, launch ST-LINKV2, and click on "CONNECT DEVICE". It will then show the memory map for the board,
  6. Start by a global Erase of the Chip, and also the Sectors (see Target Menu). It will erase all the default programs that you received in the package, and then do a Blank Check for sure.
  7. Using the File->Open File menu, search for the tinybooter.hex file provided on codeplex and stored in the binaries sub directory. When opened, improve a "Program and Verify" task in the Target menu. This will write the tinybooter to the board flash, normally starting at the address 0x08000000,
  8. When done, reboot the board by extracting the USB powered cord, and putting it again after a while.

A this step, your board has a valid tinybooter that is enumerated and loaded at boot time. Let's go the the pure NETMF part of the thing !

STEP 3 : Checking MFDeploy part and first Application !

  1. After the board is up, plug a second USB cable in the Micro USB this time !
  2. After a while, a new USB Peripheral is installed named STM32 TEST, and should appear with and exclamation point meaning you must upgrade the driver using the STM32 URSB Driver for evaluation purpose. Do a manual upgrade using the driver files in TEST Driver. After the upgrade, the exclamaion shoud left,
  3. At this step, both STM32 STLink and STM32 TEST should be clean. Launch MFDeploy and observer that selecting USB as the communication way, you can see the STM32 port. If not, you did something wrong regarding to this procedure ! If yes, you can now Browse for the 2 other files needed to make your board complian with Microframework, that are ER_CONFIG and ER_FLASH. You can select them in any order, it does not chang anything.
  4. When selected, click on "Deploy" to write them on the board. When done, reboot again the board and plug both USB cables. Now the mini USB is only used for power, and micro USB has the Program/Debug interface for Visual Studio.
  5. Open Visual Studio, and create a new project from MicrosoFramework Console Application. In the target, select the STM32 TEST, and launch your Apps in step by step mode. You'll see that VS reboot the board after copying the program on it, and the start debugging.....

Here's ! you can now play your own !

 

 

 

Oct 23, 2012 at 3:33 AM

Thanks LouisCPro. I made a blog of your steps with screen shot.

 

--> http://singularengineer.wordpress.com/2012/10/23/stm32f4-discovery-board-running-net-microframework/

 

Thanks a lot!!!!!!!!!!!!!!!!!!

 

Oct 23, 2012 at 1:33 PM
singularengineer wrote:

Thanks LouisCPro. I made a blog of your steps with screen shot.

 

--> http://singularengineer.wordpress.com/2012/10/23/stm32f4-discovery-board-running-net-microframework/

 

Thanks a lot!!!!!!!!!!!!!!!!!!

 


A link back to this page for source will be appreciated !

Oct 24, 2012 at 2:01 AM
Edited Oct 24, 2012 at 2:02 AM

That was so bad of me for not doing it. I fixed it. I acknowledge this page and your post as the source of the work. I'll make sure that sources are acknlowdged properly in the upcoming posts. Sorry and thanks.

Oct 24, 2012 at 8:26 AM
singularengineer wrote:

That was so bad of me for not doing it. I fixed it. I acknowledge this page and your post as the source of the work. I'll make sure that sources are acknlowdged properly in the upcoming posts. Sorry and thanks.


No problem on that ! It was a great job to take some time to add the screenshots to the procedure !

Jun 27, 2013 at 11:14 PM
Hi,

Is there anyone about who can help me with this. I have followed the instructions above, and those of singularengineer, and I have everything up an running.

My problem is that I can only access the PORT A pins. I want to access the PORT D pins as the 4 LEDs on the F4 discovery are on Port D[12:15].

So I don't know what to do to make these pins accessible.

Sorry if that's stupid but I'm a hardware person and haven't done any coding in about 10 years.

Thanks, Cranford.
Jun 28, 2013 at 9:44 AM
@Cranford68,

To use all the Pins, you need the CPU.cs and HardwaProvider.cs that contains all the Pins enumerations, ADC channels, Serials, and so on ....

Give me you email and I will send them to you.....
Jun 28, 2013 at 2:06 PM
LouisCPro wrote:
@Cranford68,

To use all the Pins, you need the CPU.cs and HardwaProvider.cs that contains all the Pins enumerations, ADC channels, Serials, and so on ....

Give me you email and I will send them to you.....
Hi Louis, thanks for that. I found the two files you mentioned in the PK at C:\MicroFrameworkPK_v4_2\DeviceCode\Targets\Native\STM32\ManagedCode\Hardware so now I'm up and running with a flashing LED.

So now I'm going to play around to get used to the framework and C#. Next step will be to get the ADCs working as I want to measure some temperatures.

Thanks again. Cranford.
Jun 28, 2013 at 2:48 PM
Yes Effectively they are there !

I encourage you to go on GHI Electronics Web Site which contains many tutorials and code samples that can be used Under NETMF with an type of CPU that comply to NETMF until v4.1. Create an account on the Forum and Ask when you need.....
Jul 3, 2013 at 4:28 PM
Hi LouisCPro!

I have a board STM32F4DISCOVERY, I followed the procedure, but I can not install the MicroFramework Porting Kit 4.2

I have downloaded the porting kit 4.2 from the following link: Porting Kit 4.2 (RTM QFE2)

but during the installation I have a problem with the following file:
"MFPK2.cab" that it can not find.


Not being able to install the PK, I took the file CPU.cs and HardwareProvider.cs, I have included these in my project to use all of the pins.

include files is the correct way?

Another question, can I use the new SDK version 4.3 and the Porting Kit 4.3 with the board STM32F4DISCOVERY?


Thanks for your Deployment Tutorial, very very good! :)
Jul 3, 2013 at 4:46 PM
@Epta,

Thanks !

Regarding your questions :

The PK is only there to enable to get the 2 files that you mention, so If you succeeed in getting them right in your project, you're OK !

Regarding to the NETMF4.3, It is not released yet for the STM32 (see Codeplex link on my first post) so that the answer would be no ! Now considering using NETMF4.3 is only interesting if some implemntations you're requiring are not in the 4.2....Instead of that, 4.2 has been improved for long and is very stable, that is maybe the case for the 4.3....

If you really want to be sure on that, just ask Zach on Codeplex : https://netmf.codeplex.com/releases/view/81000

Regards,
Jul 17, 2013 at 9:08 PM
@LouisCPro,

Thanks for your reply!
Dec 21, 2013 at 11:06 PM
3.From ST web site http://www.st.com/internet/evalboard/product/251168.jsp, download the following :
  1.The ST-LINK V2 Driver for Windows 7, vista and XP in the SW DRIVERS part (then unzip in "ST driver"), 
  2.The ST-Link V2 last Firmware upgrade (then unzip in Utilities), 
I tried to download these files and ended up at a broken link. Is there another way to get them?
Dec 22, 2013 at 6:24 PM
Hi eo7942,

I've just tried and the link is OK for me.....Try again...
Dec 31, 2013 at 3:08 AM
LouisCPro wrote:
Hi eo7942,

I've just tried and the link is OK for me.....Try again...
It worked for me the next time I tried it. Thanks.
Dec 31, 2013 at 3:26 AM
Do you have any ideas on how I can get my STM32FDiscovery set back to the original settings?

I was not able to fully make this work in C#, and I'm not sure I want to use a method that isn't well documented (I'm not sure yet). So, I tried to go back to a previous method, using VisualGDB. It had worked before I tried the approach in this blog. Afterwards it didn't.

This is the answer I got from VisualGDB support regarding a log I capture from OpenOCD debug mode:

"Based on the following line at the end of the log, the STLink device is in mode STLINK_DEV_DFU_MODE (device firmware upgrade)
Debut: 161 631 stlink_usb.c:601 stlink_usb_init_mod() : MODE: 0x00"

"Normally the device is in mode 0x02 (STLINK_DCV_DEBUG_MODE). Then OpenOCD changes the mode to 0x01 and back to 0x02. In your log it changes the mode to 0x01, but never manages to change to 0x02. That fact that it starts in device firmware upgrade mode could be related."

I've tried several things with STLink Utility, but I just get a message that no target is connected.

Any leads I could get would be greatly appreciated.
Jan 2, 2014 at 7:51 AM
Hi eo7942,

If ST LINK Utility does not recognize the Module, and as GDB said, you're in DFU Mode. Try to use DFUSE Tool to see if it targets the module correctly, and have a look at this documentation to upgrade your firmware :

http://www.st.com/st-web-ui/static/active/en/resource/technical/document/application_note/DM00039672.pdf

and

http://www.st.com/st-web-ui/static/active/en/resource/technical/document/user_manual/DM00037368.pdf (page 9 and over...)

In DFU MOde, the use of an USB Device containing the software is preferable....