cancel
Showing results for 
Search instead for 
Did you mean: 

I have a fundamental situation I think we all in the ST Community should be concerned

TFlac
Associate III

I have a fundamental situation I think we all in the ST Community should be concerned about and want to make better as we go forward. I have been working with the STM32 solution for about 4 months now, and making it my mission to learn and stay with ST and this product. This is important as ST has so many products that complement the STM32 solution.

Nevertheless, here is what I am up against. I own several STM32 Eval boards, the one I want to talk about today is the STM32F303RE, and it is a good choice as it is a very simple board. My four months have allowed me to learn many things I want to share. I'm actually semi-stuck at this moment and here is my story, maybe we can all learn something.

I have a project where I needed to create a system that can calculate external input frequency and duty-cycle using this STM32F303RE board. This is a simple design; there are actual examples in the STM32CubeF3 Repository. The tools I used are the STM32CubeMX and STM32CubeIDE. I would like to say a little about these tools. My comments on the tools relate to the FIRMWARE package that is used for the particular STM32 family; in this case it would be the STM32CubeF3.

This firmware package STM32CubeF3 has several applications and examples for the Nucleo, Discovery and STM32F0 family. The first surprise for the newcomer is the fact that the firmware package contains examples for EWARM (IAR Inc), MDK-ARM (Keil Inc) and last TruStudio (Atollic - now owned by STMicro). Note the STM32CubeF3 firmware does not include any designs for the latest tool STM32CubeMX and STM32CubeIDE combo. Latest advertising from ST Atollic website states that the STM32CubeIDE will replace the TruStudio Product. This is good to know. For now the closest you can get to STM32CubeIDE is the ST-TruStudio (Atollic).

OK, this is all good; the next tool I wish to discuss is the STM32CubeMX, a very nice tool that allows the engineer to specify a particular EVAL board, lets the engineer determine the peripherals that are required, and once completing the parameters, the CubeMX tool will generate a basic structured C-source file. The really nice thing is the CubeMX tool creates the proper folder structure the design will require; this saves lots of time and heartache.

Now here comes the problem, as mentioned earlier, the STM32CubeF3 along with other STM32 Firmware packages has many great examples. One would think that he/she could go in and use these examples with ease; this is not the case. My dream flow would be to start a design using STM32CubeMX, input my parameters, generate the initial C code structure, and last, see what other firmware examples I could bring into my CubeMX design flow. For my 4 months, I have found this is either very difficult or impossible. Yes there are conversion tools, but they don’t solve the problem for the CubeIDE/CubeMX Combo usage.

Positive information is next, I was able to get the Firmware example "TIM_PWMinput�? to function as expected, all the way through DEBUG. But nothing like the way STM32 documents would instruct. After weeks of playing with STM32CubeMX, STM32CubeIDE and SW4STM32 (AC6), I have some final conclusions and trails I want to share.

To get the STM32CubeMX and STM32CubeIDE to run an Example from the firmware package; first I started with STM32CubeMX, created my C-code, STM32CubeMX would then switched to the STM32CubeIDE perspective window. Now here is the interest part, I was now ready to open the firmware example "TIM_PWMinput" to add to my newly C-Generate design. First, I went to the folder within STM32CubeF3 using Windows Explorer and looked at the Readme file from the example folder created by the design engineer. The most important part of that README file for the TIM_PWMinput example was at the very end, where the designing states: "How to USE example, Copy and Rebuild all provided files into your design to get design to work. Design has been testing on STM32F303RE". So After many other trials and errors with IMPORTING using the STM32 Documents, I simply did as the README file stated.

So, I went into my newly STM32CubeMX create C-Code and literally erased everything that STM32CubeMX created. I then copied all the files from the TIM_PWMinput Example folder; this included all the C and H files including the HAL files; I mean everything. For all practical purpose I left nothing behind that STM32CubeMX created. I then compiled and downloaded the example to the STM32F303RE board, guess what - IT FUNCTIONED PROPERLY!

As good as this seemed, a working design, there was bad NEWS; I have a working design that is STM32CubeMX is no longer related to. If I were to go back and open the STM32CubeMX perspective and re-generate the design, the CubeMX would erase all the software I just copied into the design. So in light of this, I knew I could never use STM32CubeMX again in this design, it would work against my working design, so I made sure to never regenerate from within STM32CubeMX. This is unfortunate, as I want STM32CubeMX to be a part of my design. I ask my self “Where do I go from here�??

My first thought would be to see if I could fool the tool, I figured if I could get STM32CubeMX to create the initial C-code, then SLIP the code from the example into the USER ZONED areas allowed by STM32CubeMX, I could have my cake and eat it too. So I tried this, so far, there are full of ERRORS in the main.c file. Not sure what I am missing.

My second attempt to fool the tools was to start the STM32CubeMX again, this time instead of slipping in example code into the 'ALLOWED ZONES" after the c-code was generated, I decided to look at the example TIM_PWMinput example and set up the peripherals within STM32CubeMX the same way as in the example design. This way I would not have to manually copy the example code. The final design would be a STM32CubeMX friendly design and now I have it all.

This above did not work out, the design did compile with no errors, the design was able to download via DEBUG, but the design simply did nothing. I soon learn to use the special features from within STM32CubeIDE, namely the ability to see to SFR (Special Function Registers), I knew I could see the CCRx registers in real time, check if they updating, this action was successful with the functioning "COPY PASTE ALL" approach. In the functioning design I was able to see the CCRx registers updating, in the newly designed STM32CubeMX design the SFRs were silent – no updating. I repeatedly went back to STM32CubeMX and adjusted the TIM3 parameters to get some life into the SFRs CCRx registers - NOTHING. Maybe I don't know how to set up the TIM_PWMinput design through CubeMX, I looked at the design for many hours to see where my error could be, I did locate one error on my behalf, the TIM3 channels 2 and 1, one had to be DIRECT read and the other INDIRECT read, I made the fix and the results were the same, no errors, also no functionality.

So there is my story and my request to STM32 team, how do we STM32 designers get the many fine STM32CubeF3 examples into the STM32CubeMX space? This would be a WIN for all who wishes to use the many great firmware examples provided. I attended the last three STM32 "Hands on Labs" in the Philadelphia area to see new things; it is obvious to me that STM32CubeMX is an important part of the STM Ecosystem flow. The tool is crucial for ease of design; I like it very much. What we, as the ST Community would need to know is how to get these wonderful firmware examples into the STM32CubeMX STM32CubeIDE combo flow.

The README file is attached.

Thanks for your valuable time and consideration.

T Flack

6 REPLIES 6
TDK
Guru

STM32CubeIDE is a relatively new addition. Presumably it will be better integrated with time, just as the HAL libraries were, just as STM32CubeMX was. Maybe not the ideal scenario, but it is what has happened over the past few years and we should probably expect this to continue. Some amount of expectation management is healthy for those working with STM32.

Programming with Eclipse was a PITA when you had to download a bunch of plugins to get it working correctly with debugging and everything. Fine once you had it set up, but hard to get a new team member online. Unfortunately this frustration causes a lot of people to give up. SW4STM32 was an improvement. Not sure about STM32CubeIDE, haven't used it much. CLion seems pretty good as well.

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

> how do we STM32 designers get the many fine STM32CubeF3 examples into the STM32CubeMX space

They are working on it and for some other families it's said to be done.

My concern is that ST does not work on real examples and appnotes and documentation, just the Cube stuff. Once you run out of the boundaries of Cube, you'll know why I rant.

JW

TFlac
Associate III

Thanks for this update. Since my last request I have been trying to fool the tools again. I went into edit a couple of H-files and noted, there is no sacred USER space within the H-files. No matter what you do the H-Files get edited via CubeMX.

I wonder will the improvements allow a SAFE SPOT for users to turn on certain features and tell CubeMX to leave it.

Thanks for this update. Since my last request I have been trying to fool the tools again. I went into edit a couple of H-files and noted, there is no sacred USER space within the H-files. No matter what you do the H-Files get edited via CubeMX.

I wonder will the improvements allow a SAFE SPOT for users to turn on certain features and tell CubeMX to leave it.

Amel NASRI
ST Employee

Hello @TFlac​ ,

If you take the STM32Cube packages of the new STM32 products (STM32G0 and STM32G4) , you will find the .ioc file for each project example.

So we are hearing you :) , and we implement your requests on the limit of what is possible for sure.

-Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hi Amel,

This is good news. I do have an Eval board for STM32G files and I will surely look at the .ioc file you have suggested. Thanks you so much for your feedback, this is a good response and I'm sure ST is working hard to bring updated material to the users. I am equally trying to get through my designs and work around tool issues. As I stated I put lots of time in trying to fool the tools to get functioning positive results. As you know, the Out-of-Box Experience is the most important.

In my last job I designed power supplies for a company called Dialight Inc (LED Lighting) and used over 2.5 million MOSFETs from ST. I have 450K power supplies of one model in the field with less than 1% failure. So I know ST has what it takes.

Thanks

TF