EFM32 Getting Started
LTE-M Expansion Kit 快速入门指南说明书

QSG156: LTE-M Expansion Kit Quick-Start GuideThe LTE-M Expansion Kit is an excellent way to explore and evaluate the Digi XBee3™ LTE-M cellular module which allows you to add low-power long range wireless connectivity to your EFM32/EFR32 embedded application.The Digi XBee3™ LTE-M cellular module is an easy to use cellular module. The LTE-M Expansion Kit easily integrates and brings LTE-M connectivity to compatible Silicon Labs Wireless and MCU Starter Kits through the expansion header.Software examples for the LTE-M Expansion Kit for the EFM32GG11 Giant Gecko STK (SLSTK3701A) are available in Simplicity Studio™. This guide demonstrates how to download and run one of these examples.LTE-M Expansion Kit Contents•Expansion board with Digi XBee3™wireless module socket •Digi XBee3™ LTE-M cellular module •Hologram SIM card •Cellular patch antenna •Quick Start card1. Getting StartedIntroductionThe Digi XBee3™ LTE-M cellular module is capable of sending and receiving SMS messages. This guide will walk through the steps necessary to run the Xbee SMS demo in Simplicity Studio, which demonstrates this capability.Note: An EFM32GG11 Giant Gecko STK (SLSTK3701A) is required for this demo. Please see the following guide for instructions on how to get started with the EFM32GG11 kit:QSG149: EFM32GG11-SLSTK3701A Quick-Start GuideInstall Simplicity StudioSimplicity Studio is a free software suite needed to start developing your application. Download the latest version of Simplicity Studio from the Silicon Labs website:/simplicity-studioActivate the included SIM cardThe included Hologram SIM card must be activated before it can be used with the Digi XBee3™ LTE-M cellular module. This can be done by following these instructions:1.In a browser, navigate to https://hologram.io/ and create a new account.2.Once your account has been activated, navigate to https://dashboard.hologram.io/activate and follow the instructions to completethe activation of your SIM card.Note: The activation process will ask you to configure the SIM's APN to "hologram" with username and password empty. This will be done by automatically by the demo on the EFM32GG11 STK.3.If desired, purchase a phone number for the SIM card on the dashboard in the card's Configuration page. Instructions for this stepcan be found here: https://help.hologram.io/getting-started-with-hologram/how-can-i-get-a-phone-number-to-send-sms-messages-to-my-simNote: Purchasing a phone number is not necessary, as you can still send and receive SMS messages through the Hologram dash-board without one.Assemble the Expansion Board1.Place the Digi XBee3™ LTE-M cellular module into the socket on the expansion board.2.Insert the Hologram SIM card into the SIM card slot on the module.3.Connect the included patch antenna to the module's u.FL connector labeled 'CELL'. The completed assembly is shown in the figurebelow.Download and Run the SMS DemoThe LTE-M Expansion Kit has several demos available for it that run on an EFM32GG11 Giant Gecko STK. To download and run the Xbee SMS demo:1.Once the expansion board is assembled, connect it to the expansion header of an EFM32GG11 STK, as shown below.2.Once the expansion board is connected, the EFM32GG11 STK can then be powered by connecting the USB connector on the leftand setting the switch to the AEM position.unch the demo in Simplicity Studio by finding the [SLSTK3701_lte_xbee_sms] demo under [Getting Started] in the Launcher, under [Demos].4.Follow the initialization sequence on the LCD.Note: The initialization sequence, including finding a cell signal, may take up to one minute. If this process takes longer than a minute, try to find a location with a stronger cell signal.Send and Receive SMS messagesIf you have purchased a phone number for your Hologram SIM card, you may now send SMS messages to this phone number.If you haven't purchased a phone number, you can send SMS messages through the Hologram dashboard instead.The SMS message will be received and displayed on the EFM32GG11 STK's LCD, along with the sender's phone number. The demo will automatically respond back with the message "You are linked to this Xbee" to this phone number. Pressing BTN0 on the EFM32GG11 STK will also send a message stating the number of messages the demo has received so far.Note: Sending and receiving SMS messages may take over a minute.Note: The Hologram SIM card will cause the SMS response from the module to be from a different phone number than the one as-signed to the SIM card. This response will be from a +88 number, and some carriers block these numbers automatically. If you receive no responses from the kit during this demo, you may contact your carrier and request that they allow messages from +88 numbers. Note: The SMS demo will configure the Digi XBee3™ LTE-M cellular module to search for and use the strongest carrier, between Veri-zon and AT&T. The module also has the option to be configured to use a specific carrier, if desired.Additional Resources 2. Additional ResourcesAdditional Software ExamplesTwo additional software examples for the EFM32GG11 Giant Gecko STK are available within Simplicity Studio. These can be accessed from the [Launcher] perspective under [Software Examples] with the kit selected.1.Digi XBee Device Cloud example: This example project uses a Digi XBee module to communicate via LTE-M. It transmits tempera-ture data to the Digi Device Cloud and allows a Cloud user to modify LED's on the board.2.Digi XBee Time Server example: This example project uses a Digi XBee module to receive the current time from an online timerserver and displays the time on the LCD.Additional DocumentationFor more information, please review the following:•UG310: LTE-M Expansion Kit User's Guide•https:///xbee•https://hologram.io/Silicon Laboratories Inc.400 West Cesar Chavez Austin, TX 78701USASimplicity StudioOne-click access to MCU and wireless tools, documentation, software, source code libraries & more. Available for Windows, Mac and Linux!IoT Portfolio /IoTSW/HW/simplicityQuality /qualitySupport and CommunityDisclaimerSilicon Labs intends to provide customers with the latest, accurate, and in-depth documentation of all peripherals and modules available for system and software implementers using or intending to use the Silicon Labs products. Characterization data, available modules and peripherals, memory sizes and memory addresses refer to each specific device, and "Typical" parameters provided can and do vary in different applications. Application examples described herein are for illustrative purposes only. Silicon Labs reserves the right to make changes without further notice and limitation to product information, specifications, and descriptions herein, and does not give warranties as to the accuracy or completeness of the included information. Silicon Labs shall have no liability for the consequences of use of the information supplied herein. This document does not imply or express copyright licenses granted hereunder to design or fabricate any integrated circuits. The products are not designed or authorized to be used within any Life Support System without the specific written consent of Silicon Labs. A "Life Support System" is any product or system intended to support or sustain life and/or health, which, if it fails, can be reasonably expected to result in significant personal injury or death. Silicon Labs products are not designed or authorized for military applications. Silicon Labs products shall under no circumstances be used in weapons of mass destruction including (but not limited to) nuclear, biological or chemical weapons, or missiles capable of delivering such weapons.Trademark InformationSilicon Laboratories Inc.® , Silicon Laboratories®, Silicon Labs®, SiLabs® and the Silicon Labs logo®, Bluegiga®, Bluegiga Logo®, Clockbuilder®, CMEMS®, DSPLL®, EFM®, EFM32®, EFR, Ember®, Energy Micro, Energy Micro logo and combinations thereof, "the world’s most energy friendly microcontrollers", Ember®, EZLink®, EZRadio®, EZRadioPRO®, Gecko®, ISOmodem®, Micrium, Precision32®, ProSLIC®, Simplicity Studio®, SiPHY®, Telegesis, the Telegesis Logo®, USBXpress®, Zentri , Z-Wave, and others are trademarks or registered trademarks of Silicon Labs. ARM, CORTEX, Cortex-M3 and THUMB are trademarks or registered trademarks of ARM Holdings. Keil is a registered trademark of ARM Limited. All other products or brand names mentioned herein are trademarks of their respective holders.。
EC-Win(RTOS-32)-SystemManager-Quickstart系统管理

