cancel
Showing results for 
Search instead for 
Did you mean: 

How to programming a STM32 microcontroller with C#

talg1996
Associate

I want to make a GUI with C# that I could choose the STM32 microcontroller and the xxx.elf file and programming it without using STM32CubeProgrammer with USB .

With the STM32CubeProgrammer it is look like this:

talg1996_0-1708601253567.png

 

talg1996_0-1708601024348.png

What to look for? where should I begin?

I saw that there is an API for STM32CubeProgrammer on C++. is there an option to call C++ program to C#?

 

2 REPLIES 2
TDK
Guru

Not much out there on using C# on a microcontroller. It is not common. See here for the only promising thing I saw. No affiliation, seems fine.

https://www.nanoframework.net/

Fairly sure you can call C++ libraries from C#.

> programming it without using STM32CubeProgrammer with USB

Doesn't calling the STM32CubeProgrammer API come with the same drawbacks as using the tool itself?

If you feel a post has answered your question, please click "Accept as Solution".
Pavel A.
Evangelist III

Yes you can use that API. But it is in C++ with dependency on Qt runtime libraries, and it hauls a lot of data files with it. If this is fine for you, make wrappers for native C++ code as usual in C# and basically that's all.

If you need help in interfacing C# with C++, please visit the Microsoft forums or look here.

Or, you can start "from scratch", write a C# program that works with WinUSB API (this is how USB DFU bootloader of STM32 looks to host), and convert .elf file to format that DFU understands. This is harder but doesn't haul dependencies.