STM32 projects not created with Cube - Page 1
Forum section: electronics / general

author: luiHS
author_rank: Frequent Contributor
timestamp: March 10, 2021, 10:37:49 pm
content: HiI am loading and working with sample sources that come in the STM32Cubeide for the STM32H747.The problem I see is that all these sources are not created with Cube, so if I want to modify anything in the configuration, for example the clock instead of with an external oscillator that is with crystal, add a serial port, interrupts, DMA, etc, I have to do it by modifying the sources manually.Is there a way to make changes using Cube on a project that was not created with Cube?It surprises me, because I work with the NXP Kinetis MK66 and i.MX RT and always in any project you can use the config tools from MCUXpresso to configure anything. Things like setting the GPIOs, assigning interrupts to them, setting the clock, a serial port, everything can always be done in graphical mode without the need to manually create source code.How is it that in the STM32 if you don't create a Cube project, nothing can be configured graphically? My question is if somehow I can reverse that situation, and make a project not created with Cube become a Cube project.Regards

author: thm_w
author_rank: Super Contributor
timestamp: March 10, 2021, 10:50:14 pm
content: Easiest would be to make another dummy project and copy over the generated code for whatever initialization you wanted to add on.I assume the project is already HAL based? Does it look like it was originally generated with cubemx or not?

author: luiHS
author_rank: Frequent Contributor
timestamp: March 11, 2021, 01:00:21 am
content: Quote from: thm_w on March 10, 2021, 10:50:14 pmYes, I also thought the same thing, create a Cube project, configure the clock with crystal there and then copy and replace the source part generated with Cube over the original. I also need to add a serial port, I will have to do something similar.The original project is one of the ones that ST gives as an example with the STM32Cubeide for the H7s, but at least the ones I'm looking at are not created as a Cube project. The project has a folder with the HAL drivers.I have also thought that if I don't see it too complicated, I would create a Cube project and there I would paste the original source code, so in the end I would have a much more comfortable project to configure and modify.

author: thm_w
author_rank: Super Contributor
timestamp: March 11, 2021, 01:11:36 am
content: Yeah if you plan on using it often and making many changes, pasting it into a cube project would be the way to go. Save headaches later on.

author: ali_asadzadeh
author_rank: Super Contributor
timestamp: March 11, 2021, 05:14:56 am
content: luiHS, Do you have any good video tutorial link for NXP parts, specially the i.mX parts, how you can generate peripheral code like cube.

author: newbrain
author_rank: Super Contributor
timestamp: March 11, 2021, 09:39:52 am
content: Quote from: luiHS on March 11, 2021, 01:00:21 amThis is probably the easiest way, if you want to change things later.I personally just use CubeMX at the beginning, to set up clocks and some basic peripheral, the go on my own (with or without HAL - it depends...)-Quote from: ali_asadzadeh on March 11, 2021, 05:14:56 amIf CubeMX is not the best thing in this world, Config Tool from NXP is a real pain in the neck (at least for me).Badly dimensioned dialogues, inconsistent behaviour, redundant panels, visualization bugs (Linux and Windows), and the general Eclipse unfriendliness.In any case, you need to select and fill the fields in the "Peripherals" section of Config Tools, and it will generate initialization code.Here is theuser manual.

author: mac.6
author_rank: Regular Contributor
timestamp: March 11, 2021, 10:04:25 am
content: If Eclipse is not your thing (and I wonder who can be), you can at least use NXP config tool in standalone mode. There is no such option for CubeMX unless generating a full project...

author: ali_asadzadeh
author_rank: Super Contributor
timestamp: March 11, 2021, 12:30:51 pm
content: I hate eclipse too, But the i.MXRT1170 seems very good, is there a way to generate peripheral code only and use keil to do the rest? what's your way of coding for i.mx series?

author: newbrain
author_rank: Super Contributor
timestamp: March 11, 2021, 04:18:19 pm
content: My way?Used MCUxpresso for some initial project setup (clocks mostly) and pin assignment. No peripheral code.Then used VS Code for everything.Debug/flash through pyocd, compile using the MCUxpresso generated makefile, clean/rebuild by launching, still from VS Code, MCUxpresso in batchmode.I haven't touched that monster IDE in months.EtA: I cooperate with a friend, I'm on Windows, he's on a Mac.Apart that he doesn't grok git and C11 complex numbers, we never had any problems.

author: luiHS
author_rank: Frequent Contributor
timestamp: March 12, 2021, 07:02:51 am
content: Quote from: ali_asadzadeh on March 11, 2021, 05:14:56 amI have learned through testing, it does not seem complicated, everything is quite simple. The only thing that I see something complex is the configuration of the clock, which values ​​to choose for the dividers and multipliers of the PLL. You can look at the MCUXpresso manual, when you download the software that manual comes that you can consult.To me, Eclipse does not seem like a complex IDE, it is very complete and with many parameters, but as soon as you have used it a few times you already know where everything is, also always using IDEs based on Eclipse gives you the advantage that it is easy to use when using microcontrollers from various manufacturers.Another thing is the plugin that each manufacturer creates for their microcontrollers, personally I think the NXP one is much better, it integrates very well to manage all the configuration graphically without having to write code. NXP also integrates into MCUxpresso the direct import of sample sources from the SDK.I am very satisfied with the use of MCUXpresso, and Eclipse in general. I do not like having to use different products for each manufacturer, I prefer that everything is centered on a single IDE for all the microcontrollers that I use which are STM32, Kinetis and i.MX RT.I only sometimes use Segger's Jflash program when I simply want to write the compiled program on a microcontroller, already in the production phase because it is more comfortable.