7.1. Build instructions for RTOS-32 (with System Manager) ............................................... 31 7.2. Build instructions for RTOS-32 (no System Manager) .................................................. 31 7.2.1. Preparations for EC-Master Example Programs ................................................... 31 7.2.2. Recommended generic build instructions for RTOS-32 .....................ild instructions for Windows XP / Windows 7 ........................................................... 32 8. Appendix ........................................................................................................................... 34
acontis technologies GmbH
SOFTWARE
Windows Realtime Extension & EtherCAT-Master Stack
Getting Started Guide
Version 6.0
华三路由器软件升级指南

Linux终端中的系统初始化和服务管理命令

Linux终端中的系统初始化和服务管理命令Linux操作系统是一款开源的操作系统,具有良好的稳定性和安全性,被广泛应用于服务器和嵌入式设备中。
在Linux终端中,通过一些系统初始化和服务管理命令可以实现对系统的管理和配置。
本文将介绍一些常用的Linux终端中的系统初始化和服务管理命令。
1. 系统初始化命令1.1 apt-getapt-get命令是Debian系列Linux发行版中用于安装、更新、卸载和管理软件包的命令。
通过apt-get命令,您可以轻松地从软件仓库中安装需要的软件,并及时获取安全更新。
1.2 yumyum命令是Red Hat系列Linux发行版中的软件包管理器,包括CentOS和Fedora等。
通过yum命令,您可以方便地安装和更新软件包,同时可以管理软件源,并快速解决软件依赖问题。
1.3 systemctlsystemctl命令是用于管理systemd服务的命令。
systemd是Linux系统中用于初始化和管理系统进程的初始化系统。
通过systemctl命令,您可以管理系统服务的启动、停止和重启,并查看服务的状态和日志。
1.4 croncron是一种用于周期性执行任务的守护进程,在Linux系统中被广泛应用于自动化任务的调度。
可以使用crontab命令编辑和管理cron任务,通过设置定期执行的时间和要执行的命令,实现定时任务的自动化。
2. 服务管理命令2.1 serviceservice命令是Linux系统中用于管理系统服务的命令。
通过service 命令,您可以启动、停止、重启和查看系统服务的状态。
例如,要启动Apache Web服务器服务,可以使用命令"service apache2 start"。
2.2 systemctl前面已经介绍了systemctl命令的一些基本用法,它不仅用于系统初始化时的服务管理,还可以用于随时管理已经启动的服务。
例如,要启动MySQL服务,可以使用命令"systemctl start mysql"。
EFM8 Sleepy Bee 家族 EFM8SB2-SLSTK2011A 用户指南说明书

EFM8 Sleepy Bee FamilyEFM8SB2-SLSTK2011A User GuideThe EFM8SB2-SLSTK2011A is an excellent starting point to get familiar with the EFM8 EFM8SB2 Sleepy Bee microcontrollers.The kit contains sensors and peripherals demonstrating some of the MCU's many capa-bilities. The kit can also serve as a starting point for application development.The kit includes:•EFM8SB2 Sleepy Bee Starter Kit Board • 1 x CR2032 battery•Getting Started card •1 x mini USB cableGetting Started 1. Getting StartedHardwareTo set up the hardware for the EFM8SB2-SLSTK2011A kit:1.Provide power to the board by connecting the DBG USB connector to the PC using the provided USB cable.Move the switch to the AEM position.2.Figure 1.1. Hardware SetupSoftwareThe first step to get started with your new EFM8SB2-SLSTK2011A is to go to/simplicityThe Simplicity Studio software package contains all the tools, drivers, software examples and documentation needed to use the EFM8SB2 Starter Kit. The board comes pre-loaded with a default application, Clock, to play with while the software downloads.After downloading the latest version of Simplicity Studio and installing using the [Full] or [EFM8 / C8051 8-bit] options:1.Click the [Refresh detected hardware] button and select the EFM8SB2 Sleepy Bee Starter Kit Board under [Detected Hardware].2.Click the [Demos] tile under [Tools] to load the available demos.3.Click the [Rainbow Blinky] demo and click [Start] to download and run the demo.Additional demos showcasing the various features of the EFM8 are also available under the same tile in Simplicity Studio.Kit Block Diagram 2. Kit Block DiagramAn overview of the EFM8SB2 Starter Kit is shown in the figure below.EFM8SB2MicrocontrollerCDAJoystickFigure 2.1. EFM8SB2-SLSTK2011A Block Diagram3. Kit Hardware LayoutThe layout of the EFM8SB2 Starter Kit is shown below. Kit USBConnectorCR2032Battery HolderPower Source SelectUser PushButtons User LEDEFM8 Reset ButtonEFM8SB2 MCUExpansionHeader 128x128 PixelJoystickHumidity andTemp SensorDirectDebug ConnectorDebug IN/OUT ReferenceFigure 3.1. EFM8SB2-SLSTK2011A hardware layoutThe EFM8 device on the kit is connected to several peripherals. The table below shows all of the external connections to the MCU.Table 3.1. Kit MCU Connections4. Power Supply and Reset4.1 MCU Power SelectionThe EFM8SB2 Sleepy Bee MCU on the EFM8SB2-SLSTK2011A is designed to be powered by three different sources:•Through the on-board debugger.•By a 3 V Battery.•An externally supplied power source.Selecting the power source is done with the slide switch in the lower left corner of the board. The figure shows how the different power sources can be selected with the slide switch.A E MB ATFigure 4.1. EFM8SB2-SLSTK2011A Power SwitchWith the switch in the AEM position, an on-board low noise LDO with a fixed output voltage of 3.3 V is used to power the MCU. This LDO is powered from the "J-Link" USB cable.With the switch in the BAT position, a 20 mm coin cell battery in the CR2032 socket can be used to power the device. The device can also be powered from an external power supply using the VMCU and GND pins on the expansion header.4.2 MCU ResetThe EFM8 MCU can be reset by a few different sources:•The RESET button.•An external debugger by pulling the RSTb pin low.Power Supply and Reset5. PeripheralsThe starter kit has a set of peripherals that showcase some of the features of the EFM8 EFM8SB2 Sleepy Bee microcontroller.Be aware that most EFM8 I/O routed to peripherals are also routed to the breakout pads. This must be taken into consideration when using the breakout pads for your application.5.1 Push Buttons and LEDsThe kit has two user push buttons. They are connected to the EFM8, and are debounced by RC filters with a time constant of 1 ms. The buttons are connected to pins P0.2 and P0.3.In addition to the two push buttons, the kit also features a tri-color LED that is controlled by EFM8 GPIO. The LED is connected to pins P2.0, P2.1, and P2.2 in an active-low configuration.Figure 5.1. Buttons/LEDs5.2 JoystickThe kit has an analog joystick with 8 measureable positions. This joystick is connected to the EFM8 on the P1.7 pin and uses different resistor values to create voltages measurable by the ADC0.Figure 5.2. JoystickTable 5.1. Joystick Resistor Combinations5.3 Memory LCD-TFT DisplayA 1.28-inch SHARP Memory LCD-TFT has been added to the board to enable interactive applications to be developed. The display has a high resolution of 128 by 128 pixels and consumes very little power. It is a reflective monochrome display, so each pixel can only be light or dark, and no backlight is needed in normal daylight conditions.The display interface consists of an SPI-compatible serial interface and some extra control signals. Data are sent to the display one line (128 bits) at a time.The Memory LCD-TFT display is shared with the kit Board Controller, allowing the Board Controller application to display useful infor-mation when the user application is not using the display. The EFM8 MCU always controls ownership of the display using the EFM_DISP_ENABLE signal:•0: The Board Controller has control of the display.•1: The user application (EFM8) has control of the display.Data are clocked in on EFM_DISP_MOSI (P1.2) when EFM_DISP_CS (P1.5) is high, and the clock is sent on EFM_DISP_SCLK (P1.0). The maximum supported clock speed is 1 MHz.Please refer to the display application information for details on driving the display:/1-28-inch-memory-lcd.html8Figure 5.3. 128x128 Pixel Memory LCD5.4 Humidity and Temperature SensorThe EFM8SB2-SLSTK2011A board includes a Silicon Labs Si7021 humidity and temperature sensor to enable datalogging applica-tions. The EFM8 MCU communicates with this sensor over the I2C / SMBus hardware interface.Figure 5.4. Humidity and Temperature Sensor5.5 32 kHz CrystalThe kit has a 32 kHz crystal connected to the RTC crystal pins on the EFM8 MCU. This crystal enables the low power modes on the MCU that utilize the RTC.Figure 5.5. 32 kHz Crystal6. Connectors6.1 Breakout padsMany of the EFM8's pins are routed out to "breakout pads" at the top and bottom edges of the kit. A 2.54 mm pitch pin header can be soldered in for easy access to these pins. Most I/O pins are available, with the exception of pins used to drive the LCD.Note: Some of the breakout pads are shared by on-board EFM peripherals. The schematic must be consulted to make sure that it is acceptable to use a shared pin in your application.P 0.0P 0.1P 0.2P 0.3P 0.5P 0.60.7P 1.0P 1.1P 1.2P 1.3P 0.4P 2.7P 2.6P 2.5P 2.4P 2.2P 2.1P 2.0P 1.7P 1.6P 1.5P 1.4P 2.3V M C UFigure 6.1. Breakout pads and Expansion Header6.2 Expansion headerOn the right hand side of the board an angled 20-pin expansion header is provided to allow connection of peripherals or plugin boards. The connecter contains a number of I/O pins that can be used with most of the EFM8SB2 Sleepy Bee's features. Additionally, the VMCU, 3V3 and 5V power rails are also exported.The figure below shows the pin assignment of the expansion header. With the exception of a few pins, most of the Expansion Header's pins are the same as those on the EFM32 Gecko or EFM32 Tiny Gecko starter kits.Figure 6.2. Expansion HeaderSome of the chip peripheral functions that are available on the Expansion Header are listed in the table below.Table 6.1. Some peripheral functions available on Expansion Headersheet for a complete list of alternate functions.6.3 Debug connectorThis connector is used for Debug In and Debug Out (see chapter on Debugging).Figure 6.3. Debug ConnectorTable 6.2. Debug connector pinout6.4 Direct debug connectorThis connector is used for directly debugging the EFM8 using an external debug adapter (see chapter on Debugging). This is especially useful for debugging the MCU on the STK board when the part is battery powered or powered by an external supply.Figure 6.4. Direct Debug ConnectorTable 6.3. Direct debug connector pinout6.5 Reference boardThe top-right corner of the board includes a 20-pin reference board connector. The connecter contains some I/O pins that can be used with some of the EFM8 EFM8SB2 Sleepy Bee's features. Additionally, the 3V3 and 5V power rails are also exported.The figure below shows the pin assignment of the reference board header.Figure 6.5. Reference Board Header7. Integrated Development EnvironmentFigure 7.1. Simplicity StudioSimplicity Studio includes various examples in source form to use with the Starter Kit. To run these examples:1.Provide power to the board by connecting the DBG USB connector to the PC using the provided USB cable.2.Move the switch to the AEM position.3.Click the [Refresh detected hardware ] button and select the EFM8SB2 Sleepy Bee Starter Kit Board kit under [Detected Hard-ware ].4.Click the [Software Examples ] tile under [Software and Kits ].5.In the wizard, select the EFM8SB2 Starter Kit kit and click [Next ].6.Select the desired example or demo from the list and click [Next ].7.Click [Finish ].8.Click the [Debug ] button in the IDE to build and download the code to the hardware.9.Follow the instructions at the top of the main example file to set up the hardware as needed.10.Click the [Resume ] button to start running the example.Integrated Development EnvironmentAdvanced Energy Monitor 8. Advanced Energy Monitor8.1 UsageThe AEM (Advanced Energy Monitor) data is collected by the board controller and can be displayed by the energyAware Profiler, avail-able through Simplicity Studio. By using the energyAware Profiler, current consumption and voltage can be measured in realtime.8.2 AEM theory of operationIn order to be able to accurately measure current ranging from 0.1 µA to 50 mA (114 dB dynamic range), a current sense amplifier is utilized together with a dual gain stage. The current sense amplifier measures the voltage drop over a small series resistor, and the gain stage further amplifies this voltage with two different gain settings to obtain two current ranges. The transition between these two ranges occurs around 250 µA. Digital filtering and averaging is done within the Board Controller before the samples are exported to the Energy Profiler application.During startup of the kit, an automatic calibration of the AEM is performed. This calibration compensates for the offset error in the sense amplifiers.Figure 8.1. Advanced Energy Monitor8.3 AEM accuracy and performanceThe Advanced Energy Monitor is capable of measuring currents in the range of 0.1 µA to 50 mA. For currents above 250 µA, the AEM is accurate within 0.1 mA. When measuring currents below 250 µA, the accuracy increases to 1 µA. Even though the absolute accuracy is 1 µA in the sub 250 µA range, the AEM is able to detect changes in the current consumption as small as 100 nA. The AEM produces 6250 current samples per second.Note: The current measurement will only be correct when powering the EFM8 from USB power through the debugger (power select switch set to DBG or AEM).Board Controller 9. Board ControllerThe kit contains a board controller that is responsible for performing various board-level tasks, such as handling the debugger and the Advanced Energy Monitor. An interface is provided between the EFM8 and the board controller in the form of a UART connection. The connection is enabled by setting the EFM_BC_EN (P1.4) line high, and using the lines EFM_BC_TX (P0.4) and EFM_BC_RX (P0.5) for communicating.The BC enable signal connects the EFM8 to the board controller:•0: EFM8 UART pins are isolated from the Board Controller.•1: EFM8 UART pins are connected to the Board Controller (default upon reset).Note: The board controller is only available when USB power is connected.Debugging 10. DebuggingThe EFM8SB2-SLSTK2011A contains an integrated debugger, which can be used to download code and debug the EFM8SB2 Sleepy Bee EFM8 MCU. In addition to programming the MCU on the kit, the debugger can also be used to program and debug external Silicon Labs EFM8 devices.10.1 Debug ModesProgramming external devices is done by connecting to a target board through the provided Debug IN/OUT Connector, and by setting the debug mode to [Out]. The same connector can also be used to connect an external debugger to the EFM8 MCU on the kit, by setting the debug mode to [In]. A summary of the different supported debug modes is given in Table 10.1 Debug modes on page 17.Table 10.1. Debug modesSelecting the active debug mode is done with a drop-down menu in the Kit Manager tool, which is available through Simplicity Studio. When using the debug adapter in the [Out] mode, the end device must be manually detected before debugging and programming. To do this:1.Right-click on the kit from the Simplicity Studio launch screen and select [Configure...].2.If needed, select the appropriate [Target Interface] for the external device. For example, EFM8 devices will use the [C2] selection.3.In the same dialog, click the [Detect Target] button.4.Click [OK] to close the dialog. The external target can now be debugged and programmed.10.2 Debugging during battery operationWhen the EFM8 is powered by battery and the J-Link USB is still connected, the on-board debug functionality is available. If the USB power is disconnected, the Debug In mode will stop working.To enable debugging when the USB cable is removed, connect an external debugger to the MCU Debug Header in the top right corner of the EFM8SB2-SLSTK2011A instead of the Debug IN/OUT Connector. This header is connected directly to the EFM8's debug inter-face. The pinout of this header is shown in the Connectors chapter.Kit Manager and Upgrades 11. Kit Manager and UpgradesThe Kit Manager is a program that comes with Simplicity Studio. It can perform various kit and EFM8 specific tasks.11.1 Kit Manager OperationThis utility gives the ability to program the EFM8, upgrade the kit, lock and unlock devices and more. Some of the features will only work with Energy Micro kits, while other will work with a generic J-Link debugger connected.Figure 11.1. Kit Manager11.2 Firmware UpgradesUpgrading the kit firmware is done through Simplicity Studio. Simplicity Studio will automatically check for new updates on startup.You can also use the Kit Manager for manual upgrades. Click the [Browse] button in the [Update Kit] section to select the correct file ending in ".emz". Then, click the [Install Package] button.Schematics, Assembly Drawings and BOM 12. Schematics, Assembly Drawings and BOMThe schematics, assembly drawings and bill of materials (BOM) for the EFM8SB2 Starter Kit board are available through Simplicity Studio when the kit documentation package has been installed.Disclaimer Silicon Laboratories intends to provide customers with the latest, accurate, and in-depth documentation of all peripherals and modules available for system and software implementers using or intending to use the Silicon Laboratories products. Characterization data, available modules and peripherals, memory sizes and memory addresses refer to each specific device, and "Typical" parameters provided can and do vary in different applications. Application examples described herein are for illustrative purposes only. Silicon Laboratories reserves the right to make changes without further notice and limitation to product information, specifications, and descriptions herein, and does not give warranties as to the accuracy or completeness of the included information. Silicon Laboratories shall have no liability for the consequences of use of the information supplied herein. This document does not imply or express copyright licenses granted hereunder to design or fabricate any integrated circuits. The products must not be used within any Life Support System without the specific written consent of Silicon Laboratories. A "Life Support System" is any product or system intended to support or sustain life and/or health, which, if it fails, can be reasonably expected to result in significant personal injury or death. Silicon Laboratories products are generally not intended for military applications. Silicon Laboratories products shall under no circumstances be used in weapons of mass destruction including (but not limited to) nuclear, biological or chemical weapons, or missiles capable of delivering such weapons.Trademark Information Silicon Laboratories Inc., Silicon Laboratories, Silicon Labs, SiLabs and the Silicon Labs logo, CMEMS®, EFM, EFM32, EFR, Energy Micro, Energy Micro logo and combinations thereof, "the world’s most energy friendly microcontrollers", Ember®, EZLink®, EZMac®, EZRadio®, EZRadioPRO®, DSPLL®, ISOmodem ®, Precision32®, ProSLIC®, SiPHY®, USBXpress® and others are trademarks or registered trademarks of Silicon Laboratories Inc. ARM, CORTEX, Cortex-M3 and THUMB are trademarks or registered trademarks of ARM Holdings. Keil is a registered trademark of ARM Limited. All other products or brand names mentioned herein are trademarks of their respective holders. Silicon Laboratories Inc.400 West Cesar Chavez Austin, TX 78701USASimpilcity StudioOne-click access to MCU tools,documentation, software, sourcecode libraries & more. Availablefor Windows, Mac and Linux!/simplicityMCU Portfolio /mcu SW/HW /simplicity Quality /quality Support and Community。
Get Started of ESP-IDF Programming Guide实际操作

1、获取工具链后将其解压到D盘根目录2、熟悉工具链(1)打开解压后文件夹内的mingw32.exe,当前所处的路径即为mingw32.exe的路径。
(2)通过下图(最左边)的操作可以看到,当前目录的上一层是home,再上一层不知道是哪里(你知道的话可以告诉我,谢谢),并且已经到了最上层了。
(3)在msys32文件夹下建一个esp的文件夹,并通过命令进入到该文件夹内。
note:在该终端所有路径都是使用斜杠(/),而不是反斜杠(\),Windows下是使用反斜杠。
3、获取ESP-IDF(1)使用命令git clone --recursive https:///espressif/esp-idf.git,将esp-idf克隆到该文件夹内容。
(2)克隆完成后,在该文件夹内可以看到如下内容:4、配置ESP-IDF路径(1)在路径D:\msys32\etc\profile.d下新建一个export_idf_path.sh脚本文件,并在文件内写入esp-idf的路径(即克隆下来的esp-idf存放路径)(2)关闭终端重新打开,并使用命令printenv IDF_PATH检查配置是否正常。
5、启动工程(1)使用命令cp -r $IDF_PATH/examples/get-started/hello_world . 将hello_world工程复制到esp路径下。
如果上一步的esp-idf路径配置不正确,则这里将会提示错误。
也可以手动键入路径cp -r D:/msys32/esp/esp-idf/examples/get-started/hello_world .note:复制工程也可以在资源管理器下,直接使用复制粘贴将工程复制过来,效果是一样的。
(2)现在可以进入工程配置,首先进入工程目录否则会提示“make: *** 没有规则可制作目标“menuconfig”。
停止。
”因为找不到Makefile文件。
这里发现一个问题,进入hello_world,不可以直接使用cd /hello_world,必须从esp目录开始,不懂得是为何?等待一会就会弹出配置窗口,进入串口配置“S erial flasher config ---> ”我的串口是COM25,所以直接输入COM25即可。
linux 服务挂掉时,生成core文件和释放资源的处理逻辑

linux 服务挂掉时,生成core文件和释放资源的处理逻辑
1.清理资源:当服务挂掉时,系统会自动尝试清理该服务所占用的所有资源,
包括内存、文件句柄、网络连接等。
这些资源将被系统回收并重新分配给其他进程使用。
2.生成core 文件:如果程序出现了严重错误,系统会自动生成core 文件。
core 文件包含了程序崩溃时的内存快照和堆栈跟踪信息,可以帮助开发人员快速定位问题所在。
3.日志记录:系统会将服务挂掉的事件记录在日志文件中,以便后续分析和
排查问题。
日志文件的位置通常由一系列配置文件指定。
4.重启服务:在某些情况下,系统会自动尝试重启服务,以确保系统的稳定
性和可用性。
重启服务的逻辑通常由服务自身的监控机制实现,而不是由操作系统提供。
GetStartedofESP-IDFProgrammingGuide中文翻译

GetStartedofESP-IDFProgrammingGuide中⽂翻译开始本⽂旨在帮助使⽤者建⽴基于硬件ESP32的软件开发环境。
我们将通过⼀个简单的事例说明如何使⽤ESP-IDF ( Espressif IoT Development Framework ),包括配置的菜单项,编译以及固件的下载。
引⾔ESP32在单个芯⽚上集成了WI-FI( 2.4GHz band )和蓝⽛4.2解决⽅案,包含了两个好性能的内核、超低功耗协处理器和多个外设。
采⽤40纳⽶制成,ESP32提供了⼀个强⼤的⾼集成平台,为了适应⼀系列需求,诸如⾼能效、紧凑式设计、安全可靠、⾼性能等。
乐鑫提供基础的硬件和软件资源以帮助应⽤程序开发者完成围绕ESP32系列硬件的创意开发。
乐鑫提供的软件开发框架主要是为开发者使⽤WI-FI、蓝⽛、电源管理以及其他的系统特性等技术快速开发IoT应⽤。
准备⼯作开发ESP32应⽤需要准备:●搭载Windows、Linux 或Mac操作系统的PC●建⽴ESP32应⽤的⼯具链●ESP-IDF包含了ESP32的API以及操作⼯具链的脚本●⼀个⽂本编辑器⽤于编写C语⾔程序(⼯程),例如Eclipse●ESP32开发板和⼀根⽤于连接开发和PC的USB电缆ESP32应⽤开发⽰意图准备开发环境包含⼀下三个步骤:1.配置⼯具链2.从GitHub获取ESP-IDF3.安装和配置Eclipse如果你使⽤其他的⽂本编辑器,则可以跳过最后⼀步。
建⽴开发环境,你准备开始最有趣的部分-应⽤开发。
该过程概括为四个步骤:1.配置和编写⼀个⼯程代码2.编译⼯程并链接⼯程以便建⽴⼀个应⽤3.烧录(上载)应⽤到ESP324.检测/调试应⽤指南如果你有下列开发板之⼀,请点击链接获取开发板的使⽤⽅法;否则请继续阅读后⾯的内容。
●ESP32 DevKitC●ESP-WROVER-KIT●ESP32-PICO-KIT配置⼯具链最快开始ESP32开发的⽅式就是安装预装⼯具链。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
...the world's most energy friendly microcontrollersEFM32 Getting StartedAN0009 - Application NoteIntroductionThis application note is an introduction to development using the EFM32 devicesfrom Energy Micro. It is intended as a hands-on tutorial and it is recommended towork through the tasks in the order they are presented. Even though prior EFM32knowledge is not required, basic programming and electronics skills are needed tocomplete the tasks. The examples can be run on the following kits:•EFM32 Gecko Development Kit (EFM32-Gxxx-DK)•EFM32 Gecko Starter Kit (EFM32-Gxxx-STK)•EFM32 Tiny Gecko Starter Kit (EFM32TG-STK3300)•EFM32 Giant Gecko Starter Kit (EFM32GG-STK3700)•EFM32 Zero Gecko Starter Kit (EFM32ZG-STK3200)Things you will learn:•Basic register operation•Using emlib functions•Blinking LEDs and reading buttons•LCD controller•Energy Modes•Real-Time Counter operationThis application note includes:•This PDF document•Source files (zip)•Example C-code1 Introduction1.1 How to use this application noteThe source code for this application note is placed in individual folders named after the kit the different examples are intended for:•EFM32-Gxxx-DK•EFM32-Gxxx-STK•EFM32TG-STK3300•EFM32GG-STK3700•EFM32ZG-STK3700Projects for each of the supported IDEs are found in separate folders (iar, arm, etc.). The IAR projects are also collected in one common workspace called efm32.eww, whereas the ARM (Keil) projects must be handled separately. Since the projects are slightly different for the various kits, make sure that you open the project that is prefixed with the name of the kit you are using. The code examples in this application note are not complete, and the reader is required to fill in small pieces of code through out the exercises.If you get stuck, a completed code file (postfixed with *_solution.c) exists for each examples.1.2 PrerequisitesThe examples in this application note require that you have one of the supported EFM32 kits at hand.Before you start working on this tutorial you should make sure you have done the following steps:•Installed the latest Segger J-Link drivers(/cms/jlink-software.html)•Installed Simplicity Studio (/software/simplicity-studio)•Installed an IDE that supports the EFM32 device you have on your kitIn Simplicity Studio you should also make sure that you have all the available packages installed and up to date. You can ensure this by clicking on Add/Remove and pressing the Install All button. You will also need to click on Updates and press the Update All button.2 Register OperationThis chapter explains the basics of how to write C-code for the EFM32 devices, using the defines and library functions supplied in the CMSIS and emlib software libraries.2.1 AddressThe EFM32 consists of several different types of peripherals (CMU, RTC, ADCn...). Some peripherals in the EFM32 exist only as one instance, like the Clock Management Unit (CMU). Other peripherals like Timers (TIMERn) exist as several instances and the name is postfixed by a number (n) denoting the instance number. Usually, two instances of a peripheral are identical, but are placed in different regions of the memory map. However, some peripherals have a different feature set for each of the instances.E.g. USART0 can have an IrDA interface, while USART1 has not. Such differences will be explainedin the device datasheet and the reference manual. The peripheral instances each have a dedicated address region which contains registers that can be accessed by read/write operations. The peripheral instances and memory regions are found in the device datasheets. The starting address of a peripheral instance is called the base address. The reference manual for the device series contains a complete description of the registers within each peripheral. The address for each register is given as an offset from the base address for the peripheral instance.Register address calculated from base and offsetADDRESS REGISTER = BASE PERIPHERAL_INSTANCE + OFFSET PERIPHERAL(2.1)2.2 Register descriptionThe EFM32 devices use a 32-bit bus for write/read access to the peripherals, and each register in a peripheral contains 32 bits, numbered 0-31. Unused bits are marked as reserved and should not be modified. The bits used by the peripheral can either be single bits (e.g. DIFF bit in Figure 2.1 (p. 4) ) or grouped together in bitfields (e.g. REFRSEL bitfield in Figure 2.1 (p. 4) ). Each bitfield is described with the following attributes:•Bit position•Name•Reset value•Access type•DescriptionFigure 2.1. Example register description2.3 Access typesEach register has a set access type for all of the bit fields within that register. The access types describes the reaction to read or write operation to the bit field. The different access types found for the registers in the EFM32 devices are found in Table 2.1 (p. 4)Table 2.1. Register Access Types2.4 CMSIS and emlibThe Cortex Microcontroller Software Interface Standard (CMSIS) is a common coding standard for all ARM Cortex devices. The CMSIS library provided by Energy Micro contains header files, defines (for peripherals, registers and bitfields) and startup files for all EFM32 devices. In addition, CMSIS also includes functions which are common to all Cortex devices, like interrupt handling etc. Although it is possible to write to registers using hard coded address and data values, it is recommended to use the defines, to ensure portability and readability of the code.To use these defines, we must include efm32.h in our c-file. This is a common header file for all EFM32 devices. Within this file the correct header file for the specific device is included according to the preprocessor symbols defined for your project.To make programming of the EFM32 devices simpler, Energy Micro also provides a complete C-function library, called emlib, for all peripherals and core functions in the EFM32. These functions are found within the efm32_xxx.c (e.g. efm32_rtc.c) and efm32_xxx.h files in the emlib folder.2.4.1 CMSIS DocumentationComplete Doxygen documentation for the EFM32 CMSIS library and emlib is available in API Documentation in Simplicity Studio and in the software section of the web page.2.4.2 Peripheral structsIn the emlib header files, the register defines for each peripheral type are grouped in structs as defined in the example below.Example 2.1. Peripheral structtypedef struct{__IO uint32_t CTRL;__I uint32_t STATUS;__IO uint32_t CH0CTRL;__IO uint32_t CH1CTRL;__IO uint32_t IEN;__I uint32_t IF;__O uint32_t IFS;__O uint32_t IFC;__IO uint32_t CH0DATA;__IO uint32_t CH1DATA;__O uint32_t COMBDATA;__IO uint32_t CAL;__IO uint32_t BIASPROG;} DAC_TypeDef;Together with the base address defines for the peripheral instance, writing to a register, CH0DATA, in the DAC0 peripheral instance, can then be done like this:DAC0->CH0DATA = 100;Together with the base address defines for the peripheral instance, writing to a register, CH0DATA, in the DAC0 peripheral instance, can then be done like this:DAC0->CH0DATA = 100;Reading a register can be done like this:myVariable = DAC0->STATUS;2.4.3 Bit field definesEvery EFM32 device has relevant bit fields defined for each peripheral. These are found within the efm32xx_xxx.h (e.g. efm32tg_dac.h) files and are automatically included with the appropriate emlib peripheral header file.Example 2.2. Defines for REFRSEL bit field in DACn_CTRL.#define _DAC_CTRL_REFRSEL_SHIFT 20#define _DAC_CTRL_REFRSEL_MASK 0x300000UL#define DAC_CTRL_REFRSEL_DEFAULT (0x00000000UL << 20)#define DAC_CTRL_REFRSEL_8CYCLES (0x00000000UL << 20)#define DAC_CTRL_REFRSEL_16CYCLES (0x00000001UL << 20)#define DAC_CTRL_REFRSEL_32CYCLES (0x00000002UL << 20)#define DAC_CTRL_REFRSEL_64CYCLES (0x00000003UL << 20)#define _DAC_CTRL_REFRSEL_DEFAULT 0x00000000UL#define _DAC_CTRL_REFRSEL_8CYCLES 0x00000000UL#define _DAC_CTRL_REFRSEL_16CYCLES 0x00000001UL#define _DAC_CTRL_REFRSEL_32CYCLES 0x00000002UL#define _DAC_CTRL_REFRSEL_64CYCLES 0x00000003ULFor every register field, shift, mask and default value bit fields are defined.Example 2.3. Defines for LPFEN bit field in DACn_CTRL.#define DAC_CTRL_LPFEN (0x1UL << 12)#define _DAC_CTRL_LPFEN_SHIFT 12#define _DAC_CTRL_LPFEN_MASK 0x1000UL#define DAC_CTRL_LPFEN_DEFAULT (0x00000000UL << 12)#define _DAC_CTRL_LPFEN_DEFAULT 0x00000000UL2.4.4 Register access examplesWhen setting a bit in a control register it is important to make sure you do not unintentionally clear other bits in the register. To ensure this, the mask with the bit you want to set can be OR'ed with the original contents as shown in the example below:DAC0->CTRL = DAC0->CTRL | DAC_CTRL_LPFEN; or more compactly:DAC0->CTRL |= DAC_CTRL_LPFEN;Clearing a bit is done by ANDing the register with a value with all bits set except for the bit to be cleared: DAC0->CTRL = DAC0->CTRL & ~DAC_CTRL_LPFEN; orDAC0->CTRL &= ~DAC_CTRL_LPFEN;When setting a new value to a bit field containing multiple bits, a simple OR function will not do, since you will risk that the original bit field contents OR'ed with the mask will give a wrong result. Instead you should make sure to clear the entire bit field (and only the bit field) before you OR in the new value like shown below:DAC0->CTRL = (DAC0->CTRL & ~_DAC_CTRL_REFRSEL_MASK) | DAC_CTRL_REFRSEL_16CYCLES;2.4.5 Grouped registersSome registers are grouped together within each peripheral. An example of such a group is the registers associated with each GPIO port, like the Data Out Register (DOUT) in Figure 2.1 (p. 4) . Each GPIO port (A, B, C, ...) contains a DOUT register and the description below is common for all of these. The x in GPIO_Px_DOUT indicates the port wild card.Figure 2.2. Grouped registers in GPIOIn the CMSIS defines the port registers are grouped in an array P[x]. When using this array, we must index it using numbers instead of the port letters (A=0, B=1, C=2, ...). Accessing the DOUT register for port C can be done like this:GPIO->P[2].DOUT = 0x000F;2.4.6 efm32_chip.hIn the source files included in this application note, you will see the efm32_chip.h included at the top and that CHIP_Init() is called at the beginning of the main functions. Since early versions of the EFM32 devices were programmed differently in production, the chip function is used to align the chip programming to the latest revision. Do not run any code prior to running the CHIP_Init() function in your main function.3 Example 1: Register OperationThis example will show how to write and read registers using the CMSIS defines. You will also learn how to observe and manipulate register contents through the debugger in IAR Embedded Workbench.While the examples are shown only for IAR, the tasks can also be completed in other supported IDEs. Open up efm32workspace (an\an0009_efm32_getting_started\iar\efm32.eww) and select the <kit_name>_1_register project in IAR EW. In the main function in the 1_registers.c (inside Source Files) there is a marker space where you can fill in your code.3.1 Step 1: Enable timer clockIn this example we are going to use TIMER0. By default the 14 MHz RC oscillator is running but all peripheral clocks are disabled, hence we must turn on the clock for TIMER0 before we use it. If we look in the CMU chapter of the reference manual, we see that the clock to TIMER0 can be switched on by setting the TIMER0 bit in the HFPERCLKEN0 register in the CMU peripheral.3.2 Step 2: Start timerStarting the Timer is done by writing a 1 to the START bit in the CMD register in TIMER0.3.3 Step 3: Wait for thresholdCreate a while-loop that waits until counter is 1000 before proceeding3.4 ObservationMake sure the <kit_name>_1_register project is active by pressing the corresponding tab at the bottom of the Workspace window. Then press the Download & Debug button (Figure 3.1 (p. 9) ). Then go to View->Register and find the STATUS register in TIMER0. When you expand this, you should see the RUNNING bit set to 0. Place your cursor in front of the line where you start the timer and press Run to Cursor. Then watch the RUNNING bit get set to 1 in the Register View when you Single Step over the expression. As you continue to Single Step you will see the content of the CNT registers increasing. Try writing a different value to the CNT register by entering it directly in the Register View.Figure 3.1. Debug View in IAR4 Example 2a: Blinking LEDs with STKSince accessing the LEDs is done differently for the Development Kits and the Starter Kits this example is split into two parts, 2a (for STK) and 2b (for DK). In this example for the STKs, the aim is to use the GPIO pins to light up the LEDs on the STK and change the LED configuration every time a button is pressed. Instead of accessing the registers directly, we will use the emlib functions to configure the peripherals. The efm32 workspace contains a project called <kit_name>_2_leds, which will be used in this example. The emlib C-files are included in the project. The corresponding header files are included at the beginning of the C-files. For details on which emlib functions exist and how to use them we will open up API Documentation through Simplicity Studio. After clicking on the emlib link for the correct EFM32 series (Gecko, Tiny Gecko etc.) we open up Modules->EFM32_Library and select the CMU peripheral. Scrolling down, we find a list of functions (Figure 4.1 (p. 10) ) that we can use to to easily operate the Clock Management Unit.Figure 4.1. Documentation for the CMU-specific emlib functions4.1 Step 1: Turn on GPIO clockIn the list of CMU functions we find the following function to turn on the clock to the GPIO:void CMU_ClockEnable(CMU_Clock_TypeDef clock, bool enable)If we click on the function, we are shown a description (Figure 4.2 (p. 11) ) of how to use the function.If we also click on the CMU_Clock_TypeDef link we are also taken to a list of the allowed enumerators for the clock argument. To turn on the GPIO we then write the following:CMU_ClockEnable(cmuClock_GPIO, true);Figure 4.2. CMU_ClockEnable function description4.2 Step 2: Configure GPIO pins for LEDsIn Simplicity Studio under Kit Documentation we find the User Manual for the STK that we are using, which tells us that the the user LED(s) are connected to the following pin(s):•EFM32-Gxxx-STK: 4 LEDs on port C, pins 0-3•EFM32TG-STK3300: 1 LED on port D, pin 7•EFM32GG-STK3700: 2 LEDs on port E, pins 2-3•EFM32ZG-STK3200: 2 LEDs on port C, pins 10-11Looking into the available functions for the GPIO we find the following function to configure the mode of the GPIO pins:void GPIO_PinModeSet(GPIO_Port_TypeDef port, unsigned int pin, GPIO_Mode_TypeDef mode, unsigned int out)Use this function to configure the LED pin(s) as Push-Pull outputs with the initial DOUT value set to 0.4.3 Step 3: Configure GPIO pin for buttonLooking into the User Manual for the STK we find that Push Button 0 (PB0) is connected to the following pin:•EFM32-Gxxx-STK: Port B, pin 9•EFM32TG-STK3300: Port D, pin 8•EFM32GG-STK3700: Port B, pin 9•EFM32ZG-STK3200: Port C, pin 8Configure this pin as an input to be able to detect the button state.4.4 Step 4: Change LED status when button is pressedWrite a loop that toggles the LED(s) every time PB0 is pressed. Make sure that you do not only check that the button is pressed, but also that it is released, so that you only toggle the LED(s) once for each time you press the button. PB0 is pulled high by an external resistor.4.5 Extra Task: LED animationExperiment with creating different blinking patterns on the LED(s), like fading and running LEDs (if there are multiple LEDs). Because the EFM32 runs at 14 MHz as default, you need a delay function to be able to see the LEDs changing real-time. Using what you wrote for TIMER0 in Example 1, you should be able to create the following function:void Delay(uint16_t milliseconds)Use the PRESC bitfield in TIMER0_CTRL to reduce the clock frequency to a desired value.5 Example 2b: Blinking LEDs with DKTo run this example, you need a Development Kit. The aim is to use the GPIO pins to light up the LEDs on the DK and change the LED configuration every time the joystick is moved. The efm32 workspace contains a project called <kit_name>_2_leds, which will be used in this example.5.1 Board Support LibraryThe EFM32 Gecko Development Kit uses a board controller to configure the functions of the development kit, including lighting the user leds and reading buttons/joystick. These functions can be controlled by the EFM32 by communicating with the board controller via either SPI or External Bus Interface. The EFM32 can then configure the registers in the board controller to set up the functions wanted. The EFM32 Board Support Library includes drivers for handing access to the DK. An initialize function must be run first to configure either the EBI or the SPI connection:void DVK_init(void);Devices with LCD support will automatically be set up with SPI access, while devices without LCD support will use EBI by default. The yellow lights to the left of the MCU board on the DK will tell you which connection is active.Note that the connection to the board controller will occupy the EBI or the USART2 (SPI) on your device as well as the pin connections for these. These resources can not be used for other purposes simultaneously.As the DVK functions also take care of all the settings needed for the DK connection like GPIO settings etc, you do not need to run any other emlib functions.5.2 Step 1: Change LED status when joystick is movedWrite a while loop that increases a value every time the joystick is moved and display this value on the LEDs. Make sure that you do not only check that the button is pressed, but also that it is released, so that you only toggle the LED(s) once for each time you press the button. The 16 user LEDs on the DK are configured by the following function:void DVK_setLEDs(uint16_t leds);Look inside dvk.h for a function to read the joystick status as well. Please note that by default the buttons and joystick on the DK are used to control the menu on the TFT display. To use the buttons and joystick with the EFM32, you need to press the AEM button. The button/joystick status is shown in the upper right hand corner of the TFT display5.3 Extra Task: LED animationExperiment with creating different moving patterns on the LEDs, like fading and running LEDs. Because the EFM32 runs at 14 MHz as default, you need a delay function to be able to see the LEDs changing real-time. Using what you wrote for TIMER0 in Example 1, you should be able to create the following function:void Delay(uint16_t milliseconds)Use the PRESC bitfield in TIMER0_CTRL to reduce the timer clock frequency to a desired value.6 Example 3a: Segment LCD ControllerThis example requires either an STK or a DK with MCU board with a Segment LCD. This example will show you how to use the Segment LCD controller and display information on the LCD display. The LCD controller includes an autonomous animation feature which will also be demonstrated. The efm32 workspace contains a project called <kit_name>_3_lcd, which will be used in this example.6.1 Step 1: Initialize the LCD controllerThe LCD controller driver is located in the development kit and starter kit library. First you need to run the initialize function found in segmentlcd.h to set up the LCD controller.6.2 Step 2: Write to LCD displayBy default, all LCD segments are switched off after initialization. The lcd controller driver includes several functions to control the different segment groups on the display. A few examples are:void SegmentLCD_Number(int value)void SegmentLCD_Write(char *string)void SegmentLCD_Symbol(lcdSymbol s, int on);Experiment with putting your own text/numbers symbols on the display and try to make things move about a bit. You can use the Delay function from Example 2 (If you did not complete this part of the example, a Delay function can be found in the solution file.6.3 Step 3: Animate segmentsFigure 6.1. Animation FunctionThe LCD controller contains an animation feature which can animate up to 8 segments (8 segment ring on the LCD display) autonomously. The data displayed in the animated segments is a logic function (AND or OR) of two register bits for each segment (). The two register arrays (LCD_AREGA, LCD_AREGB) can then be set up to be barrelshifted either left or right every time the Frame Counter overflows. The Frame Counter can be set up to overflow after a configurable number of frames. This is not covered by the LCD driver, so here we have to manipulate the LCD registers by doing direct register writes. The following registers must be set up:LCD_BACTRL:•Set Frame Counter Enable bit•Configure Frame Counter period by setting the FCTOP field•Set Animation Enable bit•Select either AND or OR as logic function•Configure AREGA and AREGB shift direction•For the STK3700, also set the ALOC bit to SEG8TO15LCD_AREGA/LCD_AREGB:•Write data used for animation to these registers.Play around a bit with the configuration of the animated segments and watch the results on the LCD display.7 Example 3b: Memory LCDThis example requires either an STK or a DK equipped with a Memory LCD. This example shows how to configure the Memory LCD driver and write text on the Memory LCD. The software project called <kit_name>_3_lcd, which will be used in this example.The Board Support Package for the EFM32ZG-STK3200 includes a driver for the memory LCD.Documentation for this driver is found in the "Kit BSP's and Drivers" section under API Documentation in Simplicity Studio. Figure Figure 7.1 (p. 16) shows the location of the driver documentation.Figure 7.1. BSP Documentation for DISPLAY Driver7.1 Step 1: Configure the display driverFirst, initialize the DISPLAY driver with DISPLY_Init().The Board Support Package include TEXTDISPLAY, which is an interface for printing text to a DISPLAY device. Use TEXTDISPLAY_New() to ceate a new TEXTDISPLAY interface.7.2 Step 2: Write text to Memory LCDTEXTDISPLAY implements basic functions for writing text to the Memory LCD. Try TEXTDISPLAY_WriteString() and TEXTDISPLAY_WriteChar().8 Example 4: Energy ModesThis example shows how to enter different Energy Modes (EMx) including Energy Mode 2 and wake up using RTC interrupt. The efm32 workspace contains a project called <kit_name>_4_energymodes, which will be used in this example.8.1 Advanced Energy Monitor with DKThe Development Kits includes current measurement of the VMCU power domain, which is used to power the EFM32 and the LCD display on the MCU board. The VMCU domain is also available on the prototyping board, so other external components in your prototype can be added to the measurements.The current measurement can be monitored real-time on the TFT display on the main board and also on a PC using the energyAware Profiler available in Simplicity Studio.8.2 Advanced Energy Monitor with STKThe EFM32 Starter Kits includes current measurement of the VMCU power domain, which is used to power the EFM32 and the LCD display in addition to other components in the application part of the starter kit. The real-time current measurement can be monitored on a PC using the energyAware Profiler available in Simplicity Studio.8.3 Step 1: Enter EM1To enter EM1, all you have to do is to execute a Wait-For-Interrupt instruction. An intrinsic function for this is shown below:__WFI();After executing this instruction you should see the current consumption drop.8.4 Step 2: Enter EM3Entering EM3 is also done by executing the WFI-instruction, only now with the SLEEPDEEP bit in the SCB_SCR register. Set this prior to the WFI-instruction:SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;__WFI();When in an active debug session the EFM32 will not be allowed to go below EM1. To measure the current consumption in EM2, you should therefore end the debugging session and reset the EFM32 with the reset button on the MCU board/STK.8.5 Step 3: Enter EM2To enter EM2, you must first enable a low frequency oscillator (either LFRCO or LFXO) before going to deep sleep (same as for EM3). In this example we will enable the LFRCO and wait for it to stabilize by using the following emlib function:void CMU_OscillatorEnable(CMU_Osc_Typedef osc, bool enable, bool wait) In addition the EMU emlib functions include functions for entering Energy Modes, which you can use instead of setting the SLEEPDEEP bit and executing the WFI-instruction manually:void EMU_EnterEM2(bool restore)8.6 Step 4: Configure Real-Time CounterTo wake up from EM2, we will configure the Real-Timer Counter (RTC) to give an interrupt after 5 seconds. First we must enable the clock to the RTC by using the CMU emlib functions. To communicate with Low Energy/Frequency peripherals like the RTC, you must also enable clock for the LE interface (cmuClock_CORE).The emlib initialization function for the RTC, requires a configuration struct as an input:void RTC_Init(const RTC_Init_TypeDef *init)The struct is already declared in the code, but you must set the 3 parameters in the struct before using it with the RTC_Init function:p0Top = true;Next we must set compare value 0 (COMP0) in the RTC, which will set interrupt flag COMP0 when the compare value matches the counter value. Chose a value that will equal 5 seconds given that the RTC runs at 32.768 kHz:void RTC_CompareSet(unsigned int comp, uint32_t value)Now the RTC COMP0 flag will be set on a compare match, but to generate an interrupt request from the RTC the corresponding interrupt enable bit must also be set:void RTC_IntEnable(uint32_t flags)Now the RTC interrupt request is enabled on a comparator match, but to trigger an interrupt, the RTC interrupt request line must be enabled in the Cortex-M. The IRQn_Type to use is RTC_IRQn.NVIC_EnableIRQ(RTC_IRQn);An interrupt handler for the RTC is already included in the code (RTC_IRQHandler), but it is empty. In this function, you should add a function call to clear the RTC COMP0 interrupt flag. If you do not do this, the Cortex-M will be stuck in the interrupt handler, since the interrupt is never deasserted. Look for the RTC emlib function to clear the interrupt flag.8.7 Extra task: Segment LCD controller in EM2As an extra task you can enable the LCD controller (given that you have a Segment LCD on your kit) and write something on the LCD display before going to EM2. You could also use the segment animation you made in the previous example in EM2.This extra task does not apply to the EFM32ZG-STK3200 which features a Memory LCD and not a segment LCD.9 SummaryCongratulations! You now know the basics of Energy Friendly Programming, including register and GPIO operation, use of basic functions on the DK/STK and LCD, in addition to handling different Energy Modes in the EFM32 and the emlib/CMSIS functions. The Examples section in Simplicity Studio contains several more examples for you to explore and more Application Notes are found in the App Notes section.。