element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Energy Harvesting Design Challenge
  • Challenges & Projects
  • Design Challenges
  • Energy Harvesting Design Challenge
  • More
  • Cancel
Energy Harvesting Design Challenge
Blog Writing Code for the EFM32
  • Blog
  • Forum
  • Documents
  • Files
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: vsluiter
  • Date Created: 20 May 2013 8:27 PM Date Created
  • Views 496 views
  • Likes 1 like
  • Comments 1 comment
  • low_power
  • low_energy
  • 32_bit
  • enery_efficiency
  • efm32
  • energy_micro
  • energy_saving
  • energy_harvesting_challenge
Related
Recommended

Writing Code for the EFM32

vsluiter
vsluiter
20 May 2013

While the glue for the Peltier module is curing, I'll start writing some code for the EFM32. The target is of course to make the complete solution low power, so I'll start by looking how the demo loaded on the board was programmed.

 

Turn it off when not needed

To realize low power: do as little as possible! The temperature demo reads the temperature sensor, convertst those values to Celsius or Fahrenheit numbers, and displayst them on the LCD screen, while reacting to input buttons. Not a real 'power horse application' to show the power of the Gecko Giant peripherals and M3 core, but a very good application to show how to stuff functionality in low power.

After initializing the microcontroller, an application loop is entered that repeatedly does this:

  • Start the AD converter
  • Go to sleep (EnergyMode1)
  • On getting an interrupt the value is read, and displayed on the TFT
  • Device goes to sleep (EnergyMode2) for 2 seconds

 

Diving into EnergyModes

To get low power, all modern microcontrollers have several ways to conserve power. For all ARM Cortex processors this is realized by turning off all peripherals on startup. Unused peripherals will remain powered off, and the programmer has to turn on peripherals (GPIO, UART ,SPI..) that have to be used.

Another way to be low power is to shut off certain blocks of the microcontroller. This is done with EneryModes, as described in AN0007 from EnergyMicro (you'll have to download Simplicity Studio to get the documentation). A quick and blunt overview of EnergyModes in the EFM32:

  • 0: Run mode; everything active
  • 1: Sleep mode; Only CPU is disabled. RAM, Flash and peripherals are available; when DMA (Direct Memory Access) is used, operations can run autonomously (send blocks of data over serial port without using the CPU!!). Device is 'woken up' by an event or an interrupt.
  • 2:Deep Sleep Mode; only low frequency peripherals may be running. Think of slower running timers, or (relatively slow) serial communication. Again, the device is woken up by an interrupt or an event.
  • 3: Stop Mode. No clocks are running. Device may be woken up by a watchdog, or a digital input change, or by I2C address match (wow! possible by using i2c's own clock signal. Cool feature)
  • 4: Shut Off mode. Does what it says. Can only be revived by resetting, which may be done by a special backup RTC in some devices. Supply current as low as 20nA. Yes, nanoampere.... But then again; you can't do anything image

 

LESense

The EFM32s also have some very nice tools to run measurements on resistive, inductive and capacitive sensors while staying in Energy Mode 2 (Deep sleep). This is very cool; you don't need to wake up from this mode to make a measurement, and you can even set up a range of measurements to be done while in deep sleep mode. As far as I can quickly scan through the resistive measurement techniques (most interesting for me) this is more for rough indicational measurements (on/off, trip points) than for precise analog values.

 

Conclusion

For my application the temperature demo could be a very good basis; I don't need frequent updates, I'll use a button or two, and I need to take a measurement and do some calculations. Great start, this setup!

  • Sign in to reply
  • COMPACT
    COMPACT over 12 years ago

    Hi Victor,

    Have a look at my articles on EFM32.

    The originally loaded Thermometer application is easily reloaded using Simplicity Studio, via Examples, EFM32_STK3700, inttemp, Source.

    For me this opened up IAR and loaded up the application ready to "Download and Debug".

     

    Cheers

    Very Compact

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube