Author Topic: STM32CubeMX Advanced Peripheral Setup Explanations???........  (Read 2987 times)

0 Members and 1 Guest are viewing this topic.

Offline SmokeyTopic starter

  • Super Contributor
  • ***
  • Posts: 2591
  • Country: us
  • Not An Expert
STM32CubeMX Advanced Peripheral Setup Explanations???........
« on: November 14, 2018, 10:34:14 am »
tl:dr = Is there an official resource that gives either config examples or at least a detailed explanation for all the peripheral configuration options in CubeMX?
 

Offline SmokeyTopic starter

  • Super Contributor
  • ***
  • Posts: 2591
  • Country: us
  • Not An Expert
Re: STM32CubeMX Advanced Peripheral Setup Explanations???........
« Reply #1 on: November 14, 2018, 10:36:34 am »
I'm using STM32CubeMX for the first time in a real project.  Simple stuff like GPIO isn't a problem, but and I'm having a hell of a time trying to understand how to set up the advanced peripherals like the timers using the GUI. 

For those not familiar, there are a lot of options to click through.  Here is an example.
Mode setup:


Then the full setup:


It gets even more unclear when you want to set up the timer as an encoder interface.  Setting "Combined Channels" = Encoder mode greys out channels 1 and 2 with the text "Disabled", which are actually the ones that get used in this mode.  Channels 3 and 4 are still shown as valid options but are unused.  This seems really backwards.
http://elastic-notes.blogspot.com/p/cubemx-stm32-encoder-interface.html
« Last Edit: November 14, 2018, 10:40:14 am by Smokey »
 

Offline capt bullshot

  • Super Contributor
  • ***
  • Posts: 3033
  • Country: de
    • Mostly useless stuff, but nice to have: wunderkis.de
Re: STM32CubeMX Advanced Peripheral Setup Explanations???........
« Reply #2 on: November 14, 2018, 10:50:10 am »
Without having read and understood the appropriate STM32 controller user manual, the Cube tools isn't too helpful. It just offers a lot of choices according to the register descriptions found in the manuals.
Safety devices hinder evolution
 

Offline SmokeyTopic starter

  • Super Contributor
  • ***
  • Posts: 2591
  • Country: us
  • Not An Expert
Re: STM32CubeMX Advanced Peripheral Setup Explanations???........
« Reply #3 on: November 14, 2018, 11:34:03 am »
Without having read and understood the appropriate STM32 controller user manual, the Cube tools isn't too helpful. It just offers a lot of choices according to the register descriptions found in the manuals.

I totally agree.  Nothing is better than fully understanding the register level configuration.  This is not my first embedded system design, but this is the first time using STM32 and a HAL and I figured I'd take advantage of the tools available. 

I guess my problem is:  If the point of the HAL and GUI is to simplify setup and configuration so people don't need to manually define everything at the register level then it sort of defeats the purpose to make people dig through the register level documentation to figure out how to use the GUI.

Thinking about it, a configuration wizard is what's missing.  Something that steps you through the options with explanations for each option. 
« Last Edit: November 14, 2018, 11:48:51 am by Smokey »
 

Offline AndyC_772

  • Super Contributor
  • ***
  • Posts: 4228
  • Country: gb
  • Professional design engineer
    • Cawte Engineering | Reliable Electronics
Re: STM32CubeMX Advanced Peripheral Setup Explanations???........
« Reply #4 on: November 14, 2018, 12:59:31 pm »
I liken it to a tour guide who is supposed to help you get around in a foreign country.

If you can ask them for the correct bus or train ticket for a day's outing, and they're able to buy it and hand it to you, then that's great. They're doing a useful job.

CubeMX is more like a guide who responds with "OK, no problem, you tell me exactly what words to say and to whom, and I'll say them on your behalf".

It's not helping; you need to learn the local language, and how its transport infrastructure works, for yourself. Once you've done that, you don't need the guide anyway.

Offline SmokeyTopic starter

  • Super Contributor
  • ***
  • Posts: 2591
  • Country: us
  • Not An Expert
Re: STM32CubeMX Advanced Peripheral Setup Explanations???........
« Reply #5 on: November 14, 2018, 01:29:44 pm »
¿Donde Esta La Biblioteca?...   

... alt-168 is the only extended ASCII code I consistently remember :)
 

Offline richardman

  • Frequent Contributor
  • **
  • Posts: 427
  • Country: us
Re: STM32CubeMX Advanced Peripheral Setup Explanations???........
« Reply #6 on: November 14, 2018, 07:52:10 pm »
CubeMX and all the ST libs (SPL, HAL, etc.) are basically just veneer on top of the I/O registers. There is no functional abstractions except the simplest cases. So, yes, you will need to RTFM. CubeMX does do a good job showing the clock tree visually though. That's probably one of its most important functions.
// richard http://imagecraft.com/
JumpStart C++ for Cortex (compiler/IDE/debugger): the fastest easiest way to get productive on Cortex-M.
Smart.IO: phone App for embedded systems with no app or wireless coding
 

Offline JVR

  • Regular Contributor
  • *
  • Posts: 201
  • Country: be
Re: STM32CubeMX Advanced Peripheral Setup Explanations???........
« Reply #7 on: November 15, 2018, 10:16:13 am »
Cube is not intelligent, it is barely a code generator. What it does, is give you a GUI on top of register access, and generates some of the code to instantiate those registers. You are still responsible for connecting lots of different bits together. Once you understand that, Cube becomes a great way to save 3 days of manual pin-planning and coding up register definitions. Does any of Cube's source files ever make it into my production code? Fuck no, they are just there to copypasta from so I don't have to smash a keyboard.
 
The following users thanked this post: diyaudio, nugglix

Offline SmokeyTopic starter

  • Super Contributor
  • ***
  • Posts: 2591
  • Country: us
  • Not An Expert
Re: STM32CubeMX Advanced Peripheral Setup Explanations???........
« Reply #8 on: November 16, 2018, 07:26:55 am »
Cube is not intelligent....

Isn't this a shame though?  I mean with only a little more work it could be a full on configuration tool based on functionality at a high level.  The wizard walk-through is the way to go here. 

How is Microchip's Harmony in this respect?  Does that tool have more intelligence than CubeMX?
 

Offline JVR

  • Regular Contributor
  • *
  • Posts: 201
  • Country: be
Re: STM32CubeMX Advanced Peripheral Setup Explanations???........
« Reply #9 on: November 16, 2018, 09:16:58 am »
Well yes, but then you have to sit with the support calls. And modern MCU's have so many options to interconfigure peripherals that writing code to iterate every option would be suicide. Its still up to the engineer to have read the documents, and understand the choices he is making, a wizard will never be able to explain the intricacies. And if someone wants that, then they can go back to arduino, where you get spoon fed other people's code, and its undoable if "there is no library for it"

As for Harmony, its been ages since I've used it, but from what I remember it is much the same, it saves you keyboard time, it wont write your application for you.
 
The following users thanked this post: nugglix

Offline diyaudio

  • Frequent Contributor
  • **
  • !
  • Posts: 683
  • Country: za
Re: STM32CubeMX Advanced Peripheral Setup Explanations???........
« Reply #10 on: November 16, 2018, 11:23:20 am »
Cube is not intelligent, it is barely a code generator. What it does, is give you a GUI on top of register access, and generates some of the code to instantiate those registers. You are still responsible for connecting lots of different bits together. Once you understand that, Cube becomes a great way to save 3 days of manual pin-planning and coding up register definitions. Does any of Cube's source files ever make it into my production code? Fuck no, they are just there to copypasta from so I don't have to smash a keyboard.

CubeMx always gets alot of flak but this is one of the best things it does right the pin mapping and initialization saves a ton of time the pin mapping diagram is really useful as well, its not a bad tool it can do better in other aspects.   
 
The following users thanked this post: samofab

Offline SmokeyTopic starter

  • Super Contributor
  • ***
  • Posts: 2591
  • Country: us
  • Not An Expert
Re: STM32CubeMX Advanced Peripheral Setup Explanations???........
« Reply #11 on: November 16, 2018, 08:45:54 pm »
Well yes, but then you have to sit with the support calls.....

This depends entirely on how big and established the company is.  Look at what TI did.  They were tired of handling support directly so they made the E2E web forum support system to handle virtually all of their support issues.  Post your problem and someone will get back to you in a reply, either community member or TI staff.  TI must have figured that they were a big enough and well established enough company with a good enough product that they can pull this off, and I think they are mostly right.  Now I don't really like working with the E2E system, but in reality it's not much worse than sending an email to whoever your official support guy was before and waiting for him to get back to you eventually.  At least with E2E there was a chance a community member would answer your question as well.

So I guess what I'm trying to say is that there are ways around the support issue so it's not a crushing burden.  Having CubeMX do intelligent configuration based on functionality would be a game changer and increase ST part usage enough to justify the support.
 

Offline SmokeyTopic starter

  • Super Contributor
  • ***
  • Posts: 2591
  • Country: us
  • Not An Expert
Re: STM32CubeMX Advanced Peripheral Setup Explanations???........
« Reply #12 on: December 19, 2018, 11:26:14 am »
Hmm.. STM32CubeMX v5.0.0 was released with a totally new GUI layout, but as far as I can tell no new wizards.  Bummer.
 

Offline Cicero

  • Contributor
  • Posts: 20
  • Country: gb
Re: STM32CubeMX Advanced Peripheral Setup Explanations???........
« Reply #13 on: December 19, 2018, 02:04:11 pm »
Agreed with most of the above.

There is no substitute for reading through the manual for anything more than basic setup.

But the Cube definitely helps speed up your initial code generation, making sure you've got your pinout correct and can access certain pins with whatever peripheral combination you're using, it so quickly picks up conflicts. Clocks are sorted very quickly and visually.

I do find the HAL drivers bloated, and I've often had to jump in and modify them slightly because they restrict certain features, or force certain actions/sequences unnecessarily.

 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: STM32CubeMX Advanced Peripheral Setup Explanations???........
« Reply #14 on: December 23, 2018, 10:54:44 pm »
Without having read and understood the appropriate STM32 controller user manual, the Cube tools isn't too helpful. It just offers a lot of choices according to the register descriptions found in the manuals.

I totally agree.  Nothing is better than fully understanding the register level configuration.  This is not my first embedded system design, but this is the first time using STM32 and a HAL and I figured I'd take advantage of the tools available. 

I guess my problem is:  If the point of the HAL and GUI is to simplify setup and configuration so people don't need to manually define everything at the register level then it sort of defeats the purpose to make people dig through the register level documentation to figure out how to use the GUI.

Thinking about it, a configuration wizard is what's missing.  Something that steps you through the options with explanations for each option. 

Yep been there. Oh look i can set all this stuff up with a GUI, so i want a PWM output, bam, there's all the code, great, now how do i turn it on, duh! If i have to read the code output to understand how to use it I may as well just read the datasheet and thoroughly understand the registers and write my own initialisation code.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf