Ruffian Heng embedded: the first experience of MCU Xpress config tools (pins, clocks, peripherals)


Hello, I’m ruffian Heng, a serious technical ruffian. What ruffian Heng introduced to you today isMcuxpresso config tools (pins, clocks, peripherals)

I don’t know if you have such feelings. Now the complexity of MCU chip is getting higher and higher, with hundreds of pins, dazzling clock system, a large number of peripheral registers, and thousands of pages of chip reference manual. For software development engineers, the bottom development is really more and more difficult (speaking of this, do you miss the simplicity of AT89C51 enlightenment MCU) 。

Of course, large MCU manufacturers generally launch SDK packages simultaneously to alleviate the anxiety of software development engineers, but this can not cover all the project requirements. Software engineers still can’t avoid secondary development based on the routines in the SDK that are closest to the project requirements. Therefore, there should be no fewer necessary underlying skills such as pin checking, clock allocation and peripherals.

Is there any tool that can further improve the bottom development efficiency of software development engineers? Of course! Mcuxpresso config tools is a collection of low-level development tools developed by NXP software team. Today, ruffian Heng will give you a preliminary experience of the three core components in MCU Xpress config tools: pin initialization configuration tool, clock initialization configuration tool and peripheral initialization configuration tool.

1、 Prepare development environment

First, prepare the environment, including the necessary software. The environment of ruffian Heng is as follows:

2、 Basic software mechanism

At present, mcuxpresso config tools is mainly composed of the following seven components. Except that SDK builder and project updater are general service components, the other five functional components for underlying development are framed in blue circles:

Clocks - auxiliary clock initialization configuration

More specifically, mcuxpresso config tools is to help generate the code source file pin marked in the blue box in the figure below_ mux.c/h、clock_ Config.c/h, dcd.c/h, etc. the codes in these files are related to the initialization of the underlying foundation of the chip. These source files exist in any routine in the SDK package. Of course, they can also be directly used in the actual project.

3、 Import SDK project editing

3.1 using mcuxpresso config tools

After installing the mcuxpresso config tools software, you can choose four development methods when opening it for the first time. The most recommended one is the default one, that is, based on the official SDK package, export a routine from the SDK package for secondary editing.

Each routine folder in the SDK package has a. Mex file with the same name (such as file_blinky. Mex marked in the figure below). This file is the configuration file of mcuxpresso config tools. With it, mcuxpresso config tools can obtain all the information of the selected SDK routine.

In mcuxpresso config toolsSDK PathSpecify the path of the extracted SDK package, and then select the one you likeToolchain(IAR / MDK / GCC can be used, but mcuxpresso IDE is not recommended when importing from SDK package. The next section will specifically introduce the method of using config tools under mcuxpresso IDE). Then find one that is closest to the actual projectSDK Example(the example of iled_blinky is used here). Finally, set the workspace path (the mcux_cfg_v10 folder is created in the same directory to store the project in accordance with the style of mcuxpresso IDE).

After the previous step is completed, the mcuxpresso config tools will be based on the file in the SDK package_ The blinky.mex configuration file exports the complete project package from the SDK to \ mcux_ CFG_ V10\iled_ blinky_ CM7 folder, which contains all the files_ Blinky project source file. At this time, we enter the project editing mode of mcuxpresso config tools.

3.2 using MCU Xpress IDE

If you are developing a project under the MCU Xpress IDE, you do not need to install the MCU Xpress config tools tool separately. The config tools are directly integrated in the IDE. PressSDK project import and workspace management mechanism under MCU Xpress IDEFirst export the routine and open it, and then directly in the menu barConfigToolsOr you can enter it from the shortcut icon in the upper right corner. At this time, the IDE interface will immediately switch to the config tools editing interface.

4、 Experience three pieces (pins, clocks, peripherals)

4.1 pin initialization configuration tool – pins tool

Let’s take a look at the pin initialization tool – pins. Directly check the settings in this gadget (assign by I / O name or function), and you can quickly complete all pin assignments in the project without looking at the chip reference manual. In addition, the main interface also provides a package pin view, which can intuitively see the current use of all pins. After configuration, click in the menu barUpdate CodeButton, \ mcux_ CFG_ V10\iled_ blinky_ cm7\board\pin_ The MUX. C /. H file is updated directly.

4.2 clock initialization configuration tool – clocks tool

Let’s take a look at the clock initialization tool – clocks, which is also a check setting in this gadget. You can quickly complete the clock allocation of all peripherals in the project. The biggest advantage of this tool is that it can intuitively let you see the complete clock link, which is n times more efficient than finding the settings in the manual, and finally the peripheral clock frequency values are displayed in real time, The frequency division coefficient is also very convenient to adjust. After configuration, click in the menu barUpdate CodeButton, \ mcux_ CFG_ V10\iled_ blinky_ cm7\board\clock_ The config. C /. H file is updated directly.

4.3 peripheral initialization configuration tool – peripherals tool

Finally, let’s look at peripherals, a peripheral initialization tool. In this gadget, you can check all peripheral function settings (that is, the assignment of xxperipheral_config_t-type initialization structure in the peripheral driver library in the SDK package). Some peripherals also provide more advanced application-oriented configuration, which needs to be explored slowly. After configuration, click in the menu barUpdate CodeButton, \ mcux_ CFG_ V10\iled_ blinky_ The CM7 \ board \ peripherals. C /. H file is updated directly.

So far, the introduction of the ruffian Heng of mcuxpresso config tools (pins, clocks, peripherals) has been completed. Where are the applause~~~

Welcome to subscribe

The article will be published to me at the same timeBlog Park home pageCSDN home pageZhihu home pageWeChat official accountOn the platform.

Wechat search“Ruffian scale“Or scan the QR code below to see it for the first time on the mobile phone.