Go Down

Topic: My first STM32 - level of difficulty (Read 257 times) previous topic - next topic

DocStein99

I noticed they have STM32 boards can be bought for almost the same money as a Nano board.  So I started to watch a few tutorials and they stressed about the level of difficulty just to get a "HELLO WORLD" blink application up. 

I was wondering if anyone here recently tried out one of these boards, and can comment on ease or difficult getting first project(s) up.  My main concern is how I have probably been spoiled with the Arduino libraries that I've learned to use that mostly handle lots of the study work, with interfacing SPI, LCD's, etc...

The purpose of my question, is because I need to make some devices to count encoder signals from various motors, and glass-scale linear encoders.  8-bits 16mhz is not enough speed just to handle ONE axis.  I figured I would use this opportunity to begin learning STM32 processors.

MrMark

You don't say what development environment you're using, but there is an STM32 extension to the Arduino ecosystem.  It supports several commonly available boards and many Arduino libraries have been ported to that environment.  Flashing most boards generally requires a programming device (STLink-V2) and is therefore a bit more complicated than an Uno, but it isn't much different or more involved than a pro-micro.

http://wiki.stm32duino.com/index.php?title=Main_Page

DocStein99

I use Visual Studio, with the Visual-micro extension.  The debugging throttle seems to interfere so much with my test applications, I wind up compiling in RELEASE and using my own serial output to debug. 

I did read the parts where I have to use the USB/STK programmer tool, and move a jumper around to upload code & swap the board into RUN mode.  It's a handicap I will adjust to, since I am so used to re-uploading modified code every 5 minutes, without manually flip-flopping pins each time.  I also understand they run at 3.3 volts -vs- 5volts which I am used to designing my circuits with.

One of the video's I watched, the person was explaining how they struggled at first to understand the initial setup defaults for all the timers and / or whatever else has to be set or initialized at default.





MrMark

If you use Visual Studio (or the other "professional grade") development tools and the STM libraries, there is a very steep learning curve.  I don't know that it's substantially more or less difficult than AVR programming in Atmel Studio in that one needs to understand register level chip functions and/or complex libraries from which the typical Arduino user is insulated.  My point in the previous post is that Arduino programming tools, with their inherent advantages and disadvantages, exist for some STM32 boards and might be the fast track for a particular project.  

avr_fred

If it is only a couple of projects that require additional processing power, IMO the effort to get STM32 devices working is in no way offset by the lower price. The library support is also lacking as mentioned. Been there, tried 'em. Not impressed. That said, the stm32dunio site can be a great resource if you really want to make the leap.

If you like the Arduino ecosystem but just need more horsepower, consider using a Teensy 3 series board. Paul of PJRC has ported all of the common Arduino libraries and others and be ported with little to no difficultly. The Teensy 3.5 has a 120mhz clock, 512k of flash and 256k of ram complete with FPU all for the price of an official Uno ($25).

Jiggy-Ninja

#5
Aug 17, 2017, 05:20 pm Last Edit: Aug 17, 2017, 05:21 pm by Jiggy-Ninja
One of the video's I watched, the person was explaining how they struggled at first to understand the initial setup defaults for all the timers and / or whatever else has to be set or initialized at default.
That's probably just because ARM is different from AVR. Sleep modes will be different, interrupts will be different, every last one of the peripherals is going to have some subtle difference in the names they use for registers and the bits in those registers, as well as different feature sets and different procedures for enabling and disabling certain functions.

I have a "blue pill" board, but I've done literally nothing with it. I really should get on that.
Hackaday: https://hackaday.io/MarkRD
Advanced C++ Techniques: https://forum.arduino.cc/index.php?topic=493075.0

DocStein99

#6
Aug 17, 2017, 07:06 pm Last Edit: Aug 17, 2017, 07:13 pm by DocStein99
A big thing I find is how these oscillator, crystal, clock - or whatever timing methods the STM32 will throw me off.  "STM32F103C8T6 development board" appears to come with "8.00" mhz crystal on it, I read "UP TO 72MHz".  I have to study every register to nail down each parameter on every timer to set, for a common UART debugging port output "HELLO" @ 15200 when I want to test a 500ms LED blink light.  As I discovered the DEBUGGING MODE in Visual Studio causes the timing to be throttled (on 8-bit Arduino) in ways that have made my programs malfunction and gets worse with every break-point and debug output function.  With more communication ports on STM32, I won't need to use SoftwareSerial, but that only means I must master each and every possible register bit on every on-board function/peripheral I plan to use.

avr_fred: You may be right.....  I will get overwhelmed with a dramatic jump from 8-bit to 32-bit STM.  Learning a TEENSY board is a more gradual step.  I might need to just read a book to teach me, instead of getting confused by unlimited tutorials and examples that assume I know what a TC2B1CA2BA0 register is.


Jiggy-Ninja

A big thing I find is how these oscillator, crystal, clock - or whatever timing methods the STM32 will throw me off.  "STM32F103C8T6 development board" appears to come with "8.00" mhz crystal on it, I read "UP TO 72MHz".
A PLL is used to multiply the frequency internally.

Quote
means I must master each and every possible register bit on every on-board function/peripheral I plan to use.
You have to do that anyway if you can't find a premade library for some Arduino peripheral, or if you don't like the existing libraries and want to remake one.

Quote
avr_fred: You may be right.....  I will get overwhelmed with a dramatic jump from 8-bit to 32-bit STM.  Learning a TEENSY board is a more gradual step.  I might need to just read a book to teach me, instead of getting confused by unlimited tutorials and examples that assume I know what a TC2B1CA2BA0 register is.
The change from 8-bit to 32-bit doesn't have anything to do with it, it's entirely because you're changing from familiar to unfamiliar. You'd be just as disoriented switching to 8-bit PIC or MSP or STM8.

Have you tried this Youtube series: https://www.youtube.com/watch?v=R6SstBoXjKc
Hackaday: https://hackaday.io/MarkRD
Advanced C++ Techniques: https://forum.arduino.cc/index.php?topic=493075.0

Lennyz1988

#8
Aug 18, 2017, 05:16 pm Last Edit: Aug 18, 2017, 05:20 pm by Lennyz1988
I noticed they have STM32 boards can be bought for almost the same money as a Nano board.  So I started to watch a few tutorials and they stressed about the level of difficulty just to get a "HELLO WORLD" blink application up. 

I was wondering if anyone here recently tried out one of these boards, and can comment on ease or difficult getting first project(s) up.  My main concern is how I have probably been spoiled with the Arduino libraries that I've learned to use that mostly handle lots of the study work, with interfacing SPI, LCD's, etc...

The purpose of my question, is because I need to make some devices to count encoder signals from various motors, and glass-scale linear encoders.  8-bits 16mhz is not enough speed just to handle ONE axis.  I figured I would use this opportunity to begin learning STM32 processors.
Don't worry. There is an fully functional Arduino core for the STM32.

Here is the github with the files and the installation instructions:

https://github.com/rogerclarkmelbourne/Arduino_STM32/wiki/stm32duino-bootloader

Here is the forum:

http://www.stm32duino.com/

If you install the Arduino bootloader on the STM32, then it's actually the same as an Arduino board. A lot of libraries from Arduino work and a lot others are already ported.

Here is the wiki with more information:

http://wiki.stm32duino.com/index.php?title=Main_Page

Go Up