1 Introduction to core board
The rt1050 processor of cortex-m7 on m1052 cross-border core board not only has the strong processing performance of MPU, but also has the advantages of simplicity and real-time of MCU microcontroller! M1052 integrates WiFi / Lora / ZigBee / Mifare wireless functions and is pre installed with aworks real-time operating system. It is designed for application in the direction of intelligent hardware and industrial Internet of things.
M1052 core board
2aworks LED lighting process
The aworks development environment eclipse and hardware evaluation backplane we use in this routine are shown in the figure:
Eclipse development environment
Hardware evaluation backplane
The construction of aworks development environment has been described in detail in Section 2 of the aworks m1050 SDK quick start document v1.01 provided by our company. The data can be downloaded free of charge on the official website of ZLG Ligong technology · Zhiyuan electronics, and will not be repeated here. Let's introduce how to light an LED lamp from the perspective of software and hardware.
3 Introduction to hardware circuit:
LED lamp circuit diagram
M1052 core board control LED lamp interface pin circuit diagram
The LED light on the m105x EV board backplane is connected to the b42 pin of the core board, which can be multiplexed into UART2 receiving signal and USB_ OTG1_ OCãQTIMER3_ Timer3 and other functions. At this time, we do not turn on the multiplexing function, and treat this pin value as an ordinary gpio1_ Io19 use.
4introduction to aworks software interface:
Aworks uniformly abstracts common external devices and defines the general interface of azimuth external devices. Such as LED, buzzer, nixie tube, key, etc. The application program is based on general interface programming, which will make the application program not bound with specific hardware devices. In other words, the application program can be reused across platforms and run on any hardware platform running aworks.
General LED interface, as shown in the figure:
Universal LED interface
In this example, we use all the above four interface functions. Let's briefly introduce these four interface functions below (for details, please refer to Section 6.1 of Chapter 6 of programming for aworks framework and interface (I)).
1. Set LED status
aw_ err_ t aw_ led_ set(int id,aw_bool_t on);
ID is the LED number, and the system assigns a unique ID to each LED. The boolean type on parameter indicates whether the LED is lit, and the value is aw_ True indicates that the LED is on, aw_ False indicates that the LED is off.
2. Turn on the LED
aw_ err_ t aw_ led_ on(int id);
ID is the LED number, and the return value of the function is the standard error number.
3. Turn off the LED
aw_ err_ t aw_ led_ off(int id);
ID is the LED number, and the return value of the function is the standard error number.
4. Flip LED status
aw_ err_ t aw_ led_ toggle(int id);
Flipping the LED state is to change the LED from on state to off state or from off state to on state, where id is the LED number.
The above LED interface function is in aw_ There are declarations in the LED. H header file. If these LED interface functions are used, the header file must be included in the code. In addition, we need to be in aw_ prj_ In params. H file, open the macro definition of LED, as shown in the figure:
Turn on macro definition of LED
The demo program code of LED is as follows:
Leddemo program
At this time, we make this function into a task (for task creation and management, please refer to Section 10.1 of Chapter 10 of programming for aworks framework and interface (I))
Led task code
Then we were at aw_ The task is called in the main function.
aw_ Main function
Finally, we compile the project to generate an. ELF file, as shown in the figure
Project compiled successfully
The compiled code can be burned into the board through the debugging window. The final phenomenon is that the LED light is on every 500ms.
Leddemo debug window
Processing performance of 5mpu and development mode of MCU
The m1052 cross-border core board is equipped with NXP i.MX rt105x processor with a main frequency of 528mhz. Based on the architecture of application processor, rt105x adopts MCU core, which can not only realize the high performance, rich functional peripherals and diversified network access interface modes of application processor, but also have the ease of use and real-time low-power operation characteristics of traditional MCU.
M1052 core board
6aworks IOT real time operating system
The m1052 cross-border core board has built-in aworks IOT real-time operating system. Aworks IOT real-time operating system adopts a framework oriented design architecture and supports the design of platform components that are "pluggable, replaceable and configurable", independent of hardware and operating system types. Users only need to modify the corresponding header file to realize cross platform reuse of application code.