cancel
Showing results for 
Search instead for 
Did you mean: 

I would like to do an absolute minimum bare bones project. Could someone direct me to a C project that just shows how to make a port input or output, and how to toggle the port high and low?

MHolm
Associate II

I've got a MCBSTM32F400 development board. Every "getting started" thing I've found (blinky, for example) has like 900 files in the project, and 150,000 lines of code. This is so disheartening. I got into microcontrollers because of their simplicity.

28 REPLIES 28

Remember for simple projects you may be better off using the STM32 version of Arduino. Then many of the constructs will be familiar to you and you won't even know it;s an ARM apart from running 40 times faster.

I need to quickly move to porting over my dsPIC motor controller code. I had just wanted to get the basic motor control stuff like complementary pwms with programmable dead time, A/Ds synchronizing to the center of the pwms, and a single interrupt where all time critical stuff goes (this chip will be plenty fast for that). I'm feeling much better about it now thanks to everyone's help on here. It was just like drinking out of a fire-hose when I first opened the "blinky" project and saw around 100 files.

Yes I think things have got a bit out of hand. It can take minutes on an i7 to compile quite a simple program - slower than it used to be in the 1980s on an 8088 !

As all my embedded work is time critical, normally repeating at 96kHz, I usually start by stripping out the bits I actually might need from the libraries into a single personal header file so that the thing compiles quickly.

turboscrew
Senior III

Look ma, no libraries...

It's really not a program, but rather executable bunch of notes. All put in a single file for easy search with a text editor.

https://github.com/turboscrew/blue_pill_init/blob/master/FirstTry.c

Yes that looks a good starting point for newcomers to base their first STM32 program on. I had a quick look so maybe it's there but I couldn't see the option for turning the debug port off so that PB4 works. I remember that caused me a couple of days of frustration with my first Blue Pill.

But, please, tell me, why do you reinvent the wheel? What's wrong with the CMSIS-mandated device headers?

JW

I wanted to learn the HW, not some library. Also, the header-tree tends to be big when the modules depend on each other (GPIO-pin configuration).

Also, the libraries don't seem to support everything that the HW does.

Sorry about that. I just didn't use PB4 for anything. And I used ST-LINK V2 mini as the POD.

I'm not talking about any library, just one single header (e.g. [CubeL4]\Drivers\CMSIS\Device\ST\STM32L4xx\Include\stm32l476xx.h), defining symbols for the registers.

JW

Why would I want an include-file with over 20 000 lines?

Especially when they try to hide the handling of the bits.

Note that I'm talking about learning the HW here.